diff options
Diffstat (limited to 'Source/cmAlgorithms.h')
-rw-r--r-- | Source/cmAlgorithms.h | 60 |
1 files changed, 1 insertions, 59 deletions
diff --git a/Source/cmAlgorithms.h b/Source/cmAlgorithms.h index e0d27ee..19da2a0 100644 --- a/Source/cmAlgorithms.h +++ b/Source/cmAlgorithms.h @@ -8,6 +8,7 @@ #include <algorithm> #include <functional> #include <iterator> +#include <memory> #include <unordered_set> #include <utility> #include <vector> @@ -36,12 +37,6 @@ FwdIt cmRotate(FwdIt first, FwdIt middle, FwdIt last) return first; } -template <typename Container, typename Predicate> -void cmEraseIf(Container& cont, Predicate pred) -{ - cont.erase(std::remove_if(cont.begin(), cont.end(), pred), cont.end()); -} - template <typename Range, typename Key> auto cmContainsImpl(Range const& range, Key const& key, cmOverloadPriority<2>) -> decltype(range.exists(key)) @@ -72,40 +67,6 @@ bool cmContains(Range const& range, Key const& key) namespace ContainerAlgorithms { -template <typename T> -struct cmIsPair -{ - enum - { - value = false - }; -}; - -template <typename K, typename V> -struct cmIsPair<std::pair<K, V>> -{ - enum - { - value = true - }; -}; - -template <typename Range, - bool valueTypeIsPair = cmIsPair<typename Range::value_type>::value> -struct DefaultDeleter -{ - void operator()(typename Range::value_type value) const { delete value; } -}; - -template <typename Range> -struct DefaultDeleter<Range, /* valueTypeIsPair = */ true> -{ - void operator()(typename Range::value_type value) const - { - delete value.second; - } -}; - template <typename FwdIt> FwdIt RemoveN(FwdIt i1, FwdIt i2, size_t n) { @@ -138,25 +99,6 @@ using cmBacktraceRange = cmRange<std::vector<cmListFileBacktrace>::const_iterator>; template <typename Range> -void cmDeleteAll(Range const& r) -{ - std::for_each(r.begin(), r.end(), - ContainerAlgorithms::DefaultDeleter<Range>()); -} - -template <typename T, typename Range> -void cmAppend(std::vector<T>& v, Range const& r) -{ - v.insert(v.end(), r.begin(), r.end()); -} - -template <typename T, typename InputIt> -void cmAppend(std::vector<T>& v, InputIt first, InputIt last) -{ - v.insert(v.end(), first, last); -} - -template <typename Range> typename Range::const_iterator cmRemoveN(Range& r, size_t n) { return ContainerAlgorithms::RemoveN(r.begin(), r.end(), n); |