diff options
Diffstat (limited to 'Source/cmAlgorithms.h')
-rw-r--r-- | Source/cmAlgorithms.h | 42 |
1 files changed, 3 insertions, 39 deletions
diff --git a/Source/cmAlgorithms.h b/Source/cmAlgorithms.h index c0ac551..8b0aa5e 100644 --- a/Source/cmAlgorithms.h +++ b/Source/cmAlgorithms.h @@ -13,20 +13,12 @@ #include <utility> #include <vector> +#include <cmext/algorithm> + #include "cm_kwiml.h" #include "cmRange.h" -template <std::size_t N> -struct cmOverloadPriority : cmOverloadPriority<N - 1> -{ -}; - -template <> -struct cmOverloadPriority<0> -{ -}; - template <typename FwdIt> FwdIt cmRotate(FwdIt first, FwdIt middle, FwdIt last) { @@ -37,34 +29,6 @@ FwdIt cmRotate(FwdIt first, FwdIt middle, FwdIt last) return first; } -template <typename Range, typename Key> -auto cmContainsImpl(Range const& range, Key const& key, cmOverloadPriority<2>) - -> decltype(range.exists(key)) -{ - return range.exists(key); -} - -template <typename Range, typename Key> -auto cmContainsImpl(Range const& range, Key const& key, cmOverloadPriority<1>) - -> decltype(range.find(key) != range.end()) -{ - return range.find(key) != range.end(); -} - -template <typename Range, typename Key> -bool cmContainsImpl(Range const& range, Key const& key, cmOverloadPriority<0>) -{ - using std::begin; - using std::end; - return std::find(begin(range), end(range), key) != end(range); -} - -template <typename Range, typename Key> -bool cmContains(Range const& range, Key const& key) -{ - return cmContainsImpl(range, key, cmOverloadPriority<2>{}); -} - namespace ContainerAlgorithms { template <typename FwdIt> @@ -158,7 +122,7 @@ ForwardIterator cmRemoveDuplicates(ForwardIterator first, ForwardIterator last) ForwardIterator result = first; while (first != last) { - if (!cmContains(uniq, first)) { + if (!cm::contains(uniq, first)) { if (result != first) { *result = std::move(*first); } |