diff options
author | Stephen Kelly <steveire@gmail.com> | 2015-02-20 20:53:19 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2015-02-24 14:16:01 (GMT) |
commit | bbc1a9788d94ed9a6f710689611c63dcc52c8b09 (patch) | |
tree | 4591c240c469b200f2b03a39c16b2ff715f6142e /Source/cmAlgorithms.h | |
parent | 47a3e22ea5aee971df1e04a6447bb916af81aa2c (diff) | |
download | CMake-bbc1a9788d94ed9a6f710689611c63dcc52c8b09.zip CMake-bbc1a9788d94ed9a6f710689611c63dcc52c8b09.tar.gz CMake-bbc1a9788d94ed9a6f710689611c63dcc52c8b09.tar.bz2 |
cmAlgorithms: Add a size() to cmRange.
size() is already used by cmRemoveDuplicates, which is designed to
accept a cmRange.
Diffstat (limited to 'Source/cmAlgorithms.h')
-rw-r--r-- | Source/cmAlgorithms.h | 3 |
1 files changed, 3 insertions, 0 deletions
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<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); |