diff options
author | Stephen Kelly <steveire@gmail.com> | 2015-02-20 21:00:01 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2015-02-24 14:16:02 (GMT) |
commit | ba959934a6a832e7d0a9f4bfc433e09aad1476f3 (patch) | |
tree | 67642301b26fd5541498d92a934eaf3ea6bf8831 /Source/cmAlgorithms.h | |
parent | cae45df77235bf7314421f2520177f21179beb84 (diff) | |
download | CMake-ba959934a6a832e7d0a9f4bfc433e09aad1476f3.zip CMake-ba959934a6a832e7d0a9f4bfc433e09aad1476f3.tar.gz CMake-ba959934a6a832e7d0a9f4bfc433e09aad1476f3.tar.bz2 |
cmAlgorithms: Make cmRemoveDuplicates work with more containers.
Remove the accidental requirement that the input range must be a
std::vector.
Diffstat (limited to 'Source/cmAlgorithms.h')
-rw-r--r-- | Source/cmAlgorithms.h | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/Source/cmAlgorithms.h b/Source/cmAlgorithms.h index ca4c1fd..161a2cb 100644 --- a/Source/cmAlgorithms.h +++ b/Source/cmAlgorithms.h @@ -258,14 +258,15 @@ typename Range::const_iterator cmRemoveMatching(Range &r, MatchRange const& m) template<typename Range> typename Range::const_iterator cmRemoveDuplicates(Range& r) { - std::vector<typename Range::value_type> unique; + typedef std::vector<typename Range::value_type> UniqueVector; + UniqueVector unique; unique.reserve(r.size()); std::vector<size_t> indices; size_t count = 0; for(typename Range::const_iterator it = r.begin(); it != r.end(); ++it, ++count) { - const typename Range::iterator low = + const typename UniqueVector::iterator low = std::lower_bound(unique.begin(), unique.end(), *it); if (low == unique.end() || *low != *it) { |