Skip to content

Commit 495917e

Browse files
authored
Merge pull request swiftlang#28291 from gottesmm/pr-bd9748e1a8090958d45317cc39774e603a709809
2 parents 8499a7f + d0219b6 commit 495917e

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

include/swift/Basic/STLExtras.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -638,6 +638,16 @@ inline T accumulate(const Container &C, T init, BinaryOperation op) {
638638
return std::accumulate(C.begin(), C.end(), init, op);
639639
}
640640

641+
template <typename Container, typename T>
642+
inline bool binary_search(const Container &C, T value) {
643+
return std::binary_search(C.begin(), C.end(), value);
644+
}
645+
646+
template <typename Container, typename T, typename BinaryOperation>
647+
inline bool binary_search(const Container &C, T value, BinaryOperation op) {
648+
return std::binary_search(C.begin(), C.end(), value, op);
649+
}
650+
641651
/// Returns true if the range defined by \p mainBegin ..< \p mainEnd starts with
642652
/// the same elements as the range defined by \p prefixBegin ..< \p prefixEnd.
643653
///

0 commit comments

Comments
 (0)