summaryrefslogtreecommitdiffstats
path: root/Source/cmAlgorithms.h
diff options
context:
space:
mode:
authorStephen Kelly <steveire@gmail.com>2015-07-18 08:47:04 (GMT)
committerBrad King <brad.king@kitware.com>2015-07-22 14:58:19 (GMT)
commit1fe71e2ef04e20ff8e1de888820496fc922bffe0 (patch)
tree9f28326fc33b69f2724ad5386a7643ce3759e4a8 /Source/cmAlgorithms.h
parent8ea0b81d20d3fff15e4aa35d68945cb1f0f011ec (diff)
downloadCMake-1fe71e2ef04e20ff8e1de888820496fc922bffe0.zip
CMake-1fe71e2ef04e20ff8e1de888820496fc922bffe0.tar.gz
CMake-1fe71e2ef04e20ff8e1de888820496fc922bffe0.tar.bz2
cmAlgorithms: Move Range type out of private namespace.
Diffstat (limited to 'Source/cmAlgorithms.h')
-rw-r--r--Source/cmAlgorithms.h70
1 files changed, 35 insertions, 35 deletions
diff --git a/Source/cmAlgorithms.h b/Source/cmAlgorithms.h
index 5013e74..a4447ad 100644
--- a/Source/cmAlgorithms.h
+++ b/Source/cmAlgorithms.h
@@ -122,35 +122,6 @@ struct DefaultDeleter<Range, /* valueTypeIsPair = */ true>
}
};
-template<typename const_iterator_>
-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);
- return *this;
- }
-
- Range& retreat(cmIML_INT_intptr_t amount)
- {
- std::advance(End, -amount);
- return *this;
- }
-private:
- const_iterator Begin;
- const_iterator End;
-};
-
template<typename FwdIt>
FwdIt RemoveN(FwdIt i1, FwdIt i2, size_t n)
{
@@ -178,17 +149,46 @@ private:
}
+template<typename const_iterator_>
+struct cmRange
+{
+ 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;
+ cmRange(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); }
+ cmRange& advance(cmIML_INT_intptr_t amount)
+ {
+ std::advance(Begin, amount);
+ return *this;
+ }
+
+ cmRange& retreat(cmIML_INT_intptr_t amount)
+ {
+ std::advance(End, -amount);
+ return *this;
+ }
+private:
+ const_iterator Begin;
+ const_iterator End;
+};
+
template<typename Iter1, typename Iter2>
-ContainerAlgorithms::Range<Iter1> cmMakeRange(Iter1 begin, Iter2 end)
+cmRange<Iter1> cmMakeRange(Iter1 begin, Iter2 end)
{
- return ContainerAlgorithms::Range<Iter1>(begin, end);
+ return cmRange<Iter1>(begin, end);
}
template<typename Range>
-ContainerAlgorithms::Range<typename Range::const_iterator>
+cmRange<typename Range::const_iterator>
cmMakeRange(Range const& range)
{
- return ContainerAlgorithms::Range<typename Range::const_iterator>(
+ return cmRange<typename Range::const_iterator>(
range.begin(), range.end());
}
@@ -350,10 +350,10 @@ typename Range::const_iterator cmFindNot(Range const& r, T const& t)
}
template<typename Range>
-ContainerAlgorithms::Range<typename Range::const_reverse_iterator>
+cmRange<typename Range::const_reverse_iterator>
cmReverseRange(Range const& range)
{
- return ContainerAlgorithms::Range<typename Range::const_reverse_iterator>(
+ return cmRange<typename Range::const_reverse_iterator>(
range.rbegin(), range.rend());
}