From bbc1a9788d94ed9a6f710689611c63dcc52c8b09 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Fri, 20 Feb 2015 21:53:19 +0100 Subject: cmAlgorithms: Add a size() to cmRange. size() is already used by cmRemoveDuplicates, which is designed to accept a cmRange. --- Source/cmAlgorithms.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Source/cmAlgorithms.h b/Source/cmAlgorithms.h index 4b03736..f90f105 100644 --- a/Source/cmAlgorithms.h +++ b/Source/cmAlgorithms.h @@ -127,11 +127,14 @@ struct Range { typedef const_iterator_ const_iterator; typedef typename std::iterator_traits::value_type value_type; + typedef typename std::iterator_traits::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); -- cgit v0.12