cmAlgorithms: Add a size() to cmRange.

size() is already used by cmRemoveDuplicates, which is designed to
accept a cmRange.
This commit is contained in:
Stephen Kelly 2015-02-20 21:53:19 +01:00 committed by Brad King
parent 47a3e22ea5
commit bbc1a9788d
1 changed files with 3 additions and 0 deletions

View File

@ -127,11 +127,14 @@ struct Range
{
typedef const_iterator_ const_iterator;
typedef typename std::iterator_traits<const_iterator>::value_type value_type;
typedef typename std::iterator_traits<const_iterator>::difference_type
difference_type;
Range(const_iterator begin_, const_iterator end_)
: Begin(begin_), End(end_) {}
const_iterator begin() const { return Begin; }
const_iterator end() const { return End; }
bool empty() const { return std::distance(Begin, End) == 0; }
difference_type size() const { return std::distance(Begin, End); }
Range& advance(cmIML_INT_intptr_t amount)
{
std::advance(Begin, amount);