aboutsummaryrefslogtreecommitdiff
path: root/libcxx/include/__algorithm/search.h
diff options
context:
space:
mode:
Diffstat (limited to 'libcxx/include/__algorithm/search.h')
-rw-r--r--libcxx/include/__algorithm/search.h17
1 files changed, 9 insertions, 8 deletions
diff --git a/libcxx/include/__algorithm/search.h b/libcxx/include/__algorithm/search.h
index 93771be39e35..5882a04808ba 100644
--- a/libcxx/include/__algorithm/search.h
+++ b/libcxx/include/__algorithm/search.h
@@ -14,12 +14,13 @@
#include <__algorithm/iterator_operations.h>
#include <__config>
#include <__functional/identity.h>
+#include <__functional/invoke.h>
#include <__iterator/advance.h>
#include <__iterator/concepts.h>
#include <__iterator/iterator_traits.h>
+#include <__type_traits/enable_if.h>
#include <__type_traits/is_callable.h>
#include <__utility/pair.h>
-#include <type_traits>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
@@ -126,8 +127,8 @@ pair<_Iter1, _Iter1> __search_impl(_Iter1 __first1, _Sent1 __last1,
_Pred& __pred,
_Proj1& __proj1,
_Proj2& __proj2,
- __enable_if_t<__is_cpp17_random_access_iterator<_Iter1>::value
- && __is_cpp17_random_access_iterator<_Iter2>::value>* = nullptr) {
+ __enable_if_t<__has_random_access_iterator_category<_Iter1>::value
+ && __has_random_access_iterator_category<_Iter2>::value>* = nullptr) {
auto __size2 = __last2 - __first2;
if (__size2 == 0)
@@ -158,10 +159,10 @@ pair<_Iter1, _Iter1> __search_impl(_Iter1 __first1, _Sent1 __last1,
_Pred& __pred,
_Proj1& __proj1,
_Proj2& __proj2,
- __enable_if_t<__is_cpp17_forward_iterator<_Iter1>::value
- && __is_cpp17_forward_iterator<_Iter2>::value
- && !(__is_cpp17_random_access_iterator<_Iter1>::value
- && __is_cpp17_random_access_iterator<_Iter2>::value)>* = nullptr) {
+ __enable_if_t<__has_forward_iterator_category<_Iter1>::value
+ && __has_forward_iterator_category<_Iter2>::value
+ && !(__has_random_access_iterator_category<_Iter1>::value
+ && __has_random_access_iterator_category<_Iter2>::value)>* = nullptr) {
return std::__search_forward_impl<_ClassicAlgPolicy>(__first1, __last1,
__first2, __last2,
__pred,
@@ -187,7 +188,7 @@ _ForwardIterator1 search(_ForwardIterator1 __first1, _ForwardIterator1 __last1,
return std::search(__first1, __last1, __first2, __last2, __equal_to());
}
-#if _LIBCPP_STD_VER > 14
+#if _LIBCPP_STD_VER >= 17
template <class _ForwardIterator, class _Searcher>
_LIBCPP_NODISCARD_EXT _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 _ForwardIterator
search(_ForwardIterator __f, _ForwardIterator __l, const _Searcher& __s) {