mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[gardening] Remove unneeded implementations of none_of/count_if/count.
These are now provided upstream by LLVM.
This commit is contained in:
@@ -38,6 +38,7 @@
|
||||
#include <utility>
|
||||
#include "llvm/ADT/iterator_range.h"
|
||||
#include "llvm/ADT/ArrayRef.h"
|
||||
#include "llvm/ADT/STLExtras.h"
|
||||
|
||||
namespace swift {
|
||||
using llvm::make_range;
|
||||
@@ -268,33 +269,6 @@ template <class T> EnumeratorRange<T> enumerate(T Begin, T End) {
|
||||
return EnumeratorRange<T>(Begin, End);
|
||||
}
|
||||
|
||||
/// An adaptor of std::none_of for ranges.
|
||||
template <class Range, class Predicate>
|
||||
inline bool none_of(const Range &R, Predicate &&P) {
|
||||
return std::none_of(R.begin(), R.end(), std::forward<Predicate>(P));
|
||||
}
|
||||
|
||||
/// An adaptor of std::count for ranges.
|
||||
///
|
||||
/// We use std::result_of on Range::begin since llvm::iterator_range does not
|
||||
/// have a public typedef set to what is the underlying iterator.
|
||||
//typename std::iterator_traits<decltype(&Range::begin())>::difference_type
|
||||
template <class Range, class Value>
|
||||
inline auto count(const Range &R, Value V)
|
||||
-> typename std::iterator_traits<decltype(R.begin())>::difference_type {
|
||||
return std::count(R.begin(), R.end(), V);
|
||||
}
|
||||
|
||||
/// An adaptor of std::count_if for ranges.
|
||||
///
|
||||
/// We use std::result_of on Range::begin since llvm::iterator_range does not
|
||||
/// have a public typedef set to what is the underlying iterator.
|
||||
template <class Range, class Predicate>
|
||||
inline auto count_if(const Range &R, Predicate &&P)
|
||||
-> typename std::iterator_traits<decltype(R.begin())>::difference_type {
|
||||
return std::count_if(R.begin(), R.end(), std::forward<Predicate>(P));
|
||||
}
|
||||
|
||||
} // end namespace swift
|
||||
|
||||
#endif // SWIFT_BASIC_RANGE_H
|
||||
|
||||
Reference in New Issue
Block a user