Skip to content

Commit 6b03f53

Browse files
authored
Merge pull request swiftlang#6059 from gottesmm/remove_upstreamed_range_adaptors
2 parents 420f94c + 35edd13 commit 6b03f53

File tree

2 files changed

+3
-28
lines changed

2 files changed

+3
-28
lines changed

include/swift/Basic/Range.h

Lines changed: 1 addition & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
#include <utility>
3939
#include "llvm/ADT/iterator_range.h"
4040
#include "llvm/ADT/ArrayRef.h"
41+
#include "llvm/ADT/STLExtras.h"
4142

4243
namespace swift {
4344
using llvm::make_range;
@@ -268,33 +269,6 @@ template <class T> EnumeratorRange<T> enumerate(T Begin, T End) {
268269
return EnumeratorRange<T>(Begin, End);
269270
}
270271

271-
/// An adaptor of std::none_of for ranges.
272-
template <class Range, class Predicate>
273-
inline bool none_of(const Range &R, Predicate &&P) {
274-
return std::none_of(R.begin(), R.end(), std::forward<Predicate>(P));
275-
}
276-
277-
/// An adaptor of std::count for ranges.
278-
///
279-
/// We use std::result_of on Range::begin since llvm::iterator_range does not
280-
/// have a public typedef set to what is the underlying iterator.
281-
//typename std::iterator_traits<decltype(&Range::begin())>::difference_type
282-
template <class Range, class Value>
283-
inline auto count(const Range &R, Value V)
284-
-> typename std::iterator_traits<decltype(R.begin())>::difference_type {
285-
return std::count(R.begin(), R.end(), V);
286-
}
287-
288-
/// An adaptor of std::count_if for ranges.
289-
///
290-
/// We use std::result_of on Range::begin since llvm::iterator_range does not
291-
/// have a public typedef set to what is the underlying iterator.
292-
template <class Range, class Predicate>
293-
inline auto count_if(const Range &R, Predicate &&P)
294-
-> typename std::iterator_traits<decltype(R.begin())>::difference_type {
295-
return std::count_if(R.begin(), R.end(), std::forward<Predicate>(P));
296-
}
297-
298272
} // end namespace swift
299273

300274
#endif // SWIFT_BASIC_RANGE_H

unittests/Basic/BlotMapVectorTest.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
#include "llvm/ADT/Optional.h"
1818
#include "llvm/ADT/SmallString.h"
1919
#include "llvm/ADT/StringExtras.h"
20+
#include "llvm/ADT/STLExtras.h"
2021
#include "llvm/Support/raw_ostream.h"
2122
#include "gtest/gtest.h"
2223
#include <map>
@@ -254,7 +255,7 @@ bool CtorTesterSet::hasLiveTesters() const {
254255
}
255256

256257
bool CtorTesterSet::numLiveTesters() const {
257-
return count_if(Constructed, [](CtorTester *T) -> bool {
258+
return llvm::count_if(Constructed, [](CtorTester *T) -> bool {
258259
assert(T);
259260
return !T->isIgnorableTester();
260261
});

0 commit comments

Comments
 (0)