aboutsummaryrefslogtreecommitdiff
path: root/libcxx/include/__functional
diff options
context:
space:
mode:
Diffstat (limited to 'libcxx/include/__functional')
-rw-r--r--libcxx/include/__functional/binary_function.h27
-rw-r--r--libcxx/include/__functional/binary_negate.h8
-rw-r--r--libcxx/include/__functional/bind.h15
-rw-r--r--libcxx/include/__functional/bind_back.h13
-rw-r--r--libcxx/include/__functional/bind_front.h4
-rw-r--r--libcxx/include/__functional/binder1st.h5
-rw-r--r--libcxx/include/__functional/binder2nd.h5
-rw-r--r--libcxx/include/__functional/boyer_moore_searcher.h313
-rw-r--r--libcxx/include/__functional/compose.h2
-rw-r--r--libcxx/include/__functional/default_searcher.h4
-rw-r--r--libcxx/include/__functional/function.h21
-rw-r--r--libcxx/include/__functional/hash.h231
-rw-r--r--libcxx/include/__functional/identity.h13
-rw-r--r--libcxx/include/__functional/invoke.h541
-rw-r--r--libcxx/include/__functional/is_transparent.h2
-rw-r--r--libcxx/include/__functional/mem_fn.h114
-rw-r--r--libcxx/include/__functional/mem_fun_ref.h18
-rw-r--r--libcxx/include/__functional/not_fn.h5
-rw-r--r--libcxx/include/__functional/operations.h208
-rw-r--r--libcxx/include/__functional/perfect_forward.h85
-rw-r--r--libcxx/include/__functional/pointer_to_binary_function.h4
-rw-r--r--libcxx/include/__functional/pointer_to_unary_function.h4
-rw-r--r--libcxx/include/__functional/ranges_operations.h10
-rw-r--r--libcxx/include/__functional/reference_wrapper.h116
-rw-r--r--libcxx/include/__functional/unary_function.h26
-rw-r--r--libcxx/include/__functional/unary_negate.h4
-rw-r--r--libcxx/include/__functional/unwrap_ref.h2
-rw-r--r--libcxx/include/__functional/weak_result_type.h304
28 files changed, 1082 insertions, 1022 deletions
diff --git a/libcxx/include/__functional/binary_function.h b/libcxx/include/__functional/binary_function.h
index 8ca7b06662ae..fdedb8b177da 100644
--- a/libcxx/include/__functional/binary_function.h
+++ b/libcxx/include/__functional/binary_function.h
@@ -13,19 +13,42 @@
#include <__config>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-#pragma GCC system_header
+# pragma GCC system_header
#endif
_LIBCPP_BEGIN_NAMESPACE_STD
+#if _LIBCPP_STD_VER <= 14 || defined(_LIBCPP_ENABLE_CXX17_REMOVED_UNARY_BINARY_FUNCTION)
+
template <class _Arg1, class _Arg2, class _Result>
-struct _LIBCPP_TEMPLATE_VIS binary_function
+struct _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX11 binary_function
{
typedef _Arg1 first_argument_type;
typedef _Arg2 second_argument_type;
typedef _Result result_type;
};
+#endif // _LIBCPP_STD_VER <= 14 || defined(_LIBCPP_ENABLE_CXX17_REMOVED_UNARY_BINARY_FUNCTION)
+
+template <class _Arg1, class _Arg2, class _Result> struct __binary_function_keep_layout_base {
+#if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_BINDER_TYPEDEFS)
+ using first_argument_type _LIBCPP_DEPRECATED_IN_CXX17 = _Arg1;
+ using second_argument_type _LIBCPP_DEPRECATED_IN_CXX17 = _Arg2;
+ using result_type _LIBCPP_DEPRECATED_IN_CXX17 = _Result;
+#endif
+};
+
+#if _LIBCPP_STD_VER <= 14 || defined(_LIBCPP_ENABLE_CXX17_REMOVED_UNARY_BINARY_FUNCTION)
+_LIBCPP_DIAGNOSTIC_PUSH
+_LIBCPP_CLANG_DIAGNOSTIC_IGNORED("-Wdeprecated-declarations")
+template <class _Arg1, class _Arg2, class _Result>
+using __binary_function = binary_function<_Arg1, _Arg2, _Result>;
+_LIBCPP_DIAGNOSTIC_POP
+#else
+template <class _Arg1, class _Arg2, class _Result>
+using __binary_function = __binary_function_keep_layout_base<_Arg1, _Arg2, _Result>;
+#endif
+
_LIBCPP_END_NAMESPACE_STD
#endif // _LIBCPP___FUNCTIONAL_BINARY_FUNCTION_H
diff --git a/libcxx/include/__functional/binary_negate.h b/libcxx/include/__functional/binary_negate.h
index 4fc3f1ba2875..c4977f4ebe12 100644
--- a/libcxx/include/__functional/binary_negate.h
+++ b/libcxx/include/__functional/binary_negate.h
@@ -14,7 +14,7 @@
#include <__functional/binary_function.h>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-#pragma GCC system_header
+# pragma GCC system_header
#endif
_LIBCPP_BEGIN_NAMESPACE_STD
@@ -23,9 +23,9 @@ _LIBCPP_BEGIN_NAMESPACE_STD
template <class _Predicate>
class _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX17 binary_negate
- : public binary_function<typename _Predicate::first_argument_type,
- typename _Predicate::second_argument_type,
- bool>
+ : public __binary_function<typename _Predicate::first_argument_type,
+ typename _Predicate::second_argument_type,
+ bool>
{
_Predicate __pred_;
public:
diff --git a/libcxx/include/__functional/bind.h b/libcxx/include/__functional/bind.h
index 11a51e5957ee..d1cbbb3d916e 100644
--- a/libcxx/include/__functional/bind.h
+++ b/libcxx/include/__functional/bind.h
@@ -18,16 +18,16 @@
#include <type_traits>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-#pragma GCC system_header
+# pragma GCC system_header
#endif
_LIBCPP_BEGIN_NAMESPACE_STD
template<class _Tp>
struct is_bind_expression : _If<
- _IsSame<_Tp, typename __uncvref<_Tp>::type>::value,
+ _IsSame<_Tp, __uncvref_t<_Tp> >::value,
false_type,
- is_bind_expression<typename __uncvref<_Tp>::type>
+ is_bind_expression<__uncvref_t<_Tp> >
> {};
#if _LIBCPP_STD_VER > 14
@@ -37,9 +37,9 @@ inline constexpr size_t is_bind_expression_v = is_bind_expression<_Tp>::value;
template<class _Tp>
struct is_placeholder : _If<
- _IsSame<_Tp, typename __uncvref<_Tp>::type>::value,
+ _IsSame<_Tp, __uncvref_t<_Tp> >::value,
integral_constant<int, 0>,
- is_placeholder<typename __uncvref<_Tp>::type>
+ is_placeholder<__uncvref_t<_Tp> >
> {};
#if _LIBCPP_STD_VER > 14
@@ -264,10 +264,7 @@ __apply_functor(_Fp& __f, _BoundArgs& __bound_args, __tuple_indices<_Indx...>,
}
template<class _Fp, class ..._BoundArgs>
-class __bind
-#if _LIBCPP_STD_VER <= 17 || !defined(_LIBCPP_ABI_NO_BINDER_BASES)
- : public __weak_result_type<typename decay<_Fp>::type>
-#endif
+class __bind : public __weak_result_type<typename decay<_Fp>::type>
{
protected:
typedef typename decay<_Fp>::type _Fd;
diff --git a/libcxx/include/__functional/bind_back.h b/libcxx/include/__functional/bind_back.h
index a0089e1fb090..f0a6e49875a3 100644
--- a/libcxx/include/__functional/bind_back.h
+++ b/libcxx/include/__functional/bind_back.h
@@ -19,7 +19,7 @@
#include <type_traits>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-#pragma GCC system_header
+# pragma GCC system_header
#endif
_LIBCPP_BEGIN_NAMESPACE_STD
@@ -31,12 +31,11 @@ struct __bind_back_op;
template <size_t _NBound, size_t ..._Ip>
struct __bind_back_op<_NBound, index_sequence<_Ip...>> {
- template <class _Fn, class _Bound, class ..._Args>
- _LIBCPP_HIDE_FROM_ABI
- constexpr auto operator()(_Fn&& __f, _Bound&& __bound, _Args&& ...__args) const
- noexcept(noexcept(_VSTD::invoke(_VSTD::forward<_Fn>(__f), _VSTD::forward<_Args>(__args)..., _VSTD::get<_Ip>(_VSTD::forward<_Bound>(__bound))...)))
- -> decltype( _VSTD::invoke(_VSTD::forward<_Fn>(__f), _VSTD::forward<_Args>(__args)..., _VSTD::get<_Ip>(_VSTD::forward<_Bound>(__bound))...))
- { return _VSTD::invoke(_VSTD::forward<_Fn>(__f), _VSTD::forward<_Args>(__args)..., _VSTD::get<_Ip>(_VSTD::forward<_Bound>(__bound))...); }
+ template <class _Fn, class _BoundArgs, class... _Args>
+ _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Fn&& __f, _BoundArgs&& __bound_args, _Args&&... __args) const
+ noexcept(noexcept(_VSTD::invoke(_VSTD::forward<_Fn>(__f), _VSTD::forward<_Args>(__args)..., _VSTD::get<_Ip>(_VSTD::forward<_BoundArgs>(__bound_args))...)))
+ -> decltype( _VSTD::invoke(_VSTD::forward<_Fn>(__f), _VSTD::forward<_Args>(__args)..., _VSTD::get<_Ip>(_VSTD::forward<_BoundArgs>(__bound_args))...))
+ { return _VSTD::invoke(_VSTD::forward<_Fn>(__f), _VSTD::forward<_Args>(__args)..., _VSTD::get<_Ip>(_VSTD::forward<_BoundArgs>(__bound_args))...); }
};
template <class _Fn, class _BoundArgs>
diff --git a/libcxx/include/__functional/bind_front.h b/libcxx/include/__functional/bind_front.h
index 31397ec5400d..22fb3a69dc75 100644
--- a/libcxx/include/__functional/bind_front.h
+++ b/libcxx/include/__functional/bind_front.h
@@ -13,11 +13,11 @@
#include <__config>
#include <__functional/invoke.h>
#include <__functional/perfect_forward.h>
+#include <__utility/forward.h>
#include <type_traits>
-#include <utility>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-#pragma GCC system_header
+# pragma GCC system_header
#endif
_LIBCPP_BEGIN_NAMESPACE_STD
diff --git a/libcxx/include/__functional/binder1st.h b/libcxx/include/__functional/binder1st.h
index 5dd8f5cf0155..dea22c70e1f2 100644
--- a/libcxx/include/__functional/binder1st.h
+++ b/libcxx/include/__functional/binder1st.h
@@ -14,7 +14,7 @@
#include <__functional/unary_function.h>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-#pragma GCC system_header
+# pragma GCC system_header
#endif
_LIBCPP_BEGIN_NAMESPACE_STD
@@ -23,8 +23,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD
template <class __Operation>
class _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX11 binder1st
- : public unary_function<typename __Operation::second_argument_type,
- typename __Operation::result_type>
+ : public __unary_function<typename __Operation::second_argument_type, typename __Operation::result_type>
{
protected:
__Operation op;
diff --git a/libcxx/include/__functional/binder2nd.h b/libcxx/include/__functional/binder2nd.h
index 3ed5f5bf4540..c98a146b6a66 100644
--- a/libcxx/include/__functional/binder2nd.h
+++ b/libcxx/include/__functional/binder2nd.h
@@ -14,7 +14,7 @@
#include <__functional/unary_function.h>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-#pragma GCC system_header
+# pragma GCC system_header
#endif
_LIBCPP_BEGIN_NAMESPACE_STD
@@ -23,8 +23,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD
template <class __Operation>
class _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX11 binder2nd
- : public unary_function<typename __Operation::first_argument_type,
- typename __Operation::result_type>
+ : public __unary_function<typename __Operation::first_argument_type, typename __Operation::result_type>
{
protected:
__Operation op;
diff --git a/libcxx/include/__functional/boyer_moore_searcher.h b/libcxx/include/__functional/boyer_moore_searcher.h
new file mode 100644
index 000000000000..20e554408ff0
--- /dev/null
+++ b/libcxx/include/__functional/boyer_moore_searcher.h
@@ -0,0 +1,313 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef _LIBCPP___FUNCTIONAL_BOYER_MOORE_SEARCHER_H
+#define _LIBCPP___FUNCTIONAL_BOYER_MOORE_SEARCHER_H
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+# pragma GCC system_header
+#endif
+
+#include <__algorithm/fill_n.h>
+#include <__config>
+#include <__functional/hash.h>
+#include <__functional/operations.h>
+#include <__iterator/distance.h>
+#include <__iterator/iterator_traits.h>
+#include <__memory/shared_ptr.h>
+#include <__utility/pair.h>
+#include <array>
+#include <unordered_map>
+#include <vector>
+
+#if _LIBCPP_STD_VER > 14
+
+_LIBCPP_PUSH_MACROS
+#include <__undef_macros>
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+template <class _Key,
+ class _Value,
+ class _Hash,
+ class _BinaryPredicate,
+ bool /*useArray*/>
+class _BMSkipTable;
+
+// General case for BM data searching; use a map
+template <class _Key,
+ class _Value,
+ class _Hash,
+ class _BinaryPredicate>
+class _BMSkipTable<_Key, _Value, _Hash, _BinaryPredicate, false> {
+private:
+ using value_type = _Value;
+ using key_type = _Key;
+
+ const value_type __default_value_;
+ unordered_map<_Key, _Value, _Hash, _BinaryPredicate> __table_;
+
+public:
+ _LIBCPP_HIDE_FROM_ABI
+ explicit _BMSkipTable(size_t __sz, value_type __default_value, _Hash __hash, _BinaryPredicate __pred)
+ : __default_value_(__default_value),
+ __table_(__sz, __hash, __pred) {}
+
+ _LIBCPP_HIDE_FROM_ABI void insert(const key_type& __key, value_type __val) {
+ __table_[__key] = __val;
+ }
+
+ _LIBCPP_HIDE_FROM_ABI value_type operator[](const key_type& __key) const {
+ auto __it = __table_.find(__key);
+ return __it == __table_.end() ? __default_value_ : __it->second;
+ }
+};
+
+// Special case small numeric values; use an array
+template <class _Key,
+ class _Value,
+ class _Hash,
+ class _BinaryPredicate>
+class _BMSkipTable<_Key, _Value, _Hash, _BinaryPredicate, true> {
+private:
+ using value_type = _Value;
+ using key_type = _Key;
+
+ using unsigned_key_type = make_unsigned_t<key_type>;
+ std::array<value_type, 256> __table_;
+ static_assert(numeric_limits<unsigned_key_type>::max() < 256);
+
+public:
+ _LIBCPP_HIDE_FROM_ABI explicit _BMSkipTable(size_t, value_type __default_value, _Hash, _BinaryPredicate) {
+ std::fill_n(__table_.data(), __table_.size(), __default_value);
+ }
+
+ _LIBCPP_HIDE_FROM_ABI void insert(key_type __key, value_type __val) {
+ __table_[static_cast<unsigned_key_type>(__key)] = __val;
+ }
+
+ _LIBCPP_HIDE_FROM_ABI value_type operator[](key_type __key) const {
+ return __table_[static_cast<unsigned_key_type>(__key)];
+ }
+};
+
+template <class _RandomAccessIterator1,
+ class _Hash = hash<typename iterator_traits<_RandomAccessIterator1>::value_type>,
+ class _BinaryPredicate = equal_to<>>
+class _LIBCPP_TEMPLATE_VIS boyer_moore_searcher {
+private:
+ using difference_type = typename std::iterator_traits<_RandomAccessIterator1>::difference_type;
+ using value_type = typename std::iterator_traits<_RandomAccessIterator1>::value_type;
+ using __skip_table_type = _BMSkipTable<value_type,
+ difference_type,
+ _Hash,
+ _BinaryPredicate,
+ is_integral_v<value_type>
+ && sizeof(value_type) == 1
+ && is_same_v<_Hash, hash<value_type>>
+ && is_same_v<_BinaryPredicate, equal_to<>>>;
+
+public:
+ boyer_moore_searcher(_RandomAccessIterator1 __first,
+ _RandomAccessIterator1 __last,
+ _Hash __hash = _Hash(),
+ _BinaryPredicate __pred = _BinaryPredicate())
+ : __first_(__first),
+ __last_(__last),
+ __pred_(__pred),
+ __pattern_length_(__last - __first),
+ __skip_table_(std::make_shared<__skip_table_type>(__pattern_length_, -1, __hash, __pred_)),
+ __suffix_(std::__allocate_shared_unbounded_array<difference_type[]>(
+ allocator<difference_type>(), __pattern_length_ + 1)) {
+ difference_type __i = 0;
+ while (__first != __last) {
+ __skip_table_->insert(*__first, __i);
+ ++__first;
+ ++__i;
+ }
+ __build_suffix_table(__first_, __last_, __pred_);
+ }
+
+ template <class _RandomAccessIterator2>
+ pair<_RandomAccessIterator2, _RandomAccessIterator2>
+ operator()(_RandomAccessIterator2 __first, _RandomAccessIterator2 __last) const {
+ static_assert(__is_same_uncvref<typename iterator_traits<_RandomAccessIterator1>::value_type,
+ typename iterator_traits<_RandomAccessIterator2>::value_type>::value,
+ "Corpus and Pattern iterators must point to the same type");
+ if (__first == __last)
+ return std::make_pair(__last, __last);
+ if (__first_ == __last_)
+ return std::make_pair(__first, __first);
+
+ if (__pattern_length_ > (__last - __first))
+ return std::make_pair(__last, __last);
+ return __search(__first, __last);
+ }
+
+private:
+ _RandomAccessIterator1 __first_;
+ _RandomAccessIterator1 __last_;
+ _BinaryPredicate __pred_;
+ difference_type __pattern_length_;
+ shared_ptr<__skip_table_type> __skip_table_;
+ shared_ptr<difference_type[]> __suffix_;
+
+ template <class _RandomAccessIterator2>
+ pair<_RandomAccessIterator2, _RandomAccessIterator2>
+ __search(_RandomAccessIterator2 __f, _RandomAccessIterator2 __l) const {
+ _RandomAccessIterator2 __current = __f;
+ const _RandomAccessIterator2 __last = __l - __pattern_length_;
+ const __skip_table_type& __skip_table = *__skip_table_;
+
+ while (__current <= __last) {
+ difference_type __j = __pattern_length_;
+ while (__pred_(__first_[__j - 1], __current[__j - 1])) {
+ --__j;
+ if (__j == 0)
+ return std::make_pair(__current, __current + __pattern_length_);
+ }
+
+ difference_type __k = __skip_table[__current[__j - 1]];
+ difference_type __m = __j - __k - 1;
+ if (__k < __j && __m > __suffix_[__j])
+ __current += __m;
+ else
+ __current += __suffix_[__j];
+ }
+ return std::make_pair(__l, __l);
+ }
+
+ template <class _Iterator, class _Container>
+ void __compute_bm_prefix(_Iterator __first, _Iterator __last, _BinaryPredicate __pred, _Container& __prefix) {
+ const size_t __count = __last - __first;
+
+ __prefix[0] = 0;
+ size_t __k = 0;
+
+ for (size_t __i = 1; __i != __count; ++__i) {
+ while (__k > 0 && !__pred(__first[__k], __first[__i]))
+ __k = __prefix[__k - 1];
+
+ if (__pred(__first[__k], __first[__i]))
+ ++__k;
+ __prefix[__i] = __k;
+ }
+ }
+
+ void __build_suffix_table(_RandomAccessIterator1 __first, _RandomAccessIterator1 __last, _BinaryPredicate __pred) {
+ const size_t __count = __last - __first;
+
+ if (__count == 0)
+ return;
+
+ vector<difference_type> __scratch(__count);
+
+ __compute_bm_prefix(__first, __last, __pred, __scratch);
+ for (size_t __i = 0; __i <= __count; ++__i)
+ __suffix_[__i] = __count - __scratch[__count - 1];
+
+ using _ReverseIter = reverse_iterator<_RandomAccessIterator1>;
+ __compute_bm_prefix(_ReverseIter(__last), _ReverseIter(__first), __pred, __scratch);
+
+ for (size_t __i = 0; __i != __count; ++__i) {
+ const size_t __j = __count - __scratch[__i];
+ const difference_type __k = __i - __scratch[__i] + 1;
+
+ if (__suffix_[__j] > __k)
+ __suffix_[__j] = __k;
+ }
+ }
+};
+
+template <class _RandomAccessIterator1,
+ class _Hash = hash<typename iterator_traits<_RandomAccessIterator1>::value_type>,
+ class _BinaryPredicate = equal_to<>>
+class _LIBCPP_TEMPLATE_VIS boyer_moore_horspool_searcher {
+private:
+ using difference_type = typename iterator_traits<_RandomAccessIterator1>::difference_type;
+ using value_type = typename iterator_traits<_RandomAccessIterator1>::value_type;
+ using __skip_table_type = _BMSkipTable<value_type,
+ difference_type,
+ _Hash,
+ _BinaryPredicate,
+ is_integral_v<value_type>
+ && sizeof(value_type) == 1
+ && is_same_v<_Hash, hash<value_type>>
+ && is_same_v<_BinaryPredicate, equal_to<>>>;
+public:
+ boyer_moore_horspool_searcher(_RandomAccessIterator1 __first,
+ _RandomAccessIterator1 __last,
+ _Hash __hash = _Hash(),
+ _BinaryPredicate __pred = _BinaryPredicate())
+ : __first_(__first),
+ __last_(__last),
+ __pred_(__pred),
+ __pattern_length_(__last - __first),
+ __skip_table_(std::make_shared<__skip_table_type>(__pattern_length_, __pattern_length_, __hash, __pred_)) {
+ if (__first == __last)
+ return;
+ --__last;
+ difference_type __i = 0;
+ while (__first != __last) {
+ __skip_table_->insert(*__first, __pattern_length_ - 1 - __i);
+ ++__first;
+ ++__i;
+ }
+ }
+
+ template <class _RandomAccessIterator2>
+ pair<_RandomAccessIterator2, _RandomAccessIterator2>
+ operator()(_RandomAccessIterator2 __first, _RandomAccessIterator2 __last) const {
+ static_assert(__is_same_uncvref<typename std::iterator_traits<_RandomAccessIterator1>::value_type,
+ typename std::iterator_traits<_RandomAccessIterator2>::value_type>::value,
+ "Corpus and Pattern iterators must point to the same type");
+ if (__first == __last)
+ return std::make_pair(__last, __last);
+ if (__first_ == __last_)
+ return std::make_pair(__first, __first);
+
+ if (__pattern_length_ > __last - __first)
+ return std::make_pair(__last, __last);
+
+ return __search(__first, __last);
+ }
+
+private:
+ _RandomAccessIterator1 __first_;
+ _RandomAccessIterator1 __last_;
+ _BinaryPredicate __pred_;
+ difference_type __pattern_length_;
+ shared_ptr<__skip_table_type> __skip_table_;
+
+ template <class _RandomAccessIterator2>
+ pair<_RandomAccessIterator2, _RandomAccessIterator2>
+ __search(_RandomAccessIterator2 __f, _RandomAccessIterator2 __l) const {
+ _RandomAccessIterator2 __current = __f;
+ const _RandomAccessIterator2 __last = __l - __pattern_length_;
+ const __skip_table_type& __skip_table = *__skip_table_;
+
+ while (__current <= __last) {
+ difference_type __j = __pattern_length_;
+ while (__pred_(__first_[__j - 1], __current[__j - 1])) {
+ --__j;
+ if (__j == 0)
+ return std::make_pair(__current, __current + __pattern_length_);
+ }
+ __current += __skip_table[__current[__pattern_length_ - 1]];
+ }
+ return std::make_pair(__l, __l);
+ }
+};
+
+_LIBCPP_END_NAMESPACE_STD
+
+_LIBCPP_POP_MACROS
+
+#endif // _LIBCPP_STD_VER > 14
+
+#endif // _LIBCPP___FUNCTIONAL_BOYER_MOORE_SEARCHER_H
diff --git a/libcxx/include/__functional/compose.h b/libcxx/include/__functional/compose.h
index d9d75875c2a5..25213f28b1f2 100644
--- a/libcxx/include/__functional/compose.h
+++ b/libcxx/include/__functional/compose.h
@@ -17,7 +17,7 @@
#include <type_traits>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-#pragma GCC system_header
+# pragma GCC system_header
#endif
_LIBCPP_BEGIN_NAMESPACE_STD
diff --git a/libcxx/include/__functional/default_searcher.h b/libcxx/include/__functional/default_searcher.h
index 1acbc1883afc..05fb23d7c3c4 100644
--- a/libcxx/include/__functional/default_searcher.h
+++ b/libcxx/include/__functional/default_searcher.h
@@ -14,10 +14,10 @@
#include <__config>
#include <__functional/operations.h>
#include <__iterator/iterator_traits.h>
-#include <utility>
+#include <__utility/pair.h>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-#pragma GCC system_header
+# pragma GCC system_header
#endif
_LIBCPP_BEGIN_NAMESPACE_STD
diff --git a/libcxx/include/__functional/function.h b/libcxx/include/__functional/function.h
index 6bb7eb7e8a24..312443b67c3b 100644
--- a/libcxx/include/__functional/function.h
+++ b/libcxx/include/__functional/function.h
@@ -10,8 +10,8 @@
#ifndef _LIBCPP___FUNCTIONAL_FUNCTION_H
#define _LIBCPP___FUNCTIONAL_FUNCTION_H
+#include <__assert>
#include <__config>
-#include <__debug>
#include <__functional/binary_function.h>
#include <__functional/invoke.h>
#include <__functional/unary_function.h>
@@ -20,19 +20,23 @@
#include <__memory/allocator_traits.h>
#include <__memory/compressed_pair.h>
#include <__memory/shared_ptr.h>
+#include <__utility/forward.h>
+#include <__utility/move.h>
+#include <__utility/swap.h>
#include <exception>
#include <memory> // TODO: replace with <__memory/__builtin_new_allocator.h>
#include <type_traits>
-#include <utility>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-#pragma GCC system_header
+# pragma GCC system_header
#endif
_LIBCPP_BEGIN_NAMESPACE_STD
// bad_function_call
+_LIBCPP_DIAGNOSTIC_PUSH
+_LIBCPP_CLANG_DIAGNOSTIC_IGNORED("-Wweak-vtables")
class _LIBCPP_EXCEPTION_ABI bad_function_call
: public exception
{
@@ -50,6 +54,7 @@ public:
virtual const char* what() const _NOEXCEPT;
#endif
};
+_LIBCPP_DIAGNOSTIC_POP
_LIBCPP_NORETURN inline _LIBCPP_INLINE_VISIBILITY
void __throw_bad_function_call()
@@ -80,7 +85,7 @@ struct __maybe_derive_from_unary_function
template<class _Rp, class _A1>
struct __maybe_derive_from_unary_function<_Rp(_A1)>
- : public unary_function<_A1, _Rp>
+ : public __unary_function<_A1, _Rp>
{
};
@@ -91,7 +96,7 @@ struct __maybe_derive_from_binary_function
template<class _Rp, class _A1, class _A2>
struct __maybe_derive_from_binary_function<_Rp(_A1, _A2)>
- : public binary_function<_A1, _A2, _Rp>
+ : public __binary_function<_A1, _A2, _Rp>
{
};
@@ -951,10 +956,8 @@ public:
template<class _Rp, class ..._ArgTypes>
class _LIBCPP_TEMPLATE_VIS function<_Rp(_ArgTypes...)>
-#if _LIBCPP_STD_VER <= 17 || !defined(_LIBCPP_ABI_NO_BINDER_BASES)
: public __function::__maybe_derive_from_unary_function<_Rp(_ArgTypes...)>,
public __function::__maybe_derive_from_binary_function<_Rp(_ArgTypes...)>
-#endif
{
#ifndef _LIBCPP_ABI_OPTIMIZED_FUNCTION
typedef __function::__value_func<_Rp(_ArgTypes...)> __func;
@@ -1237,7 +1240,7 @@ void
swap(function<_Rp(_ArgTypes...)>& __x, function<_Rp(_ArgTypes...)>& __y) _NOEXCEPT
{return __x.swap(__y);}
-#else // _LIBCPP_CXX03_LANG
+#elif defined(_LIBCPP_ENABLE_CXX03_FUNCTION)
namespace __function {
@@ -2803,7 +2806,7 @@ void
swap(function<_Fp>& __x, function<_Fp>& __y)
{return __x.swap(__y);}
-#endif
+#endif // _LIBCPP_CXX03_LANG
_LIBCPP_END_NAMESPACE_STD
diff --git a/libcxx/include/__functional/hash.h b/libcxx/include/__functional/hash.h
index de0c161f47ec..8a11931288cf 100644
--- a/libcxx/include/__functional/hash.h
+++ b/libcxx/include/__functional/hash.h
@@ -23,7 +23,7 @@
#include <type_traits>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-#pragma GCC system_header
+# pragma GCC system_header
#endif
_LIBCPP_BEGIN_NAMESPACE_STD
@@ -265,18 +265,10 @@ __murmur2_or_cityhash<_Size, 64>::operator()(const void* __key, _Size __len)
template <class _Tp, size_t = sizeof(_Tp) / sizeof(size_t)>
struct __scalar_hash;
-_LIBCPP_SUPPRESS_DEPRECATED_PUSH
template <class _Tp>
struct __scalar_hash<_Tp, 0>
-#if !defined(_LIBCPP_ABI_NO_BINDER_BASES)
- : public unary_function<_Tp, size_t>
-#endif
+ : public __unary_function<_Tp, size_t>
{
-_LIBCPP_SUPPRESS_DEPRECATED_POP
-#if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_BINDER_TYPEDEFS)
- _LIBCPP_DEPRECATED_IN_CXX17 typedef size_t result_type;
- _LIBCPP_DEPRECATED_IN_CXX17 typedef _Tp argument_type;
-#endif
_LIBCPP_INLINE_VISIBILITY
size_t operator()(_Tp __v) const _NOEXCEPT
{
@@ -291,18 +283,10 @@ _LIBCPP_SUPPRESS_DEPRECATED_POP
}
};
-_LIBCPP_SUPPRESS_DEPRECATED_PUSH
template <class _Tp>
struct __scalar_hash<_Tp, 1>
-#if !defined(_LIBCPP_ABI_NO_BINDER_BASES)
- : public unary_function<_Tp, size_t>
-#endif
+ : public __unary_function<_Tp, size_t>
{
-_LIBCPP_SUPPRESS_DEPRECATED_POP
-#if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_BINDER_TYPEDEFS)
- _LIBCPP_DEPRECATED_IN_CXX17 typedef size_t result_type;
- _LIBCPP_DEPRECATED_IN_CXX17 typedef _Tp argument_type;
-#endif
_LIBCPP_INLINE_VISIBILITY
size_t operator()(_Tp __v) const _NOEXCEPT
{
@@ -316,18 +300,10 @@ _LIBCPP_SUPPRESS_DEPRECATED_POP
}
};
-_LIBCPP_SUPPRESS_DEPRECATED_PUSH
template <class _Tp>
struct __scalar_hash<_Tp, 2>
-#if !defined(_LIBCPP_ABI_NO_BINDER_BASES)
- : public unary_function<_Tp, size_t>
-#endif
+ : public __unary_function<_Tp, size_t>
{
-_LIBCPP_SUPPRESS_DEPRECATED_POP
-#if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_BINDER_TYPEDEFS)
- _LIBCPP_DEPRECATED_IN_CXX17 typedef size_t result_type;
- _LIBCPP_DEPRECATED_IN_CXX17 typedef _Tp argument_type;
-#endif
_LIBCPP_INLINE_VISIBILITY
size_t operator()(_Tp __v) const _NOEXCEPT
{
@@ -345,18 +321,10 @@ _LIBCPP_SUPPRESS_DEPRECATED_POP
}
};
-_LIBCPP_SUPPRESS_DEPRECATED_PUSH
template <class _Tp>
struct __scalar_hash<_Tp, 3>
-#if !defined(_LIBCPP_ABI_NO_BINDER_BASES)
- : public unary_function<_Tp, size_t>
-#endif
+ : public __unary_function<_Tp, size_t>
{
-_LIBCPP_SUPPRESS_DEPRECATED_POP
-#if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_BINDER_TYPEDEFS)
- _LIBCPP_DEPRECATED_IN_CXX17 typedef size_t result_type;
- _LIBCPP_DEPRECATED_IN_CXX17 typedef _Tp argument_type;
-#endif
_LIBCPP_INLINE_VISIBILITY
size_t operator()(_Tp __v) const _NOEXCEPT
{
@@ -375,18 +343,10 @@ _LIBCPP_SUPPRESS_DEPRECATED_POP
}
};
-_LIBCPP_SUPPRESS_DEPRECATED_PUSH
template <class _Tp>
struct __scalar_hash<_Tp, 4>
-#if !defined(_LIBCPP_ABI_NO_BINDER_BASES)
- : public unary_function<_Tp, size_t>
-#endif
+ : public __unary_function<_Tp, size_t>
{
-_LIBCPP_SUPPRESS_DEPRECATED_POP
-#if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_BINDER_TYPEDEFS)
- _LIBCPP_DEPRECATED_IN_CXX17 typedef size_t result_type;
- _LIBCPP_DEPRECATED_IN_CXX17 typedef _Tp argument_type;
-#endif
_LIBCPP_INLINE_VISIBILITY
size_t operator()(_Tp __v) const _NOEXCEPT
{
@@ -418,18 +378,10 @@ inline size_t __hash_combine(size_t __lhs, size_t __rhs) _NOEXCEPT {
return _HashT()(__p);
}
-_LIBCPP_SUPPRESS_DEPRECATED_PUSH
template<class _Tp>
struct _LIBCPP_TEMPLATE_VIS hash<_Tp*>
-#if !defined(_LIBCPP_ABI_NO_BINDER_BASES)
- : public unary_function<_Tp*, size_t>
-#endif
+ : public __unary_function<_Tp*, size_t>
{
-_LIBCPP_SUPPRESS_DEPRECATED_POP
-#if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_BINDER_TYPEDEFS)
- _LIBCPP_DEPRECATED_IN_CXX17 typedef size_t result_type;
- _LIBCPP_DEPRECATED_IN_CXX17 typedef _Tp* argument_type;
-#endif
_LIBCPP_INLINE_VISIBILITY
size_t operator()(_Tp* __v) const _NOEXCEPT
{
@@ -443,234 +395,118 @@ _LIBCPP_SUPPRESS_DEPRECATED_POP
}
};
-_LIBCPP_SUPPRESS_DEPRECATED_PUSH
template <>
struct _LIBCPP_TEMPLATE_VIS hash<bool>
-#if !defined(_LIBCPP_ABI_NO_BINDER_BASES)
- : public unary_function<bool, size_t>
-#endif
+ : public __unary_function<bool, size_t>
{
-_LIBCPP_SUPPRESS_DEPRECATED_POP
-#if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_BINDER_TYPEDEFS)
- _LIBCPP_DEPRECATED_IN_CXX17 typedef size_t result_type;
- _LIBCPP_DEPRECATED_IN_CXX17 typedef bool argument_type;
-#endif
_LIBCPP_INLINE_VISIBILITY
size_t operator()(bool __v) const _NOEXCEPT {return static_cast<size_t>(__v);}
};
-_LIBCPP_SUPPRESS_DEPRECATED_PUSH
template <>
struct _LIBCPP_TEMPLATE_VIS hash<char>
-#if !defined(_LIBCPP_ABI_NO_BINDER_BASES)
- : public unary_function<char, size_t>
-#endif
+ : public __unary_function<char, size_t>
{
-_LIBCPP_SUPPRESS_DEPRECATED_POP
-#if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_BINDER_TYPEDEFS)
- _LIBCPP_DEPRECATED_IN_CXX17 typedef size_t result_type;
- _LIBCPP_DEPRECATED_IN_CXX17 typedef char argument_type;
-#endif
_LIBCPP_INLINE_VISIBILITY
size_t operator()(char __v) const _NOEXCEPT {return static_cast<size_t>(__v);}
};
-_LIBCPP_SUPPRESS_DEPRECATED_PUSH
template <>
struct _LIBCPP_TEMPLATE_VIS hash<signed char>
-#if !defined(_LIBCPP_ABI_NO_BINDER_BASES)
- : public unary_function<signed char, size_t>
-#endif
+ : public __unary_function<signed char, size_t>
{
-_LIBCPP_SUPPRESS_DEPRECATED_POP
-#if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_BINDER_TYPEDEFS)
- _LIBCPP_DEPRECATED_IN_CXX17 typedef size_t result_type;
- _LIBCPP_DEPRECATED_IN_CXX17 typedef signed char argument_type;
-#endif
_LIBCPP_INLINE_VISIBILITY
size_t operator()(signed char __v) const _NOEXCEPT {return static_cast<size_t>(__v);}
};
-_LIBCPP_SUPPRESS_DEPRECATED_PUSH
template <>
struct _LIBCPP_TEMPLATE_VIS hash<unsigned char>
-#if !defined(_LIBCPP_ABI_NO_BINDER_BASES)
- : public unary_function<unsigned char, size_t>
-#endif
+ : public __unary_function<unsigned char, size_t>
{
-_LIBCPP_SUPPRESS_DEPRECATED_POP
-#if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_BINDER_TYPEDEFS)
- _LIBCPP_DEPRECATED_IN_CXX17 typedef size_t result_type;
- _LIBCPP_DEPRECATED_IN_CXX17 typedef unsigned char argument_type;
-#endif
_LIBCPP_INLINE_VISIBILITY
size_t operator()(unsigned char __v) const _NOEXCEPT {return static_cast<size_t>(__v);}
};
#ifndef _LIBCPP_HAS_NO_CHAR8_T
-_LIBCPP_SUPPRESS_DEPRECATED_PUSH
template <>
struct _LIBCPP_TEMPLATE_VIS hash<char8_t>
-#if !defined(_LIBCPP_ABI_NO_BINDER_BASES)
- : public unary_function<char8_t, size_t>
-#endif
+ : public __unary_function<char8_t, size_t>
{
-_LIBCPP_SUPPRESS_DEPRECATED_POP
-#if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_BINDER_TYPEDEFS)
- _LIBCPP_DEPRECATED_IN_CXX17 typedef size_t result_type;
- _LIBCPP_DEPRECATED_IN_CXX17 typedef char8_t argument_type;
-#endif
_LIBCPP_INLINE_VISIBILITY
size_t operator()(char8_t __v) const _NOEXCEPT {return static_cast<size_t>(__v);}
};
#endif // !_LIBCPP_HAS_NO_CHAR8_T
-#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
-
-_LIBCPP_SUPPRESS_DEPRECATED_PUSH
template <>
struct _LIBCPP_TEMPLATE_VIS hash<char16_t>
-#if !defined(_LIBCPP_ABI_NO_BINDER_BASES)
- : public unary_function<char16_t, size_t>
-#endif
+ : public __unary_function<char16_t, size_t>
{
-_LIBCPP_SUPPRESS_DEPRECATED_POP
-#if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_BINDER_TYPEDEFS)
- _LIBCPP_DEPRECATED_IN_CXX17 typedef size_t result_type;
- _LIBCPP_DEPRECATED_IN_CXX17 typedef char16_t argument_type;
-#endif
_LIBCPP_INLINE_VISIBILITY
size_t operator()(char16_t __v) const _NOEXCEPT {return static_cast<size_t>(__v);}
};
-_LIBCPP_SUPPRESS_DEPRECATED_PUSH
template <>
struct _LIBCPP_TEMPLATE_VIS hash<char32_t>
-#if !defined(_LIBCPP_ABI_NO_BINDER_BASES)
- : public unary_function<char32_t, size_t>
-#endif
+ : public __unary_function<char32_t, size_t>
{
-_LIBCPP_SUPPRESS_DEPRECATED_POP
-#if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_BINDER_TYPEDEFS)
- _LIBCPP_DEPRECATED_IN_CXX17 typedef size_t result_type;
- _LIBCPP_DEPRECATED_IN_CXX17 typedef char32_t argument_type;
-#endif
_LIBCPP_INLINE_VISIBILITY
size_t operator()(char32_t __v) const _NOEXCEPT {return static_cast<size_t>(__v);}
};
-#endif // _LIBCPP_HAS_NO_UNICODE_CHARS
-
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
-_LIBCPP_SUPPRESS_DEPRECATED_PUSH
template <>
struct _LIBCPP_TEMPLATE_VIS hash<wchar_t>
-#if !defined(_LIBCPP_ABI_NO_BINDER_BASES)
- : public unary_function<wchar_t, size_t>
-#endif
+ : public __unary_function<wchar_t, size_t>
{
-_LIBCPP_SUPPRESS_DEPRECATED_POP
-#if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_BINDER_TYPEDEFS)
- _LIBCPP_DEPRECATED_IN_CXX17 typedef size_t result_type;
- _LIBCPP_DEPRECATED_IN_CXX17 typedef wchar_t argument_type;
-#endif
_LIBCPP_INLINE_VISIBILITY
size_t operator()(wchar_t __v) const _NOEXCEPT {return static_cast<size_t>(__v);}
};
#endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS
-_LIBCPP_SUPPRESS_DEPRECATED_PUSH
template <>
struct _LIBCPP_TEMPLATE_VIS hash<short>
-#if !defined(_LIBCPP_ABI_NO_BINDER_BASES)
- : public unary_function<short, size_t>
-#endif
+ : public __unary_function<short, size_t>
{
-_LIBCPP_SUPPRESS_DEPRECATED_POP
-#if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_BINDER_TYPEDEFS)
- _LIBCPP_DEPRECATED_IN_CXX17 typedef size_t result_type;
- _LIBCPP_DEPRECATED_IN_CXX17 typedef short argument_type;
-#endif
_LIBCPP_INLINE_VISIBILITY
size_t operator()(short __v) const _NOEXCEPT {return static_cast<size_t>(__v);}
};
-_LIBCPP_SUPPRESS_DEPRECATED_PUSH
template <>
struct _LIBCPP_TEMPLATE_VIS hash<unsigned short>
-#if !defined(_LIBCPP_ABI_NO_BINDER_BASES)
- : public unary_function<unsigned short, size_t>
-#endif
+ : public __unary_function<unsigned short, size_t>
{
-_LIBCPP_SUPPRESS_DEPRECATED_POP
-#if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_BINDER_TYPEDEFS)
- _LIBCPP_DEPRECATED_IN_CXX17 typedef size_t result_type;
- _LIBCPP_DEPRECATED_IN_CXX17 typedef unsigned short argument_type;
-#endif
_LIBCPP_INLINE_VISIBILITY
size_t operator()(unsigned short __v) const _NOEXCEPT {return static_cast<size_t>(__v);}
};
-_LIBCPP_SUPPRESS_DEPRECATED_PUSH
template <>
struct _LIBCPP_TEMPLATE_VIS hash<int>
-#if !defined(_LIBCPP_ABI_NO_BINDER_BASES)
- : public unary_function<int, size_t>
-#endif
+ : public __unary_function<int, size_t>
{
-_LIBCPP_SUPPRESS_DEPRECATED_POP
-#if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_BINDER_TYPEDEFS)
- _LIBCPP_DEPRECATED_IN_CXX17 typedef size_t result_type;
- _LIBCPP_DEPRECATED_IN_CXX17 typedef int argument_type;
-#endif
_LIBCPP_INLINE_VISIBILITY
size_t operator()(int __v) const _NOEXCEPT {return static_cast<size_t>(__v);}
};
-_LIBCPP_SUPPRESS_DEPRECATED_PUSH
template <>
struct _LIBCPP_TEMPLATE_VIS hash<unsigned int>
-#if !defined(_LIBCPP_ABI_NO_BINDER_BASES)
- : public unary_function<unsigned int, size_t>
-#endif
+ : public __unary_function<unsigned int, size_t>
{
-_LIBCPP_SUPPRESS_DEPRECATED_POP
-#if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_BINDER_TYPEDEFS)
- _LIBCPP_DEPRECATED_IN_CXX17 typedef size_t result_type;
- _LIBCPP_DEPRECATED_IN_CXX17 typedef unsigned int argument_type;
-#endif
_LIBCPP_INLINE_VISIBILITY
size_t operator()(unsigned int __v) const _NOEXCEPT {return static_cast<size_t>(__v);}
};
-_LIBCPP_SUPPRESS_DEPRECATED_PUSH
template <>
struct _LIBCPP_TEMPLATE_VIS hash<long>
-#if !defined(_LIBCPP_ABI_NO_BINDER_BASES)
- : public unary_function<long, size_t>
-#endif
+ : public __unary_function<long, size_t>
{
-_LIBCPP_SUPPRESS_DEPRECATED_POP
-#if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_BINDER_TYPEDEFS)
- _LIBCPP_DEPRECATED_IN_CXX17 typedef size_t result_type;
- _LIBCPP_DEPRECATED_IN_CXX17 typedef long argument_type;
-#endif
_LIBCPP_INLINE_VISIBILITY
size_t operator()(long __v) const _NOEXCEPT {return static_cast<size_t>(__v);}
};
-_LIBCPP_SUPPRESS_DEPRECATED_PUSH
template <>
struct _LIBCPP_TEMPLATE_VIS hash<unsigned long>
-#if !defined(_LIBCPP_ABI_NO_BINDER_BASES)
- : public unary_function<unsigned long, size_t>
-#endif
+ : public __unary_function<unsigned long, size_t>
{
-_LIBCPP_SUPPRESS_DEPRECATED_POP
-#if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_BINDER_TYPEDEFS)
- _LIBCPP_DEPRECATED_IN_CXX17 typedef size_t result_type;
- _LIBCPP_DEPRECATED_IN_CXX17 typedef unsigned long argument_type;
-#endif
_LIBCPP_INLINE_VISIBILITY
size_t operator()(unsigned long __v) const _NOEXCEPT {return static_cast<size_t>(__v);}
};
@@ -781,25 +617,15 @@ struct _LIBCPP_TEMPLATE_VIS hash<long double>
}
};
-#if _LIBCPP_STD_VER > 11
-
-_LIBCPP_SUPPRESS_DEPRECATED_PUSH
template <class _Tp, bool = is_enum<_Tp>::value>
struct _LIBCPP_TEMPLATE_VIS __enum_hash
-#if !defined(_LIBCPP_ABI_NO_BINDER_BASES)
- : public unary_function<_Tp, size_t>
-#endif
+ : public __unary_function<_Tp, size_t>
{
-_LIBCPP_SUPPRESS_DEPRECATED_POP
-#if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_BINDER_TYPEDEFS)
- _LIBCPP_DEPRECATED_IN_CXX17 typedef size_t result_type;
- _LIBCPP_DEPRECATED_IN_CXX17 typedef _Tp argument_type;
-#endif
_LIBCPP_INLINE_VISIBILITY
size_t operator()(_Tp __v) const _NOEXCEPT
{
typedef typename underlying_type<_Tp>::type type;
- return hash<type>{}(static_cast<type>(__v));
+ return hash<type>()(static_cast<type>(__v));
}
};
template <class _Tp>
@@ -813,22 +639,13 @@ template <class _Tp>
struct _LIBCPP_TEMPLATE_VIS hash : public __enum_hash<_Tp>
{
};
-#endif
#if _LIBCPP_STD_VER > 14
-_LIBCPP_SUPPRESS_DEPRECATED_PUSH
template <>
struct _LIBCPP_TEMPLATE_VIS hash<nullptr_t>
-#if !defined(_LIBCPP_ABI_NO_BINDER_BASES)
- : public unary_function<nullptr_t, size_t>
-#endif
+ : public __unary_function<nullptr_t, size_t>
{
-_LIBCPP_SUPPRESS_DEPRECATED_POP
-#if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_BINDER_TYPEDEFS)
- _LIBCPP_DEPRECATED_IN_CXX17 typedef size_t result_type;
- _LIBCPP_DEPRECATED_IN_CXX17 typedef nullptr_t argument_type;
-#endif
_LIBCPP_INLINE_VISIBILITY
size_t operator()(nullptr_t) const _NOEXCEPT {
return 662607004ull;
diff --git a/libcxx/include/__functional/identity.h b/libcxx/include/__functional/identity.h
index 6b8346b3b2a7..2fe3acca0899 100644
--- a/libcxx/include/__functional/identity.h
+++ b/libcxx/include/__functional/identity.h
@@ -11,14 +11,23 @@
#define _LIBCPP___FUNCTIONAL_IDENTITY_H
#include <__config>
-#include <utility>
+#include <__utility/forward.h>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-#pragma GCC system_header
+# pragma GCC system_header
#endif
_LIBCPP_BEGIN_NAMESPACE_STD
+struct __identity {
+ template <class _Tp>
+ _LIBCPP_NODISCARD _LIBCPP_CONSTEXPR _Tp&& operator()(_Tp&& __t) const _NOEXCEPT {
+ return std::forward<_Tp>(__t);
+ }
+
+ using is_transparent = void;
+};
+
#if _LIBCPP_STD_VER > 17
struct identity {
diff --git a/libcxx/include/__functional/invoke.h b/libcxx/include/__functional/invoke.h
index 0e167c75d690..7381462ffca5 100644
--- a/libcxx/include/__functional/invoke.h
+++ b/libcxx/include/__functional/invoke.h
@@ -11,79 +11,526 @@
#define _LIBCPP___FUNCTIONAL_INVOKE_H
#include <__config>
-#include <__functional/weak_result_type.h>
+#include <__type_traits/add_lvalue_reference.h>
+#include <__type_traits/apply_cv.h>
+#include <__type_traits/conditional.h>
+#include <__type_traits/decay.h>
+#include <__type_traits/enable_if.h>
+#include <__type_traits/integral_constant.h>
+#include <__type_traits/is_base_of.h>
+#include <__type_traits/is_core_convertible.h>
+#include <__type_traits/is_member_function_pointer.h>
+#include <__type_traits/is_member_object_pointer.h>
+#include <__type_traits/is_reference_wrapper.h>
+#include <__type_traits/is_same.h>
+#include <__type_traits/is_void.h>
+#include <__type_traits/remove_cv.h>
+#include <__utility/declval.h>
#include <__utility/forward.h>
-#include <type_traits>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-#pragma GCC system_header
+# pragma GCC system_header
#endif
+// TODO: Disentangle the type traits and std::invoke properly
+
_LIBCPP_BEGIN_NAMESPACE_STD
-template <class _Ret, bool = is_void<_Ret>::value>
-struct __invoke_void_return_wrapper
+struct __any
+{
+ __any(...);
+};
+
+struct __nat
{
#ifndef _LIBCPP_CXX03_LANG
- template <class ..._Args>
- static _Ret __call(_Args&&... __args) {
- return _VSTD::__invoke(_VSTD::forward<_Args>(__args)...);
- }
-#else
- template <class _Fn>
- static _Ret __call(_Fn __f) {
- return _VSTD::__invoke(__f);
- }
+ __nat() = delete;
+ __nat(const __nat&) = delete;
+ __nat& operator=(const __nat&) = delete;
+ ~__nat() = delete;
+#endif
+};
- template <class _Fn, class _A0>
- static _Ret __call(_Fn __f, _A0& __a0) {
- return _VSTD::__invoke(__f, __a0);
- }
+template <class _MP, bool _IsMemberFunctionPtr, bool _IsMemberObjectPtr>
+struct __member_pointer_traits_imp
+{
+};
- template <class _Fn, class _A0, class _A1>
- static _Ret __call(_Fn __f, _A0& __a0, _A1& __a1) {
- return _VSTD::__invoke(__f, __a0, __a1);
- }
+template <class _Rp, class _Class, class ..._Param>
+struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...), true, false>
+{
+ typedef _Class _ClassType;
+ typedef _Rp _ReturnType;
+ typedef _Rp (_FnType) (_Param...);
+};
+
+template <class _Rp, class _Class, class ..._Param>
+struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param..., ...), true, false>
+{
+ typedef _Class _ClassType;
+ typedef _Rp _ReturnType;
+ typedef _Rp (_FnType) (_Param..., ...);
+};
+
+template <class _Rp, class _Class, class ..._Param>
+struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) const, true, false>
+{
+ typedef _Class const _ClassType;
+ typedef _Rp _ReturnType;
+ typedef _Rp (_FnType) (_Param...);
+};
+
+template <class _Rp, class _Class, class ..._Param>
+struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param..., ...) const, true, false>
+{
+ typedef _Class const _ClassType;
+ typedef _Rp _ReturnType;
+ typedef _Rp (_FnType) (_Param..., ...);
+};
+
+template <class _Rp, class _Class, class ..._Param>
+struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) volatile, true, false>
+{
+ typedef _Class volatile _ClassType;
+ typedef _Rp _ReturnType;
+ typedef _Rp (_FnType) (_Param...);
+};
+
+template <class _Rp, class _Class, class ..._Param>
+struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param..., ...) volatile, true, false>
+{
+ typedef _Class volatile _ClassType;
+ typedef _Rp _ReturnType;
+ typedef _Rp (_FnType) (_Param..., ...);
+};
+
+template <class _Rp, class _Class, class ..._Param>
+struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) const volatile, true, false>
+{
+ typedef _Class const volatile _ClassType;
+ typedef _Rp _ReturnType;
+ typedef _Rp (_FnType) (_Param...);
+};
+
+template <class _Rp, class _Class, class ..._Param>
+struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param..., ...) const volatile, true, false>
+{
+ typedef _Class const volatile _ClassType;
+ typedef _Rp _ReturnType;
+ typedef _Rp (_FnType) (_Param..., ...);
+};
+
+template <class _Rp, class _Class, class ..._Param>
+struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) &, true, false>
+{
+ typedef _Class& _ClassType;
+ typedef _Rp _ReturnType;
+ typedef _Rp (_FnType) (_Param...);
+};
+
+template <class _Rp, class _Class, class ..._Param>
+struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param..., ...) &, true, false>
+{
+ typedef _Class& _ClassType;
+ typedef _Rp _ReturnType;
+ typedef _Rp (_FnType) (_Param..., ...);
+};
+
+template <class _Rp, class _Class, class ..._Param>
+struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) const&, true, false>
+{
+ typedef _Class const& _ClassType;
+ typedef _Rp _ReturnType;
+ typedef _Rp (_FnType) (_Param...);
+};
+
+template <class _Rp, class _Class, class ..._Param>
+struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param..., ...) const&, true, false>
+{
+ typedef _Class const& _ClassType;
+ typedef _Rp _ReturnType;
+ typedef _Rp (_FnType) (_Param..., ...);
+};
+
+template <class _Rp, class _Class, class ..._Param>
+struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) volatile&, true, false>
+{
+ typedef _Class volatile& _ClassType;
+ typedef _Rp _ReturnType;
+ typedef _Rp (_FnType) (_Param...);
+};
+
+template <class _Rp, class _Class, class ..._Param>
+struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param..., ...) volatile&, true, false>
+{
+ typedef _Class volatile& _ClassType;
+ typedef _Rp _ReturnType;
+ typedef _Rp (_FnType) (_Param..., ...);
+};
+
+template <class _Rp, class _Class, class ..._Param>
+struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) const volatile&, true, false>
+{
+ typedef _Class const volatile& _ClassType;
+ typedef _Rp _ReturnType;
+ typedef _Rp (_FnType) (_Param...);
+};
+
+template <class _Rp, class _Class, class ..._Param>
+struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param..., ...) const volatile&, true, false>
+{
+ typedef _Class const volatile& _ClassType;
+ typedef _Rp _ReturnType;
+ typedef _Rp (_FnType) (_Param..., ...);
+};
+
+template <class _Rp, class _Class, class ..._Param>
+struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) &&, true, false>
+{
+ typedef _Class&& _ClassType;
+ typedef _Rp _ReturnType;
+ typedef _Rp (_FnType) (_Param...);
+};
+
+template <class _Rp, class _Class, class ..._Param>
+struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param..., ...) &&, true, false>
+{
+ typedef _Class&& _ClassType;
+ typedef _Rp _ReturnType;
+ typedef _Rp (_FnType) (_Param..., ...);
+};
+
+template <class _Rp, class _Class, class ..._Param>
+struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) const&&, true, false>
+{
+ typedef _Class const&& _ClassType;
+ typedef _Rp _ReturnType;
+ typedef _Rp (_FnType) (_Param...);
+};
+
+template <class _Rp, class _Class, class ..._Param>
+struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param..., ...) const&&, true, false>
+{
+ typedef _Class const&& _ClassType;
+ typedef _Rp _ReturnType;
+ typedef _Rp (_FnType) (_Param..., ...);
+};
+
+template <class _Rp, class _Class, class ..._Param>
+struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) volatile&&, true, false>
+{
+ typedef _Class volatile&& _ClassType;
+ typedef _Rp _ReturnType;
+ typedef _Rp (_FnType) (_Param...);
+};
+
+template <class _Rp, class _Class, class ..._Param>
+struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param..., ...) volatile&&, true, false>
+{
+ typedef _Class volatile&& _ClassType;
+ typedef _Rp _ReturnType;
+ typedef _Rp (_FnType) (_Param..., ...);
+};
+
+template <class _Rp, class _Class, class ..._Param>
+struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) const volatile&&, true, false>
+{
+ typedef _Class const volatile&& _ClassType;
+ typedef _Rp _ReturnType;
+ typedef _Rp (_FnType) (_Param...);
+};
+
+template <class _Rp, class _Class, class ..._Param>
+struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param..., ...) const volatile&&, true, false>
+{
+ typedef _Class const volatile&& _ClassType;
+ typedef _Rp _ReturnType;
+ typedef _Rp (_FnType) (_Param..., ...);
+};
+
+template <class _Rp, class _Class>
+struct __member_pointer_traits_imp<_Rp _Class::*, false, true>
+{
+ typedef _Class _ClassType;
+ typedef _Rp _ReturnType;
+};
+
+template <class _MP>
+struct __member_pointer_traits
+ : public __member_pointer_traits_imp<typename remove_cv<_MP>::type,
+ is_member_function_pointer<_MP>::value,
+ is_member_object_pointer<_MP>::value>
+{
+// typedef ... _ClassType;
+// typedef ... _ReturnType;
+// typedef ... _FnType;
+};
+
+template <class _DecayedFp>
+struct __member_pointer_class_type {};
+
+template <class _Ret, class _ClassType>
+struct __member_pointer_class_type<_Ret _ClassType::*> {
+ typedef _ClassType type;
+};
+
+template <class _Fp, class _A0,
+ class _DecayFp = typename decay<_Fp>::type,
+ class _DecayA0 = typename decay<_A0>::type,
+ class _ClassT = typename __member_pointer_class_type<_DecayFp>::type>
+using __enable_if_bullet1 = typename enable_if
+ <
+ is_member_function_pointer<_DecayFp>::value
+ && is_base_of<_ClassT, _DecayA0>::value
+ >::type;
+
+template <class _Fp, class _A0,
+ class _DecayFp = typename decay<_Fp>::type,
+ class _DecayA0 = typename decay<_A0>::type>
+using __enable_if_bullet2 = typename enable_if
+ <
+ is_member_function_pointer<_DecayFp>::value
+ && __is_reference_wrapper<_DecayA0>::value
+ >::type;
+
+template <class _Fp, class _A0,
+ class _DecayFp = typename decay<_Fp>::type,
+ class _DecayA0 = typename decay<_A0>::type,
+ class _ClassT = typename __member_pointer_class_type<_DecayFp>::type>
+using __enable_if_bullet3 = typename enable_if
+ <
+ is_member_function_pointer<_DecayFp>::value
+ && !is_base_of<_ClassT, _DecayA0>::value
+ && !__is_reference_wrapper<_DecayA0>::value
+ >::type;
+
+template <class _Fp, class _A0,
+ class _DecayFp = typename decay<_Fp>::type,
+ class _DecayA0 = typename decay<_A0>::type,
+ class _ClassT = typename __member_pointer_class_type<_DecayFp>::type>
+using __enable_if_bullet4 = typename enable_if
+ <
+ is_member_object_pointer<_DecayFp>::value
+ && is_base_of<_ClassT, _DecayA0>::value
+ >::type;
+
+template <class _Fp, class _A0,
+ class _DecayFp = typename decay<_Fp>::type,
+ class _DecayA0 = typename decay<_A0>::type>
+using __enable_if_bullet5 = typename enable_if
+ <
+ is_member_object_pointer<_DecayFp>::value
+ && __is_reference_wrapper<_DecayA0>::value
+ >::type;
+
+template <class _Fp, class _A0,
+ class _DecayFp = typename decay<_Fp>::type,
+ class _DecayA0 = typename decay<_A0>::type,
+ class _ClassT = typename __member_pointer_class_type<_DecayFp>::type>
+using __enable_if_bullet6 = typename enable_if
+ <
+ is_member_object_pointer<_DecayFp>::value
+ && !is_base_of<_ClassT, _DecayA0>::value
+ && !__is_reference_wrapper<_DecayA0>::value
+ >::type;
+
+// __invoke forward declarations
+
+// fall back - none of the bullets
+
+template <class ..._Args>
+__nat __invoke(__any, _Args&& ...__args);
+
+// bullets 1, 2 and 3
+
+template <class _Fp, class _A0, class ..._Args,
+ class = __enable_if_bullet1<_Fp, _A0> >
+inline _LIBCPP_INLINE_VISIBILITY
+_LIBCPP_CONSTEXPR decltype((std::declval<_A0>().*std::declval<_Fp>())(std::declval<_Args>()...))
+__invoke(_Fp&& __f, _A0&& __a0, _Args&& ...__args)
+ _NOEXCEPT_(noexcept((static_cast<_A0&&>(__a0).*__f)(static_cast<_Args&&>(__args)...)))
+ { return (static_cast<_A0&&>(__a0).*__f)(static_cast<_Args&&>(__args)...); }
+
+template <class _Fp, class _A0, class ..._Args,
+ class = __enable_if_bullet2<_Fp, _A0> >
+inline _LIBCPP_INLINE_VISIBILITY
+_LIBCPP_CONSTEXPR decltype((std::declval<_A0>().get().*std::declval<_Fp>())(std::declval<_Args>()...))
+__invoke(_Fp&& __f, _A0&& __a0, _Args&& ...__args)
+ _NOEXCEPT_(noexcept((__a0.get().*__f)(static_cast<_Args&&>(__args)...)))
+ { return (__a0.get().*__f)(static_cast<_Args&&>(__args)...); }
+
+template <class _Fp, class _A0, class ..._Args,
+ class = __enable_if_bullet3<_Fp, _A0> >
+inline _LIBCPP_INLINE_VISIBILITY
+_LIBCPP_CONSTEXPR decltype(((*std::declval<_A0>()).*std::declval<_Fp>())(std::declval<_Args>()...))
+__invoke(_Fp&& __f, _A0&& __a0, _Args&& ...__args)
+ _NOEXCEPT_(noexcept(((*static_cast<_A0&&>(__a0)).*__f)(static_cast<_Args&&>(__args)...)))
+ { return ((*static_cast<_A0&&>(__a0)).*__f)(static_cast<_Args&&>(__args)...); }
+
+// bullets 4, 5 and 6
+
+template <class _Fp, class _A0,
+ class = __enable_if_bullet4<_Fp, _A0> >
+inline _LIBCPP_INLINE_VISIBILITY
+_LIBCPP_CONSTEXPR decltype(std::declval<_A0>().*std::declval<_Fp>())
+__invoke(_Fp&& __f, _A0&& __a0)
+ _NOEXCEPT_(noexcept(static_cast<_A0&&>(__a0).*__f))
+ { return static_cast<_A0&&>(__a0).*__f; }
+
+template <class _Fp, class _A0,
+ class = __enable_if_bullet5<_Fp, _A0> >
+inline _LIBCPP_INLINE_VISIBILITY
+_LIBCPP_CONSTEXPR decltype(std::declval<_A0>().get().*std::declval<_Fp>())
+__invoke(_Fp&& __f, _A0&& __a0)
+ _NOEXCEPT_(noexcept(__a0.get().*__f))
+ { return __a0.get().*__f; }
+
+template <class _Fp, class _A0,
+ class = __enable_if_bullet6<_Fp, _A0> >
+inline _LIBCPP_INLINE_VISIBILITY
+_LIBCPP_CONSTEXPR decltype((*std::declval<_A0>()).*std::declval<_Fp>())
+__invoke(_Fp&& __f, _A0&& __a0)
+ _NOEXCEPT_(noexcept((*static_cast<_A0&&>(__a0)).*__f))
+ { return (*static_cast<_A0&&>(__a0)).*__f; }
+
+// bullet 7
+
+template <class _Fp, class ..._Args>
+inline _LIBCPP_INLINE_VISIBILITY
+_LIBCPP_CONSTEXPR decltype(std::declval<_Fp>()(std::declval<_Args>()...))
+__invoke(_Fp&& __f, _Args&& ...__args)
+ _NOEXCEPT_(noexcept(static_cast<_Fp&&>(__f)(static_cast<_Args&&>(__args)...)))
+ { return static_cast<_Fp&&>(__f)(static_cast<_Args&&>(__args)...); }
+
+// __invokable
+template <class _Ret, class _Fp, class ..._Args>
+struct __invokable_r
+{
+ template <class _XFp, class ..._XArgs>
+ static decltype(std::__invoke(declval<_XFp>(), declval<_XArgs>()...)) __try_call(int);
+ template <class _XFp, class ..._XArgs>
+ static __nat __try_call(...);
+
+ // FIXME: Check that _Ret, _Fp, and _Args... are all complete types, cv void,
+ // or incomplete array types as required by the standard.
+ using _Result = decltype(__try_call<_Fp, _Args...>(0));
+
+ using type = typename conditional<
+ _IsNotSame<_Result, __nat>::value,
+ typename conditional< is_void<_Ret>::value, true_type, __is_core_convertible<_Result, _Ret> >::type,
+ false_type >::type;
+ static const bool value = type::value;
+};
+template <class _Fp, class ..._Args>
+using __invokable = __invokable_r<void, _Fp, _Args...>;
+
+template <bool _IsInvokable, bool _IsCVVoid, class _Ret, class _Fp, class ..._Args>
+struct __nothrow_invokable_r_imp {
+ static const bool value = false;
+};
+
+template <class _Ret, class _Fp, class ..._Args>
+struct __nothrow_invokable_r_imp<true, false, _Ret, _Fp, _Args...>
+{
+ typedef __nothrow_invokable_r_imp _ThisT;
+
+ template <class _Tp>
+ static void __test_noexcept(_Tp) _NOEXCEPT;
+
+ static const bool value = noexcept(_ThisT::__test_noexcept<_Ret>(
+ _VSTD::__invoke(declval<_Fp>(), declval<_Args>()...)));
+};
- template <class _Fn, class _A0, class _A1, class _A2>
- static _Ret __call(_Fn __f, _A0& __a0, _A1& __a1, _A2& __a2){
- return _VSTD::__invoke(__f, __a0, __a1, __a2);
+template <class _Ret, class _Fp, class ..._Args>
+struct __nothrow_invokable_r_imp<true, true, _Ret, _Fp, _Args...>
+{
+ static const bool value = noexcept(
+ _VSTD::__invoke(declval<_Fp>(), declval<_Args>()...));
+};
+
+template <class _Ret, class _Fp, class ..._Args>
+using __nothrow_invokable_r =
+ __nothrow_invokable_r_imp<
+ __invokable_r<_Ret, _Fp, _Args...>::value,
+ is_void<_Ret>::value,
+ _Ret, _Fp, _Args...
+ >;
+
+template <class _Fp, class ..._Args>
+using __nothrow_invokable =
+ __nothrow_invokable_r_imp<
+ __invokable<_Fp, _Args...>::value,
+ true, void, _Fp, _Args...
+ >;
+
+template <class _Fp, class ..._Args>
+struct __invoke_of
+ : public enable_if<
+ __invokable<_Fp, _Args...>::value,
+ typename __invokable_r<void, _Fp, _Args...>::_Result>
+{
+};
+
+template <class _Ret, bool = is_void<_Ret>::value>
+struct __invoke_void_return_wrapper
+{
+ template <class ..._Args>
+ static _Ret __call(_Args&&... __args) {
+ return std::__invoke(std::forward<_Args>(__args)...);
}
-#endif
};
template <class _Ret>
struct __invoke_void_return_wrapper<_Ret, true>
{
-#ifndef _LIBCPP_CXX03_LANG
template <class ..._Args>
static void __call(_Args&&... __args) {
- _VSTD::__invoke(_VSTD::forward<_Args>(__args)...);
- }
-#else
- template <class _Fn>
- static void __call(_Fn __f) {
- _VSTD::__invoke(__f);
+ std::__invoke(std::forward<_Args>(__args)...);
}
+};
- template <class _Fn, class _A0>
- static void __call(_Fn __f, _A0& __a0) {
- _VSTD::__invoke(__f, __a0);
- }
+#if _LIBCPP_STD_VER > 14
- template <class _Fn, class _A0, class _A1>
- static void __call(_Fn __f, _A0& __a0, _A1& __a1) {
- _VSTD::__invoke(__f, __a0, __a1);
- }
+// is_invocable
- template <class _Fn, class _A0, class _A1, class _A2>
- static void __call(_Fn __f, _A0& __a0, _A1& __a1, _A2& __a2) {
- _VSTD::__invoke(__f, __a0, __a1, __a2);
- }
-#endif
+template <class _Fn, class ..._Args>
+struct _LIBCPP_TEMPLATE_VIS is_invocable
+ : integral_constant<bool, __invokable<_Fn, _Args...>::value> {};
+
+template <class _Ret, class _Fn, class ..._Args>
+struct _LIBCPP_TEMPLATE_VIS is_invocable_r
+ : integral_constant<bool, __invokable_r<_Ret, _Fn, _Args...>::value> {};
+
+template <class _Fn, class ..._Args>
+inline constexpr bool is_invocable_v = is_invocable<_Fn, _Args...>::value;
+
+template <class _Ret, class _Fn, class ..._Args>
+inline constexpr bool is_invocable_r_v = is_invocable_r<_Ret, _Fn, _Args...>::value;
+
+// is_nothrow_invocable
+
+template <class _Fn, class ..._Args>
+struct _LIBCPP_TEMPLATE_VIS is_nothrow_invocable
+ : integral_constant<bool, __nothrow_invokable<_Fn, _Args...>::value> {};
+
+template <class _Ret, class _Fn, class ..._Args>
+struct _LIBCPP_TEMPLATE_VIS is_nothrow_invocable_r
+ : integral_constant<bool, __nothrow_invokable_r<_Ret, _Fn, _Args...>::value> {};
+
+template <class _Fn, class ..._Args>
+inline constexpr bool is_nothrow_invocable_v = is_nothrow_invocable<_Fn, _Args...>::value;
+
+template <class _Ret, class _Fn, class ..._Args>
+inline constexpr bool is_nothrow_invocable_r_v = is_nothrow_invocable_r<_Ret, _Fn, _Args...>::value;
+
+template <class _Fn, class... _Args>
+struct _LIBCPP_TEMPLATE_VIS invoke_result
+ : __invoke_of<_Fn, _Args...>
+{
};
-#if _LIBCPP_STD_VER > 14
+template <class _Fn, class... _Args>
+using invoke_result_t = typename invoke_result<_Fn, _Args...>::type;
template <class _Fn, class ..._Args>
_LIBCPP_CONSTEXPR_AFTER_CXX17 invoke_result_t<_Fn, _Args...>
diff --git a/libcxx/include/__functional/is_transparent.h b/libcxx/include/__functional/is_transparent.h
index 4a72aa8e29ee..74326c76c12f 100644
--- a/libcxx/include/__functional/is_transparent.h
+++ b/libcxx/include/__functional/is_transparent.h
@@ -14,7 +14,7 @@
#include <type_traits>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-#pragma GCC system_header
+# pragma GCC system_header
#endif
_LIBCPP_BEGIN_NAMESPACE_STD
diff --git a/libcxx/include/__functional/mem_fn.h b/libcxx/include/__functional/mem_fn.h
index 0ec84233439c..a5818b3f018c 100644
--- a/libcxx/include/__functional/mem_fn.h
+++ b/libcxx/include/__functional/mem_fn.h
@@ -14,19 +14,17 @@
#include <__functional/binary_function.h>
#include <__functional/invoke.h>
#include <__functional/weak_result_type.h>
-#include <utility>
+#include <__utility/forward.h>
+#include <type_traits>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-#pragma GCC system_header
+# pragma GCC system_header
#endif
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _Tp>
-class __mem_fn
-#if _LIBCPP_STD_VER <= 17 || !defined(_LIBCPP_ABI_NO_BINDER_BASES)
- : public __weak_result_type<_Tp>
-#endif
+class __mem_fn : public __weak_result_type<_Tp>
{
public:
// types
@@ -38,114 +36,14 @@ public:
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
__mem_fn(type __f) _NOEXCEPT : __f_(__f) {}
-#ifndef _LIBCPP_CXX03_LANG
// invoke
template <class... _ArgTypes>
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
+
typename __invoke_return<type, _ArgTypes...>::type
operator() (_ArgTypes&&... __args) const {
- return _VSTD::__invoke(__f_, _VSTD::forward<_ArgTypes>(__args)...);
- }
-#else
-
- template <class _A0>
- _LIBCPP_INLINE_VISIBILITY
- typename __invoke_return0<type, _A0>::type
- operator() (_A0& __a0) const {
- return _VSTD::__invoke(__f_, __a0);
- }
-
- template <class _A0>
- _LIBCPP_INLINE_VISIBILITY
- typename __invoke_return0<type, _A0 const>::type
- operator() (_A0 const& __a0) const {
- return _VSTD::__invoke(__f_, __a0);
- }
-
- template <class _A0, class _A1>
- _LIBCPP_INLINE_VISIBILITY
- typename __invoke_return1<type, _A0, _A1>::type
- operator() (_A0& __a0, _A1& __a1) const {
- return _VSTD::__invoke(__f_, __a0, __a1);
- }
-
- template <class _A0, class _A1>
- _LIBCPP_INLINE_VISIBILITY
- typename __invoke_return1<type, _A0 const, _A1>::type
- operator() (_A0 const& __a0, _A1& __a1) const {
- return _VSTD::__invoke(__f_, __a0, __a1);
- }
-
- template <class _A0, class _A1>
- _LIBCPP_INLINE_VISIBILITY
- typename __invoke_return1<type, _A0, _A1 const>::type
- operator() (_A0& __a0, _A1 const& __a1) const {
- return _VSTD::__invoke(__f_, __a0, __a1);
- }
-
- template <class _A0, class _A1>
- _LIBCPP_INLINE_VISIBILITY
- typename __invoke_return1<type, _A0 const, _A1 const>::type
- operator() (_A0 const& __a0, _A1 const& __a1) const {
- return _VSTD::__invoke(__f_, __a0, __a1);
- }
-
- template <class _A0, class _A1, class _A2>
- _LIBCPP_INLINE_VISIBILITY
- typename __invoke_return2<type, _A0, _A1, _A2>::type
- operator() (_A0& __a0, _A1& __a1, _A2& __a2) const {
- return _VSTD::__invoke(__f_, __a0, __a1, __a2);
+ return std::__invoke(__f_, std::forward<_ArgTypes>(__args)...);
}
-
- template <class _A0, class _A1, class _A2>
- _LIBCPP_INLINE_VISIBILITY
- typename __invoke_return2<type, _A0 const, _A1, _A2>::type
- operator() (_A0 const& __a0, _A1& __a1, _A2& __a2) const {
- return _VSTD::__invoke(__f_, __a0, __a1, __a2);
- }
-
- template <class _A0, class _A1, class _A2>
- _LIBCPP_INLINE_VISIBILITY
- typename __invoke_return2<type, _A0, _A1 const, _A2>::type
- operator() (_A0& __a0, _A1 const& __a1, _A2& __a2) const {
- return _VSTD::__invoke(__f_, __a0, __a1, __a2);
- }
-
- template <class _A0, class _A1, class _A2>
- _LIBCPP_INLINE_VISIBILITY
- typename __invoke_return2<type, _A0, _A1, _A2 const>::type
- operator() (_A0& __a0, _A1& __a1, _A2 const& __a2) const {
- return _VSTD::__invoke(__f_, __a0, __a1, __a2);
- }
-
- template <class _A0, class _A1, class _A2>
- _LIBCPP_INLINE_VISIBILITY
- typename __invoke_return2<type, _A0 const, _A1 const, _A2>::type
- operator() (_A0 const& __a0, _A1 const& __a1, _A2& __a2) const {
- return _VSTD::__invoke(__f_, __a0, __a1, __a2);
- }
-
- template <class _A0, class _A1, class _A2>
- _LIBCPP_INLINE_VISIBILITY
- typename __invoke_return2<type, _A0 const, _A1, _A2 const>::type
- operator() (_A0 const& __a0, _A1& __a1, _A2 const& __a2) const {
- return _VSTD::__invoke(__f_, __a0, __a1, __a2);
- }
-
- template <class _A0, class _A1, class _A2>
- _LIBCPP_INLINE_VISIBILITY
- typename __invoke_return2<type, _A0, _A1 const, _A2 const>::type
- operator() (_A0& __a0, _A1 const& __a1, _A2 const& __a2) const {
- return _VSTD::__invoke(__f_, __a0, __a1, __a2);
- }
-
- template <class _A0, class _A1, class _A2>
- _LIBCPP_INLINE_VISIBILITY
- typename __invoke_return2<type, _A0 const, _A1 const, _A2 const>::type
- operator() (_A0 const& __a0, _A1 const& __a1, _A2 const& __a2) const {
- return _VSTD::__invoke(__f_, __a0, __a1, __a2);
- }
-#endif
};
template<class _Rp, class _Tp>
diff --git a/libcxx/include/__functional/mem_fun_ref.h b/libcxx/include/__functional/mem_fun_ref.h
index 830936c1b0e5..65aab0696c16 100644
--- a/libcxx/include/__functional/mem_fun_ref.h
+++ b/libcxx/include/__functional/mem_fun_ref.h
@@ -15,7 +15,7 @@
#include <__functional/unary_function.h>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-#pragma GCC system_header
+# pragma GCC system_header
#endif
_LIBCPP_BEGIN_NAMESPACE_STD
@@ -24,7 +24,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD
template<class _Sp, class _Tp>
class _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX11 mem_fun_t
- : public unary_function<_Tp*, _Sp>
+ : public __unary_function<_Tp*, _Sp>
{
_Sp (_Tp::*__p_)();
public:
@@ -36,7 +36,7 @@ public:
template<class _Sp, class _Tp, class _Ap>
class _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX11 mem_fun1_t
- : public binary_function<_Tp*, _Ap, _Sp>
+ : public __binary_function<_Tp*, _Ap, _Sp>
{
_Sp (_Tp::*__p_)(_Ap);
public:
@@ -60,7 +60,7 @@ mem_fun(_Sp (_Tp::*__f)(_Ap))
template<class _Sp, class _Tp>
class _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX11 mem_fun_ref_t
- : public unary_function<_Tp, _Sp>
+ : public __unary_function<_Tp, _Sp>
{
_Sp (_Tp::*__p_)();
public:
@@ -72,7 +72,7 @@ public:
template<class _Sp, class _Tp, class _Ap>
class _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX11 mem_fun1_ref_t
- : public binary_function<_Tp, _Ap, _Sp>
+ : public __binary_function<_Tp, _Ap, _Sp>
{
_Sp (_Tp::*__p_)(_Ap);
public:
@@ -96,7 +96,7 @@ mem_fun_ref(_Sp (_Tp::*__f)(_Ap))
template <class _Sp, class _Tp>
class _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX11 const_mem_fun_t
- : public unary_function<const _Tp*, _Sp>
+ : public __unary_function<const _Tp*, _Sp>
{
_Sp (_Tp::*__p_)() const;
public:
@@ -108,7 +108,7 @@ public:
template <class _Sp, class _Tp, class _Ap>
class _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX11 const_mem_fun1_t
- : public binary_function<const _Tp*, _Ap, _Sp>
+ : public __binary_function<const _Tp*, _Ap, _Sp>
{
_Sp (_Tp::*__p_)(_Ap) const;
public:
@@ -132,7 +132,7 @@ mem_fun(_Sp (_Tp::*__f)(_Ap) const)
template <class _Sp, class _Tp>
class _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX11 const_mem_fun_ref_t
- : public unary_function<_Tp, _Sp>
+ : public __unary_function<_Tp, _Sp>
{
_Sp (_Tp::*__p_)() const;
public:
@@ -144,7 +144,7 @@ public:
template <class _Sp, class _Tp, class _Ap>
class _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX11 const_mem_fun1_ref_t
- : public binary_function<_Tp, _Ap, _Sp>
+ : public __binary_function<_Tp, _Ap, _Sp>
{
_Sp (_Tp::*__p_)(_Ap) const;
public:
diff --git a/libcxx/include/__functional/not_fn.h b/libcxx/include/__functional/not_fn.h
index 36aab2eb7935..b5c415c25c44 100644
--- a/libcxx/include/__functional/not_fn.h
+++ b/libcxx/include/__functional/not_fn.h
@@ -13,10 +13,11 @@
#include <__config>
#include <__functional/invoke.h>
#include <__functional/perfect_forward.h>
-#include <utility>
+#include <__utility/forward.h>
+#include <type_traits>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-#pragma GCC system_header
+# pragma GCC system_header
#endif
_LIBCPP_BEGIN_NAMESPACE_STD
diff --git a/libcxx/include/__functional/operations.h b/libcxx/include/__functional/operations.h
index 0c7c6d4fcfaf..1c73c999db91 100644
--- a/libcxx/include/__functional/operations.h
+++ b/libcxx/include/__functional/operations.h
@@ -16,31 +16,22 @@
#include <__utility/forward.h>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-#pragma GCC system_header
+# pragma GCC system_header
#endif
_LIBCPP_BEGIN_NAMESPACE_STD
// Arithmetic operations
-_LIBCPP_SUPPRESS_DEPRECATED_PUSH
#if _LIBCPP_STD_VER > 11
template <class _Tp = void>
#else
template <class _Tp>
#endif
struct _LIBCPP_TEMPLATE_VIS plus
-#if !defined(_LIBCPP_ABI_NO_BINDER_BASES)
- : binary_function<_Tp, _Tp, _Tp>
-#endif
+ : __binary_function<_Tp, _Tp, _Tp>
{
-_LIBCPP_SUPPRESS_DEPRECATED_POP
typedef _Tp __result_type; // used by valarray
-#if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_BINDER_TYPEDEFS)
- _LIBCPP_DEPRECATED_IN_CXX17 typedef _Tp result_type;
- _LIBCPP_DEPRECATED_IN_CXX17 typedef _Tp first_argument_type;
- _LIBCPP_DEPRECATED_IN_CXX17 typedef _Tp second_argument_type;
-#endif
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
_Tp operator()(const _Tp& __x, const _Tp& __y) const
{return __x + __y;}
@@ -60,24 +51,15 @@ struct _LIBCPP_TEMPLATE_VIS plus<void>
};
#endif
-_LIBCPP_SUPPRESS_DEPRECATED_PUSH
#if _LIBCPP_STD_VER > 11
template <class _Tp = void>
#else
template <class _Tp>
#endif
struct _LIBCPP_TEMPLATE_VIS minus
-#if !defined(_LIBCPP_ABI_NO_BINDER_BASES)
- : binary_function<_Tp, _Tp, _Tp>
-#endif
+ : __binary_function<_Tp, _Tp, _Tp>
{
-_LIBCPP_SUPPRESS_DEPRECATED_POP
typedef _Tp __result_type; // used by valarray
-#if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_BINDER_TYPEDEFS)
- _LIBCPP_DEPRECATED_IN_CXX17 typedef _Tp result_type;
- _LIBCPP_DEPRECATED_IN_CXX17 typedef _Tp first_argument_type;
- _LIBCPP_DEPRECATED_IN_CXX17 typedef _Tp second_argument_type;
-#endif
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
_Tp operator()(const _Tp& __x, const _Tp& __y) const
{return __x - __y;}
@@ -97,24 +79,15 @@ struct _LIBCPP_TEMPLATE_VIS minus<void>
};
#endif
-_LIBCPP_SUPPRESS_DEPRECATED_PUSH
#if _LIBCPP_STD_VER > 11
template <class _Tp = void>
#else
template <class _Tp>
#endif
struct _LIBCPP_TEMPLATE_VIS multiplies
-#if !defined(_LIBCPP_ABI_NO_BINDER_BASES)
- : binary_function<_Tp, _Tp, _Tp>
-#endif
+ : __binary_function<_Tp, _Tp, _Tp>
{
-_LIBCPP_SUPPRESS_DEPRECATED_POP
typedef _Tp __result_type; // used by valarray
-#if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_BINDER_TYPEDEFS)
- _LIBCPP_DEPRECATED_IN_CXX17 typedef _Tp result_type;
- _LIBCPP_DEPRECATED_IN_CXX17 typedef _Tp first_argument_type;
- _LIBCPP_DEPRECATED_IN_CXX17 typedef _Tp second_argument_type;
-#endif
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
_Tp operator()(const _Tp& __x, const _Tp& __y) const
{return __x * __y;}
@@ -134,24 +107,15 @@ struct _LIBCPP_TEMPLATE_VIS multiplies<void>
};
#endif
-_LIBCPP_SUPPRESS_DEPRECATED_PUSH
#if _LIBCPP_STD_VER > 11
template <class _Tp = void>
#else
template <class _Tp>
#endif
struct _LIBCPP_TEMPLATE_VIS divides
-#if !defined(_LIBCPP_ABI_NO_BINDER_BASES)
- : binary_function<_Tp, _Tp, _Tp>
-#endif
+ : __binary_function<_Tp, _Tp, _Tp>
{
-_LIBCPP_SUPPRESS_DEPRECATED_POP
typedef _Tp __result_type; // used by valarray
-#if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_BINDER_TYPEDEFS)
- _LIBCPP_DEPRECATED_IN_CXX17 typedef _Tp result_type;
- _LIBCPP_DEPRECATED_IN_CXX17 typedef _Tp first_argument_type;
- _LIBCPP_DEPRECATED_IN_CXX17 typedef _Tp second_argument_type;
-#endif
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
_Tp operator()(const _Tp& __x, const _Tp& __y) const
{return __x / __y;}
@@ -171,24 +135,15 @@ struct _LIBCPP_TEMPLATE_VIS divides<void>
};
#endif
-_LIBCPP_SUPPRESS_DEPRECATED_PUSH
#if _LIBCPP_STD_VER > 11
template <class _Tp = void>
#else
template <class _Tp>
#endif
struct _LIBCPP_TEMPLATE_VIS modulus
-#if !defined(_LIBCPP_ABI_NO_BINDER_BASES)
- : binary_function<_Tp, _Tp, _Tp>
-#endif
+ : __binary_function<_Tp, _Tp, _Tp>
{
-_LIBCPP_SUPPRESS_DEPRECATED_POP
typedef _Tp __result_type; // used by valarray
-#if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_BINDER_TYPEDEFS)
- _LIBCPP_DEPRECATED_IN_CXX17 typedef _Tp result_type;
- _LIBCPP_DEPRECATED_IN_CXX17 typedef _Tp first_argument_type;
- _LIBCPP_DEPRECATED_IN_CXX17 typedef _Tp second_argument_type;
-#endif
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
_Tp operator()(const _Tp& __x, const _Tp& __y) const
{return __x % __y;}
@@ -208,23 +163,15 @@ struct _LIBCPP_TEMPLATE_VIS modulus<void>
};
#endif
-_LIBCPP_SUPPRESS_DEPRECATED_PUSH
#if _LIBCPP_STD_VER > 11
template <class _Tp = void>
#else
template <class _Tp>
#endif
struct _LIBCPP_TEMPLATE_VIS negate
-#if !defined(_LIBCPP_ABI_NO_BINDER_BASES)
- : unary_function<_Tp, _Tp>
-#endif
+ : __unary_function<_Tp, _Tp>
{
-_LIBCPP_SUPPRESS_DEPRECATED_POP
typedef _Tp __result_type; // used by valarray
-#if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_BINDER_TYPEDEFS)
- _LIBCPP_DEPRECATED_IN_CXX17 typedef _Tp result_type;
- _LIBCPP_DEPRECATED_IN_CXX17 typedef _Tp argument_type;
-#endif
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
_Tp operator()(const _Tp& __x) const
{return -__x;}
@@ -246,24 +193,15 @@ struct _LIBCPP_TEMPLATE_VIS negate<void>
// Bitwise operations
-_LIBCPP_SUPPRESS_DEPRECATED_PUSH
#if _LIBCPP_STD_VER > 11
template <class _Tp = void>
#else
template <class _Tp>
#endif
struct _LIBCPP_TEMPLATE_VIS bit_and
-#if !defined(_LIBCPP_ABI_NO_BINDER_BASES)
- : binary_function<_Tp, _Tp, _Tp>
-#endif
+ : __binary_function<_Tp, _Tp, _Tp>
{
-_LIBCPP_SUPPRESS_DEPRECATED_POP
typedef _Tp __result_type; // used by valarray
-#if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_BINDER_TYPEDEFS)
- _LIBCPP_DEPRECATED_IN_CXX17 typedef _Tp result_type;
- _LIBCPP_DEPRECATED_IN_CXX17 typedef _Tp first_argument_type;
- _LIBCPP_DEPRECATED_IN_CXX17 typedef _Tp second_argument_type;
-#endif
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
_Tp operator()(const _Tp& __x, const _Tp& __y) const
{return __x & __y;}
@@ -284,18 +222,10 @@ struct _LIBCPP_TEMPLATE_VIS bit_and<void>
#endif
#if _LIBCPP_STD_VER > 11
-_LIBCPP_SUPPRESS_DEPRECATED_PUSH
template <class _Tp = void>
struct _LIBCPP_TEMPLATE_VIS bit_not
-#if !defined(_LIBCPP_ABI_NO_BINDER_BASES)
- : unary_function<_Tp, _Tp>
-#endif
+ : __unary_function<_Tp, _Tp>
{
-_LIBCPP_SUPPRESS_DEPRECATED_POP
-#if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_BINDER_TYPEDEFS)
- _LIBCPP_DEPRECATED_IN_CXX17 typedef _Tp result_type;
- _LIBCPP_DEPRECATED_IN_CXX17 typedef _Tp argument_type;
-#endif
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
_Tp operator()(const _Tp& __x) const
{return ~__x;}
@@ -314,24 +244,15 @@ struct _LIBCPP_TEMPLATE_VIS bit_not<void>
};
#endif
-_LIBCPP_SUPPRESS_DEPRECATED_PUSH
#if _LIBCPP_STD_VER > 11
template <class _Tp = void>
#else
template <class _Tp>
#endif
struct _LIBCPP_TEMPLATE_VIS bit_or
-#if !defined(_LIBCPP_ABI_NO_BINDER_BASES)
- : binary_function<_Tp, _Tp, _Tp>
-#endif
+ : __binary_function<_Tp, _Tp, _Tp>
{
-_LIBCPP_SUPPRESS_DEPRECATED_POP
typedef _Tp __result_type; // used by valarray
-#if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_BINDER_TYPEDEFS)
- _LIBCPP_DEPRECATED_IN_CXX17 typedef _Tp result_type;
- _LIBCPP_DEPRECATED_IN_CXX17 typedef _Tp first_argument_type;
- _LIBCPP_DEPRECATED_IN_CXX17 typedef _Tp second_argument_type;
-#endif
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
_Tp operator()(const _Tp& __x, const _Tp& __y) const
{return __x | __y;}
@@ -351,24 +272,15 @@ struct _LIBCPP_TEMPLATE_VIS bit_or<void>
};
#endif
-_LIBCPP_SUPPRESS_DEPRECATED_PUSH
#if _LIBCPP_STD_VER > 11
template <class _Tp = void>
#else
template <class _Tp>
#endif
struct _LIBCPP_TEMPLATE_VIS bit_xor
-#if !defined(_LIBCPP_ABI_NO_BINDER_BASES)
- : binary_function<_Tp, _Tp, _Tp>
-#endif
+ : __binary_function<_Tp, _Tp, _Tp>
{
-_LIBCPP_SUPPRESS_DEPRECATED_POP
typedef _Tp __result_type; // used by valarray
-#if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_BINDER_TYPEDEFS)
- _LIBCPP_DEPRECATED_IN_CXX17 typedef _Tp result_type;
- _LIBCPP_DEPRECATED_IN_CXX17 typedef _Tp first_argument_type;
- _LIBCPP_DEPRECATED_IN_CXX17 typedef _Tp second_argument_type;
-#endif
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
_Tp operator()(const _Tp& __x, const _Tp& __y) const
{return __x ^ __y;}
@@ -390,24 +302,15 @@ struct _LIBCPP_TEMPLATE_VIS bit_xor<void>
// Comparison operations
-_LIBCPP_SUPPRESS_DEPRECATED_PUSH
#if _LIBCPP_STD_VER > 11
template <class _Tp = void>
#else
template <class _Tp>
#endif
struct _LIBCPP_TEMPLATE_VIS equal_to
-#if !defined(_LIBCPP_ABI_NO_BINDER_BASES)
- : binary_function<_Tp, _Tp, bool>
-#endif
+ : __binary_function<_Tp, _Tp, bool>
{
-_LIBCPP_SUPPRESS_DEPRECATED_POP
typedef bool __result_type; // used by valarray
-#if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_BINDER_TYPEDEFS)
- _LIBCPP_DEPRECATED_IN_CXX17 typedef bool result_type;
- _LIBCPP_DEPRECATED_IN_CXX17 typedef _Tp first_argument_type;
- _LIBCPP_DEPRECATED_IN_CXX17 typedef _Tp second_argument_type;
-#endif
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
bool operator()(const _Tp& __x, const _Tp& __y) const
{return __x == __y;}
@@ -427,24 +330,15 @@ struct _LIBCPP_TEMPLATE_VIS equal_to<void>
};
#endif
-_LIBCPP_SUPPRESS_DEPRECATED_PUSH
#if _LIBCPP_STD_VER > 11
template <class _Tp = void>
#else
template <class _Tp>
#endif
struct _LIBCPP_TEMPLATE_VIS not_equal_to
-#if !defined(_LIBCPP_ABI_NO_BINDER_BASES)
- : binary_function<_Tp, _Tp, bool>
-#endif
+ : __binary_function<_Tp, _Tp, bool>
{
-_LIBCPP_SUPPRESS_DEPRECATED_POP
typedef bool __result_type; // used by valarray
-#if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_BINDER_TYPEDEFS)
- _LIBCPP_DEPRECATED_IN_CXX17 typedef bool result_type;
- _LIBCPP_DEPRECATED_IN_CXX17 typedef _Tp first_argument_type;
- _LIBCPP_DEPRECATED_IN_CXX17 typedef _Tp second_argument_type;
-#endif
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
bool operator()(const _Tp& __x, const _Tp& __y) const
{return __x != __y;}
@@ -464,24 +358,15 @@ struct _LIBCPP_TEMPLATE_VIS not_equal_to<void>
};
#endif
-_LIBCPP_SUPPRESS_DEPRECATED_PUSH
#if _LIBCPP_STD_VER > 11
template <class _Tp = void>
#else
template <class _Tp>
#endif
struct _LIBCPP_TEMPLATE_VIS less
-#if !defined(_LIBCPP_ABI_NO_BINDER_BASES)
- : binary_function<_Tp, _Tp, bool>
-#endif
+ : __binary_function<_Tp, _Tp, bool>
{
-_LIBCPP_SUPPRESS_DEPRECATED_POP
typedef bool __result_type; // used by valarray
-#if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_BINDER_TYPEDEFS)
- _LIBCPP_DEPRECATED_IN_CXX17 typedef bool result_type;
- _LIBCPP_DEPRECATED_IN_CXX17 typedef _Tp first_argument_type;
- _LIBCPP_DEPRECATED_IN_CXX17 typedef _Tp second_argument_type;
-#endif
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
bool operator()(const _Tp& __x, const _Tp& __y) const
{return __x < __y;}
@@ -501,24 +386,15 @@ struct _LIBCPP_TEMPLATE_VIS less<void>
};
#endif
-_LIBCPP_SUPPRESS_DEPRECATED_PUSH
#if _LIBCPP_STD_VER > 11
template <class _Tp = void>
#else
template <class _Tp>
#endif
struct _LIBCPP_TEMPLATE_VIS less_equal
-#if !defined(_LIBCPP_ABI_NO_BINDER_BASES)
- : binary_function<_Tp, _Tp, bool>
-#endif
+ : __binary_function<_Tp, _Tp, bool>
{
-_LIBCPP_SUPPRESS_DEPRECATED_POP
typedef bool __result_type; // used by valarray
-#if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_BINDER_TYPEDEFS)
- _LIBCPP_DEPRECATED_IN_CXX17 typedef bool result_type;
- _LIBCPP_DEPRECATED_IN_CXX17 typedef _Tp first_argument_type;
- _LIBCPP_DEPRECATED_IN_CXX17 typedef _Tp second_argument_type;
-#endif
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
bool operator()(const _Tp& __x, const _Tp& __y) const
{return __x <= __y;}
@@ -538,24 +414,15 @@ struct _LIBCPP_TEMPLATE_VIS less_equal<void>
};
#endif
-_LIBCPP_SUPPRESS_DEPRECATED_PUSH
#if _LIBCPP_STD_VER > 11
template <class _Tp = void>
#else
template <class _Tp>
#endif
struct _LIBCPP_TEMPLATE_VIS greater_equal
-#if !defined(_LIBCPP_ABI_NO_BINDER_BASES)
- : binary_function<_Tp, _Tp, bool>
-#endif
+ : __binary_function<_Tp, _Tp, bool>
{
-_LIBCPP_SUPPRESS_DEPRECATED_POP
typedef bool __result_type; // used by valarray
-#if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_BINDER_TYPEDEFS)
- _LIBCPP_DEPRECATED_IN_CXX17 typedef bool result_type;
- _LIBCPP_DEPRECATED_IN_CXX17 typedef _Tp first_argument_type;
- _LIBCPP_DEPRECATED_IN_CXX17 typedef _Tp second_argument_type;
-#endif
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
bool operator()(const _Tp& __x, const _Tp& __y) const
{return __x >= __y;}
@@ -575,24 +442,15 @@ struct _LIBCPP_TEMPLATE_VIS greater_equal<void>
};
#endif
-_LIBCPP_SUPPRESS_DEPRECATED_PUSH
#if _LIBCPP_STD_VER > 11
template <class _Tp = void>
#else
template <class _Tp>
#endif
struct _LIBCPP_TEMPLATE_VIS greater
-#if !defined(_LIBCPP_ABI_NO_BINDER_BASES)
- : binary_function<_Tp, _Tp, bool>
-#endif
+ : __binary_function<_Tp, _Tp, bool>
{
-_LIBCPP_SUPPRESS_DEPRECATED_POP
typedef bool __result_type; // used by valarray
-#if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_BINDER_TYPEDEFS)
- _LIBCPP_DEPRECATED_IN_CXX17 typedef bool result_type;
- _LIBCPP_DEPRECATED_IN_CXX17 typedef _Tp first_argument_type;
- _LIBCPP_DEPRECATED_IN_CXX17 typedef _Tp second_argument_type;
-#endif
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
bool operator()(const _Tp& __x, const _Tp& __y) const
{return __x > __y;}
@@ -614,24 +472,15 @@ struct _LIBCPP_TEMPLATE_VIS greater<void>
// Logical operations
-_LIBCPP_SUPPRESS_DEPRECATED_PUSH
#if _LIBCPP_STD_VER > 11
template <class _Tp = void>
#else
template <class _Tp>
#endif
struct _LIBCPP_TEMPLATE_VIS logical_and
-#if !defined(_LIBCPP_ABI_NO_BINDER_BASES)
- : binary_function<_Tp, _Tp, bool>
-#endif
+ : __binary_function<_Tp, _Tp, bool>
{
-_LIBCPP_SUPPRESS_DEPRECATED_POP
typedef bool __result_type; // used by valarray
-#if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_BINDER_TYPEDEFS)
- _LIBCPP_DEPRECATED_IN_CXX17 typedef bool result_type;
- _LIBCPP_DEPRECATED_IN_CXX17 typedef _Tp first_argument_type;
- _LIBCPP_DEPRECATED_IN_CXX17 typedef _Tp second_argument_type;
-#endif
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
bool operator()(const _Tp& __x, const _Tp& __y) const
{return __x && __y;}
@@ -651,23 +500,15 @@ struct _LIBCPP_TEMPLATE_VIS logical_and<void>
};
#endif
-_LIBCPP_SUPPRESS_DEPRECATED_PUSH
#if _LIBCPP_STD_VER > 11
template <class _Tp = void>
#else
template <class _Tp>
#endif
struct _LIBCPP_TEMPLATE_VIS logical_not
-#if !defined(_LIBCPP_ABI_NO_BINDER_BASES)
- : unary_function<_Tp, bool>
-#endif
+ : __unary_function<_Tp, bool>
{
-_LIBCPP_SUPPRESS_DEPRECATED_POP
typedef bool __result_type; // used by valarray
-#if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_BINDER_TYPEDEFS)
- _LIBCPP_DEPRECATED_IN_CXX17 typedef bool result_type;
- _LIBCPP_DEPRECATED_IN_CXX17 typedef _Tp argument_type;
-#endif
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
bool operator()(const _Tp& __x) const
{return !__x;}
@@ -687,24 +528,15 @@ struct _LIBCPP_TEMPLATE_VIS logical_not<void>
};
#endif
-_LIBCPP_SUPPRESS_DEPRECATED_PUSH
#if _LIBCPP_STD_VER > 11
template <class _Tp = void>
#else
template <class _Tp>
#endif
struct _LIBCPP_TEMPLATE_VIS logical_or
-#if !defined(_LIBCPP_ABI_NO_BINDER_BASES)
- : binary_function<_Tp, _Tp, bool>
-#endif
+ : __binary_function<_Tp, _Tp, bool>
{
-_LIBCPP_SUPPRESS_DEPRECATED_POP
typedef bool __result_type; // used by valarray
-#if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_BINDER_TYPEDEFS)
- _LIBCPP_DEPRECATED_IN_CXX17 typedef bool result_type;
- _LIBCPP_DEPRECATED_IN_CXX17 typedef _Tp first_argument_type;
- _LIBCPP_DEPRECATED_IN_CXX17 typedef _Tp second_argument_type;
-#endif
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
bool operator()(const _Tp& __x, const _Tp& __y) const
{return __x || __y;}
diff --git a/libcxx/include/__functional/perfect_forward.h b/libcxx/include/__functional/perfect_forward.h
index 308b304a76dc..9ffea1a8c75d 100644
--- a/libcxx/include/__functional/perfect_forward.h
+++ b/libcxx/include/__functional/perfect_forward.h
@@ -18,70 +18,69 @@
#include <type_traits>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-#pragma GCC system_header
+# pragma GCC system_header
#endif
_LIBCPP_BEGIN_NAMESPACE_STD
#if _LIBCPP_STD_VER > 14
-template <class _Op, class _Indices, class ..._Bound>
+template <class _Op, class _Indices, class... _BoundArgs>
struct __perfect_forward_impl;
-template <class _Op, size_t ..._Idx, class ..._Bound>
-struct __perfect_forward_impl<_Op, index_sequence<_Idx...>, _Bound...> {
+template <class _Op, size_t... _Idx, class... _BoundArgs>
+struct __perfect_forward_impl<_Op, index_sequence<_Idx...>, _BoundArgs...> {
private:
- tuple<_Bound...> __bound_;
+ tuple<_BoundArgs...> __bound_args_;
public:
- template <class ..._BoundArgs, class = enable_if_t<
- is_constructible_v<tuple<_Bound...>, _BoundArgs&&...>
- >>
- explicit constexpr __perfect_forward_impl(_BoundArgs&& ...__bound)
- : __bound_(_VSTD::forward<_BoundArgs>(__bound)...)
- { }
+ template <class... _Args, class = enable_if_t<
+ is_constructible_v<tuple<_BoundArgs...>, _Args&&...>
+ >>
+ explicit constexpr __perfect_forward_impl(_Args&&... __bound_args)
+ : __bound_args_(_VSTD::forward<_Args>(__bound_args)...) {}
- __perfect_forward_impl(__perfect_forward_impl const&) = default;
- __perfect_forward_impl(__perfect_forward_impl&&) = default;
+ __perfect_forward_impl(__perfect_forward_impl const&) = default;
+ __perfect_forward_impl(__perfect_forward_impl&&) = default;
- __perfect_forward_impl& operator=(__perfect_forward_impl const&) = default;
- __perfect_forward_impl& operator=(__perfect_forward_impl&&) = default;
+ __perfect_forward_impl& operator=(__perfect_forward_impl const&) = default;
+ __perfect_forward_impl& operator=(__perfect_forward_impl&&) = default;
- template <class ..._Args, class = enable_if_t<is_invocable_v<_Op, _Bound&..., _Args...>>>
- _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Args&&... __args) &
- noexcept(noexcept(_Op()(_VSTD::get<_Idx>(__bound_)..., _VSTD::forward<_Args>(__args)...)))
- -> decltype( _Op()(_VSTD::get<_Idx>(__bound_)..., _VSTD::forward<_Args>(__args)...))
- { return _Op()(_VSTD::get<_Idx>(__bound_)..., _VSTD::forward<_Args>(__args)...); }
+ template <class... _Args, class = enable_if_t<is_invocable_v<_Op, _BoundArgs&..., _Args...>>>
+ _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Args&&... __args) &
+ noexcept(noexcept(_Op()(_VSTD::get<_Idx>(__bound_args_)..., _VSTD::forward<_Args>(__args)...)))
+ -> decltype( _Op()(_VSTD::get<_Idx>(__bound_args_)..., _VSTD::forward<_Args>(__args)...))
+ { return _Op()(_VSTD::get<_Idx>(__bound_args_)..., _VSTD::forward<_Args>(__args)...); }
- template <class ..._Args, class = enable_if_t<!is_invocable_v<_Op, _Bound&..., _Args...>>>
- auto operator()(_Args&&...) & = delete;
+ template <class... _Args, class = enable_if_t<!is_invocable_v<_Op, _BoundArgs&..., _Args...>>>
+ auto operator()(_Args&&...) & = delete;
- template <class ..._Args, class = enable_if_t<is_invocable_v<_Op, _Bound const&..., _Args...>>>
- _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Args&&... __args) const&
- noexcept(noexcept(_Op()(_VSTD::get<_Idx>(__bound_)..., _VSTD::forward<_Args>(__args)...)))
- -> decltype( _Op()(_VSTD::get<_Idx>(__bound_)..., _VSTD::forward<_Args>(__args)...))
- { return _Op()(_VSTD::get<_Idx>(__bound_)..., _VSTD::forward<_Args>(__args)...); }
+ template <class... _Args, class = enable_if_t<is_invocable_v<_Op, _BoundArgs const&..., _Args...>>>
+ _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Args&&... __args) const&
+ noexcept(noexcept(_Op()(_VSTD::get<_Idx>(__bound_args_)..., _VSTD::forward<_Args>(__args)...)))
+ -> decltype( _Op()(_VSTD::get<_Idx>(__bound_args_)..., _VSTD::forward<_Args>(__args)...))
+ { return _Op()(_VSTD::get<_Idx>(__bound_args_)..., _VSTD::forward<_Args>(__args)...); }
- template <class ..._Args, class = enable_if_t<!is_invocable_v<_Op, _Bound const&..., _Args...>>>
- auto operator()(_Args&&...) const& = delete;
+ template <class... _Args, class = enable_if_t<!is_invocable_v<_Op, _BoundArgs const&..., _Args...>>>
+ auto operator()(_Args&&...) const& = delete;
- template <class ..._Args, class = enable_if_t<is_invocable_v<_Op, _Bound..., _Args...>>>
- _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Args&&... __args) &&
- noexcept(noexcept(_Op()(_VSTD::get<_Idx>(_VSTD::move(__bound_))..., _VSTD::forward<_Args>(__args)...)))
- -> decltype( _Op()(_VSTD::get<_Idx>(_VSTD::move(__bound_))..., _VSTD::forward<_Args>(__args)...))
- { return _Op()(_VSTD::get<_Idx>(_VSTD::move(__bound_))..., _VSTD::forward<_Args>(__args)...); }
+ template <class... _Args, class = enable_if_t<is_invocable_v<_Op, _BoundArgs..., _Args...>>>
+ _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Args&&... __args) &&
+ noexcept(noexcept(_Op()(_VSTD::get<_Idx>(_VSTD::move(__bound_args_))..., _VSTD::forward<_Args>(__args)...)))
+ -> decltype( _Op()(_VSTD::get<_Idx>(_VSTD::move(__bound_args_))..., _VSTD::forward<_Args>(__args)...))
+ { return _Op()(_VSTD::get<_Idx>(_VSTD::move(__bound_args_))..., _VSTD::forward<_Args>(__args)...); }
- template <class ..._Args, class = enable_if_t<!is_invocable_v<_Op, _Bound..., _Args...>>>
- auto operator()(_Args&&...) && = delete;
+ template <class... _Args, class = enable_if_t<!is_invocable_v<_Op, _BoundArgs..., _Args...>>>
+ auto operator()(_Args&&...) && = delete;
- template <class ..._Args, class = enable_if_t<is_invocable_v<_Op, _Bound const..., _Args...>>>
- _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Args&&... __args) const&&
- noexcept(noexcept(_Op()(_VSTD::get<_Idx>(_VSTD::move(__bound_))..., _VSTD::forward<_Args>(__args)...)))
- -> decltype( _Op()(_VSTD::get<_Idx>(_VSTD::move(__bound_))..., _VSTD::forward<_Args>(__args)...))
- { return _Op()(_VSTD::get<_Idx>(_VSTD::move(__bound_))..., _VSTD::forward<_Args>(__args)...); }
+ template <class... _Args, class = enable_if_t<is_invocable_v<_Op, _BoundArgs const..., _Args...>>>
+ _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Args&&... __args) const&&
+ noexcept(noexcept(_Op()(_VSTD::get<_Idx>(_VSTD::move(__bound_args_))..., _VSTD::forward<_Args>(__args)...)))
+ -> decltype( _Op()(_VSTD::get<_Idx>(_VSTD::move(__bound_args_))..., _VSTD::forward<_Args>(__args)...))
+ { return _Op()(_VSTD::get<_Idx>(_VSTD::move(__bound_args_))..., _VSTD::forward<_Args>(__args)...); }
- template <class ..._Args, class = enable_if_t<!is_invocable_v<_Op, _Bound const..., _Args...>>>
- auto operator()(_Args&&...) const&& = delete;
+ template <class... _Args, class = enable_if_t<!is_invocable_v<_Op, _BoundArgs const..., _Args...>>>
+ auto operator()(_Args&&...) const&& = delete;
};
// __perfect_forward implements a perfect-forwarding call wrapper as explained in [func.require].
diff --git a/libcxx/include/__functional/pointer_to_binary_function.h b/libcxx/include/__functional/pointer_to_binary_function.h
index d4a6c1674aec..b2676c58f885 100644
--- a/libcxx/include/__functional/pointer_to_binary_function.h
+++ b/libcxx/include/__functional/pointer_to_binary_function.h
@@ -14,7 +14,7 @@
#include <__functional/binary_function.h>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-#pragma GCC system_header
+# pragma GCC system_header
#endif
_LIBCPP_BEGIN_NAMESPACE_STD
@@ -23,7 +23,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD
template <class _Arg1, class _Arg2, class _Result>
class _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX11 pointer_to_binary_function
- : public binary_function<_Arg1, _Arg2, _Result>
+ : public __binary_function<_Arg1, _Arg2, _Result>
{
_Result (*__f_)(_Arg1, _Arg2);
public:
diff --git a/libcxx/include/__functional/pointer_to_unary_function.h b/libcxx/include/__functional/pointer_to_unary_function.h
index 0ac4561cc305..77d07adf20f0 100644
--- a/libcxx/include/__functional/pointer_to_unary_function.h
+++ b/libcxx/include/__functional/pointer_to_unary_function.h
@@ -14,7 +14,7 @@
#include <__functional/unary_function.h>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-#pragma GCC system_header
+# pragma GCC system_header
#endif
_LIBCPP_BEGIN_NAMESPACE_STD
@@ -23,7 +23,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD
template <class _Arg, class _Result>
class _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX11 pointer_to_unary_function
- : public unary_function<_Arg, _Result>
+ : public __unary_function<_Arg, _Result>
{
_Result (*__f_)(_Arg);
public:
diff --git a/libcxx/include/__functional/ranges_operations.h b/libcxx/include/__functional/ranges_operations.h
index 8b06240e46a7..3f63a86731e0 100644
--- a/libcxx/include/__functional/ranges_operations.h
+++ b/libcxx/include/__functional/ranges_operations.h
@@ -11,16 +11,17 @@
#define _LIBCPP___FUNCTIONAL_RANGES_OPERATIONS_H
#include <__config>
+#include <__utility/forward.h>
#include <concepts>
-#include <utility>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-#pragma GCC system_header
+# pragma GCC system_header
#endif
_LIBCPP_BEGIN_NAMESPACE_STD
-#if !defined(_LIBCPP_HAS_NO_CONCEPTS)
+#if _LIBCPP_STD_VER > 17
+
namespace ranges {
struct equal_to {
@@ -90,7 +91,8 @@ struct greater_equal {
};
} // namespace ranges
-#endif // !defined(_LIBCPP_HAS_NO_CONCEPTS)
+
+#endif // _LIBCPP_STD_VER > 17
_LIBCPP_END_NAMESPACE_STD
diff --git a/libcxx/include/__functional/reference_wrapper.h b/libcxx/include/__functional/reference_wrapper.h
index d04d51568beb..8245e3a04734 100644
--- a/libcxx/include/__functional/reference_wrapper.h
+++ b/libcxx/include/__functional/reference_wrapper.h
@@ -17,16 +17,13 @@
#include <type_traits>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-#pragma GCC system_header
+# pragma GCC system_header
#endif
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _Tp>
-class _LIBCPP_TEMPLATE_VIS reference_wrapper
-#if _LIBCPP_STD_VER <= 17 || !defined(_LIBCPP_ABI_NO_BINDER_BASES)
- : public __weak_result_type<_Tp>
-#endif
+class _LIBCPP_TEMPLATE_VIS reference_wrapper : public __weak_result_type<_Tp>
{
public:
// types
@@ -51,120 +48,13 @@ public:
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
type& get() const _NOEXCEPT {return *__f_;}
-#ifndef _LIBCPP_CXX03_LANG
// invoke
template <class... _ArgTypes>
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
typename __invoke_of<type&, _ArgTypes...>::type
operator() (_ArgTypes&&... __args) const {
- return _VSTD::__invoke(get(), _VSTD::forward<_ArgTypes>(__args)...);
- }
-#else
-
- _LIBCPP_INLINE_VISIBILITY
- typename __invoke_return<type>::type
- operator() () const {
- return _VSTD::__invoke(get());
- }
-
- template <class _A0>
- _LIBCPP_INLINE_VISIBILITY
- typename __invoke_return0<type, _A0>::type
- operator() (_A0& __a0) const {
- return _VSTD::__invoke(get(), __a0);
- }
-
- template <class _A0>
- _LIBCPP_INLINE_VISIBILITY
- typename __invoke_return0<type, _A0 const>::type
- operator() (_A0 const& __a0) const {
- return _VSTD::__invoke(get(), __a0);
- }
-
- template <class _A0, class _A1>
- _LIBCPP_INLINE_VISIBILITY
- typename __invoke_return1<type, _A0, _A1>::type
- operator() (_A0& __a0, _A1& __a1) const {
- return _VSTD::__invoke(get(), __a0, __a1);
- }
-
- template <class _A0, class _A1>
- _LIBCPP_INLINE_VISIBILITY
- typename __invoke_return1<type, _A0 const, _A1>::type
- operator() (_A0 const& __a0, _A1& __a1) const {
- return _VSTD::__invoke(get(), __a0, __a1);
- }
-
- template <class _A0, class _A1>
- _LIBCPP_INLINE_VISIBILITY
- typename __invoke_return1<type, _A0, _A1 const>::type
- operator() (_A0& __a0, _A1 const& __a1) const {
- return _VSTD::__invoke(get(), __a0, __a1);
- }
-
- template <class _A0, class _A1>
- _LIBCPP_INLINE_VISIBILITY
- typename __invoke_return1<type, _A0 const, _A1 const>::type
- operator() (_A0 const& __a0, _A1 const& __a1) const {
- return _VSTD::__invoke(get(), __a0, __a1);
- }
-
- template <class _A0, class _A1, class _A2>
- _LIBCPP_INLINE_VISIBILITY
- typename __invoke_return2<type, _A0, _A1, _A2>::type
- operator() (_A0& __a0, _A1& __a1, _A2& __a2) const {
- return _VSTD::__invoke(get(), __a0, __a1, __a2);
- }
-
- template <class _A0, class _A1, class _A2>
- _LIBCPP_INLINE_VISIBILITY
- typename __invoke_return2<type, _A0 const, _A1, _A2>::type
- operator() (_A0 const& __a0, _A1& __a1, _A2& __a2) const {
- return _VSTD::__invoke(get(), __a0, __a1, __a2);
- }
-
- template <class _A0, class _A1, class _A2>
- _LIBCPP_INLINE_VISIBILITY
- typename __invoke_return2<type, _A0, _A1 const, _A2>::type
- operator() (_A0& __a0, _A1 const& __a1, _A2& __a2) const {
- return _VSTD::__invoke(get(), __a0, __a1, __a2);
- }
-
- template <class _A0, class _A1, class _A2>
- _LIBCPP_INLINE_VISIBILITY
- typename __invoke_return2<type, _A0, _A1, _A2 const>::type
- operator() (_A0& __a0, _A1& __a1, _A2 const& __a2) const {
- return _VSTD::__invoke(get(), __a0, __a1, __a2);
- }
-
- template <class _A0, class _A1, class _A2>
- _LIBCPP_INLINE_VISIBILITY
- typename __invoke_return2<type, _A0 const, _A1 const, _A2>::type
- operator() (_A0 const& __a0, _A1 const& __a1, _A2& __a2) const {
- return _VSTD::__invoke(get(), __a0, __a1, __a2);
- }
-
- template <class _A0, class _A1, class _A2>
- _LIBCPP_INLINE_VISIBILITY
- typename __invoke_return2<type, _A0 const, _A1, _A2 const>::type
- operator() (_A0 const& __a0, _A1& __a1, _A2 const& __a2) const {
- return _VSTD::__invoke(get(), __a0, __a1, __a2);
- }
-
- template <class _A0, class _A1, class _A2>
- _LIBCPP_INLINE_VISIBILITY
- typename __invoke_return2<type, _A0, _A1 const, _A2 const>::type
- operator() (_A0& __a0, _A1 const& __a1, _A2 const& __a2) const {
- return _VSTD::__invoke(get(), __a0, __a1, __a2);
- }
-
- template <class _A0, class _A1, class _A2>
- _LIBCPP_INLINE_VISIBILITY
- typename __invoke_return2<type, _A0 const, _A1 const, _A2 const>::type
- operator() (_A0 const& __a0, _A1 const& __a1, _A2 const& __a2) const {
- return _VSTD::__invoke(get(), __a0, __a1, __a2);
+ return std::__invoke(get(), std::forward<_ArgTypes>(__args)...);
}
-#endif // _LIBCPP_CXX03_LANG
};
#if _LIBCPP_STD_VER > 14
diff --git a/libcxx/include/__functional/unary_function.h b/libcxx/include/__functional/unary_function.h
index 499f9964676d..f07cac175a99 100644
--- a/libcxx/include/__functional/unary_function.h
+++ b/libcxx/include/__functional/unary_function.h
@@ -12,18 +12,40 @@
#include <__config>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-#pragma GCC system_header
+# pragma GCC system_header
#endif
_LIBCPP_BEGIN_NAMESPACE_STD
+#if _LIBCPP_STD_VER <= 14 || defined(_LIBCPP_ENABLE_CXX17_REMOVED_UNARY_BINARY_FUNCTION)
+
template <class _Arg, class _Result>
-struct _LIBCPP_TEMPLATE_VIS unary_function
+struct _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX11 unary_function
{
typedef _Arg argument_type;
typedef _Result result_type;
};
+#endif // _LIBCPP_STD_VER <= 14
+
+template <class _Arg, class _Result> struct __unary_function_keep_layout_base {
+#if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_BINDER_TYPEDEFS)
+ using argument_type _LIBCPP_DEPRECATED_IN_CXX17 = _Arg;
+ using result_type _LIBCPP_DEPRECATED_IN_CXX17 = _Result;
+#endif
+};
+
+#if _LIBCPP_STD_VER <= 14 || defined(_LIBCPP_ENABLE_CXX17_REMOVED_UNARY_BINARY_FUNCTION)
+_LIBCPP_DIAGNOSTIC_PUSH
+_LIBCPP_CLANG_DIAGNOSTIC_IGNORED("-Wdeprecated-declarations")
+template <class _Arg, class _Result>
+using __unary_function = unary_function<_Arg, _Result>;
+_LIBCPP_DIAGNOSTIC_POP
+#else
+template <class _Arg, class _Result>
+using __unary_function = __unary_function_keep_layout_base<_Arg, _Result>;
+#endif
+
_LIBCPP_END_NAMESPACE_STD
#endif // _LIBCPP___FUNCTIONAL_UNARY_FUNCTION_H
diff --git a/libcxx/include/__functional/unary_negate.h b/libcxx/include/__functional/unary_negate.h
index 71257cf40c0d..7f081903fe44 100644
--- a/libcxx/include/__functional/unary_negate.h
+++ b/libcxx/include/__functional/unary_negate.h
@@ -14,7 +14,7 @@
#include <__functional/unary_function.h>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-#pragma GCC system_header
+# pragma GCC system_header
#endif
_LIBCPP_BEGIN_NAMESPACE_STD
@@ -23,7 +23,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD
template <class _Predicate>
class _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX17 unary_negate
- : public unary_function<typename _Predicate::argument_type, bool>
+ : public __unary_function<typename _Predicate::argument_type, bool>
{
_Predicate __pred_;
public:
diff --git a/libcxx/include/__functional/unwrap_ref.h b/libcxx/include/__functional/unwrap_ref.h
index dc309add90df..f7207934e1b4 100644
--- a/libcxx/include/__functional/unwrap_ref.h
+++ b/libcxx/include/__functional/unwrap_ref.h
@@ -12,7 +12,7 @@
#include <__config>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-#pragma GCC system_header
+# pragma GCC system_header
#endif
_LIBCPP_BEGIN_NAMESPACE_STD
diff --git a/libcxx/include/__functional/weak_result_type.h b/libcxx/include/__functional/weak_result_type.h
index 32b1e0b1c6c4..96d8cf7146b1 100644
--- a/libcxx/include/__functional/weak_result_type.h
+++ b/libcxx/include/__functional/weak_result_type.h
@@ -16,7 +16,7 @@
#include <type_traits>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-#pragma GCC system_header
+# pragma GCC system_header
#endif
_LIBCPP_BEGIN_NAMESPACE_STD
@@ -25,11 +25,10 @@ template <class _Tp>
struct __has_result_type
{
private:
- struct __two {char __lx; char __lxx;};
- template <class _Up> static __two __test(...);
- template <class _Up> static char __test(typename _Up::result_type* = 0);
+ template <class _Up> static false_type __test(...);
+ template <class _Up> static true_type __test(typename _Up::result_type* = 0);
public:
- static const bool value = sizeof(__test<_Tp>(0)) == 1;
+ static const bool value = decltype(__test<_Tp>(0))::value;
};
// __weak_result_type
@@ -41,8 +40,9 @@ private:
struct __two {char __lx; char __lxx;};
static __two __test(...);
template <class _Ap, class _Rp>
- static unary_function<_Ap, _Rp>
- __test(const volatile unary_function<_Ap, _Rp>*);
+ static __unary_function<_Ap, _Rp>
+ __test(const volatile __unary_function<_Ap, _Rp>*);
+
public:
static const bool value = !is_same<decltype(__test((_Tp*)0)), __two>::value;
typedef decltype(__test((_Tp*)0)) type;
@@ -55,8 +55,9 @@ private:
struct __two {char __lx; char __lxx;};
static __two __test(...);
template <class _A1, class _A2, class _Rp>
- static binary_function<_A1, _A2, _Rp>
- __test(const volatile binary_function<_A1, _A2, _Rp>*);
+ static __binary_function<_A1, _A2, _Rp>
+ __test(const volatile __binary_function<_A1, _A2, _Rp>*);
+
public:
static const bool value = !is_same<decltype(__test((_Tp*)0)), __two>::value;
typedef decltype(__test((_Tp*)0)) type;
@@ -89,7 +90,9 @@ struct __weak_result_type_imp // bool is true
: public __maybe_derive_from_unary_function<_Tp>,
public __maybe_derive_from_binary_function<_Tp>
{
- typedef _LIBCPP_NODEBUG typename _Tp::result_type result_type;
+#if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_BINDER_TYPEDEFS)
+ using result_type _LIBCPP_NODEBUG _LIBCPP_DEPRECATED_IN_CXX17 = typename _Tp::result_type;
+#endif
};
template <class _Tp>
@@ -110,62 +113,68 @@ struct __weak_result_type
template <class _Rp>
struct __weak_result_type<_Rp ()>
{
- typedef _LIBCPP_NODEBUG _Rp result_type;
+#if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_BINDER_TYPEDEFS)
+ using result_type _LIBCPP_NODEBUG _LIBCPP_DEPRECATED_IN_CXX17 = _Rp;
+#endif
};
template <class _Rp>
struct __weak_result_type<_Rp (&)()>
{
- typedef _LIBCPP_NODEBUG _Rp result_type;
+#if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_BINDER_TYPEDEFS)
+ using result_type _LIBCPP_NODEBUG _LIBCPP_DEPRECATED_IN_CXX17 = _Rp;
+#endif
};
template <class _Rp>
struct __weak_result_type<_Rp (*)()>
{
- typedef _LIBCPP_NODEBUG _Rp result_type;
+#if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_BINDER_TYPEDEFS)
+ using result_type _LIBCPP_NODEBUG _LIBCPP_DEPRECATED_IN_CXX17 = _Rp;
+#endif
};
// 1 argument case
template <class _Rp, class _A1>
struct __weak_result_type<_Rp (_A1)>
- : public unary_function<_A1, _Rp>
+ : public __unary_function<_A1, _Rp>
{
};
template <class _Rp, class _A1>
struct __weak_result_type<_Rp (&)(_A1)>
- : public unary_function<_A1, _Rp>
+ : public __unary_function<_A1, _Rp>
{
};
template <class _Rp, class _A1>
struct __weak_result_type<_Rp (*)(_A1)>
- : public unary_function<_A1, _Rp>
+ : public __unary_function<_A1, _Rp>
{
};
template <class _Rp, class _Cp>
struct __weak_result_type<_Rp (_Cp::*)()>
- : public unary_function<_Cp*, _Rp>
+ : public __unary_function<_Cp*, _Rp>
{
};
template <class _Rp, class _Cp>
struct __weak_result_type<_Rp (_Cp::*)() const>
- : public unary_function<const _Cp*, _Rp>
+ : public __unary_function<const _Cp*, _Rp>
{
};
template <class _Rp, class _Cp>
struct __weak_result_type<_Rp (_Cp::*)() volatile>
- : public unary_function<volatile _Cp*, _Rp>
+ : public __unary_function<volatile _Cp*, _Rp>
{
};
template <class _Rp, class _Cp>
struct __weak_result_type<_Rp (_Cp::*)() const volatile>
- : public unary_function<const volatile _Cp*, _Rp>
+ : public __unary_function<const volatile _Cp*, _Rp>
{
};
@@ -173,90 +182,102 @@ struct __weak_result_type<_Rp (_Cp::*)() const volatile>
template <class _Rp, class _A1, class _A2>
struct __weak_result_type<_Rp (_A1, _A2)>
- : public binary_function<_A1, _A2, _Rp>
+ : public __binary_function<_A1, _A2, _Rp>
{
};
template <class _Rp, class _A1, class _A2>
struct __weak_result_type<_Rp (*)(_A1, _A2)>
- : public binary_function<_A1, _A2, _Rp>
+ : public __binary_function<_A1, _A2, _Rp>
{
};
template <class _Rp, class _A1, class _A2>
struct __weak_result_type<_Rp (&)(_A1, _A2)>
- : public binary_function<_A1, _A2, _Rp>
+ : public __binary_function<_A1, _A2, _Rp>
{
};
template <class _Rp, class _Cp, class _A1>
struct __weak_result_type<_Rp (_Cp::*)(_A1)>
- : public binary_function<_Cp*, _A1, _Rp>
+ : public __binary_function<_Cp*, _A1, _Rp>
{
};
template <class _Rp, class _Cp, class _A1>
struct __weak_result_type<_Rp (_Cp::*)(_A1) const>
- : public binary_function<const _Cp*, _A1, _Rp>
+ : public __binary_function<const _Cp*, _A1, _Rp>
{
};
template <class _Rp, class _Cp, class _A1>
struct __weak_result_type<_Rp (_Cp::*)(_A1) volatile>
- : public binary_function<volatile _Cp*, _A1, _Rp>
+ : public __binary_function<volatile _Cp*, _A1, _Rp>
{
};
template <class _Rp, class _Cp, class _A1>
struct __weak_result_type<_Rp (_Cp::*)(_A1) const volatile>
- : public binary_function<const volatile _Cp*, _A1, _Rp>
+ : public __binary_function<const volatile _Cp*, _A1, _Rp>
{
};
-
-#ifndef _LIBCPP_CXX03_LANG
// 3 or more arguments
template <class _Rp, class _A1, class _A2, class _A3, class ..._A4>
struct __weak_result_type<_Rp (_A1, _A2, _A3, _A4...)>
{
- typedef _Rp result_type;
+#if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_BINDER_TYPEDEFS)
+ using result_type _LIBCPP_NODEBUG _LIBCPP_DEPRECATED_IN_CXX17 = _Rp;
+#endif
};
template <class _Rp, class _A1, class _A2, class _A3, class ..._A4>
struct __weak_result_type<_Rp (&)(_A1, _A2, _A3, _A4...)>
{
- typedef _Rp result_type;
+#if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_BINDER_TYPEDEFS)
+ using result_type _LIBCPP_NODEBUG _LIBCPP_DEPRECATED_IN_CXX17 = _Rp;
+#endif
};
template <class _Rp, class _A1, class _A2, class _A3, class ..._A4>
struct __weak_result_type<_Rp (*)(_A1, _A2, _A3, _A4...)>
{
- typedef _Rp result_type;
+#if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_BINDER_TYPEDEFS)
+ using result_type _LIBCPP_NODEBUG _LIBCPP_DEPRECATED_IN_CXX17 = _Rp;
+#endif
};
template <class _Rp, class _Cp, class _A1, class _A2, class ..._A3>
struct __weak_result_type<_Rp (_Cp::*)(_A1, _A2, _A3...)>
{
- typedef _Rp result_type;
+#if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_BINDER_TYPEDEFS)
+ using result_type _LIBCPP_NODEBUG _LIBCPP_DEPRECATED_IN_CXX17 = _Rp;
+#endif
};
template <class _Rp, class _Cp, class _A1, class _A2, class ..._A3>
struct __weak_result_type<_Rp (_Cp::*)(_A1, _A2, _A3...) const>
{
- typedef _Rp result_type;
+#if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_BINDER_TYPEDEFS)
+ using result_type _LIBCPP_NODEBUG _LIBCPP_DEPRECATED_IN_CXX17 = _Rp;
+#endif
};
template <class _Rp, class _Cp, class _A1, class _A2, class ..._A3>
struct __weak_result_type<_Rp (_Cp::*)(_A1, _A2, _A3...) volatile>
{
- typedef _Rp result_type;
+#if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_BINDER_TYPEDEFS)
+ using result_type _LIBCPP_NODEBUG _LIBCPP_DEPRECATED_IN_CXX17 = _Rp;
+#endif
};
template <class _Rp, class _Cp, class _A1, class _A2, class ..._A3>
struct __weak_result_type<_Rp (_Cp::*)(_A1, _A2, _A3...) const volatile>
{
- typedef _Rp result_type;
+#if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_BINDER_TYPEDEFS)
+ using result_type _LIBCPP_NODEBUG _LIBCPP_DEPRECATED_IN_CXX17 = _Rp;
+#endif
};
template <class _Tp, class ..._Args>
@@ -265,217 +286,6 @@ struct __invoke_return
typedef decltype(_VSTD::__invoke(declval<_Tp>(), declval<_Args>()...)) type;
};
-#else // defined(_LIBCPP_CXX03_LANG)
-
-template <class _Ret, class _T1, bool _IsFunc, bool _IsBase>
-struct __enable_invoke_imp;
-
-template <class _Ret, class _T1>
-struct __enable_invoke_imp<_Ret, _T1, true, true> {
- typedef _Ret _Bullet1;
- typedef _Bullet1 type;
-};
-
-template <class _Ret, class _T1>
-struct __enable_invoke_imp<_Ret, _T1, true, false> {
- typedef _Ret _Bullet2;
- typedef _Bullet2 type;
-};
-
-template <class _Ret, class _T1>
-struct __enable_invoke_imp<_Ret, _T1, false, true> {
- typedef typename add_lvalue_reference<
- typename __apply_cv<_T1, _Ret>::type
- >::type _Bullet3;
- typedef _Bullet3 type;
-};
-
-template <class _Ret, class _T1>
-struct __enable_invoke_imp<_Ret, _T1, false, false> {
- typedef typename add_lvalue_reference<
- typename __apply_cv<decltype(*declval<_T1>()), _Ret>::type
- >::type _Bullet4;
- typedef _Bullet4 type;
-};
-
-template <class _Ret, class _T1>
-struct __enable_invoke_imp<_Ret, _T1*, false, false> {
- typedef typename add_lvalue_reference<
- typename __apply_cv<_T1, _Ret>::type
- >::type _Bullet4;
- typedef _Bullet4 type;
-};
-
-template <class _Fn, class _T1,
- class _Traits = __member_pointer_traits<_Fn>,
- class _Ret = typename _Traits::_ReturnType,
- class _Class = typename _Traits::_ClassType>
-struct __enable_invoke : __enable_invoke_imp<
- _Ret, _T1,
- is_member_function_pointer<_Fn>::value,
- is_base_of<_Class, typename remove_reference<_T1>::type>::value>
-{
-};
-
-__nat __invoke(__any, ...);
-
-// first bullet
-
-template <class _Fn, class _T1>
-inline _LIBCPP_INLINE_VISIBILITY
-typename __enable_invoke<_Fn, _T1>::_Bullet1
-__invoke(_Fn __f, _T1& __t1) {
- return (__t1.*__f)();
-}
-
-template <class _Fn, class _T1, class _A0>
-inline _LIBCPP_INLINE_VISIBILITY
-typename __enable_invoke<_Fn, _T1>::_Bullet1
-__invoke(_Fn __f, _T1& __t1, _A0& __a0) {
- return (__t1.*__f)(__a0);
-}
-
-template <class _Fn, class _T1, class _A0, class _A1>
-inline _LIBCPP_INLINE_VISIBILITY
-typename __enable_invoke<_Fn, _T1>::_Bullet1
-__invoke(_Fn __f, _T1& __t1, _A0& __a0, _A1& __a1) {
- return (__t1.*__f)(__a0, __a1);
-}
-
-template <class _Fn, class _T1, class _A0, class _A1, class _A2>
-inline _LIBCPP_INLINE_VISIBILITY
-typename __enable_invoke<_Fn, _T1>::_Bullet1
-__invoke(_Fn __f, _T1& __t1, _A0& __a0, _A1& __a1, _A2& __a2) {
- return (__t1.*__f)(__a0, __a1, __a2);
-}
-
-template <class _Fn, class _T1>
-inline _LIBCPP_INLINE_VISIBILITY
-typename __enable_invoke<_Fn, _T1>::_Bullet2
-__invoke(_Fn __f, _T1& __t1) {
- return ((*__t1).*__f)();
-}
-
-template <class _Fn, class _T1, class _A0>
-inline _LIBCPP_INLINE_VISIBILITY
-typename __enable_invoke<_Fn, _T1>::_Bullet2
-__invoke(_Fn __f, _T1& __t1, _A0& __a0) {
- return ((*__t1).*__f)(__a0);
-}
-
-template <class _Fn, class _T1, class _A0, class _A1>
-inline _LIBCPP_INLINE_VISIBILITY
-typename __enable_invoke<_Fn, _T1>::_Bullet2
-__invoke(_Fn __f, _T1& __t1, _A0& __a0, _A1& __a1) {
- return ((*__t1).*__f)(__a0, __a1);
-}
-
-template <class _Fn, class _T1, class _A0, class _A1, class _A2>
-inline _LIBCPP_INLINE_VISIBILITY
-typename __enable_invoke<_Fn, _T1>::_Bullet2
-__invoke(_Fn __f, _T1& __t1, _A0& __a0, _A1& __a1, _A2& __a2) {
- return ((*__t1).*__f)(__a0, __a1, __a2);
-}
-
-template <class _Fn, class _T1>
-inline _LIBCPP_INLINE_VISIBILITY
-typename __enable_invoke<_Fn, _T1>::_Bullet3
-__invoke(_Fn __f, _T1& __t1) {
- return __t1.*__f;
-}
-
-template <class _Fn, class _T1>
-inline _LIBCPP_INLINE_VISIBILITY
-typename __enable_invoke<_Fn, _T1>::_Bullet4
-__invoke(_Fn __f, _T1& __t1) {
- return (*__t1).*__f;
-}
-
-// fifth bullet
-
-template <class _Fp>
-inline _LIBCPP_INLINE_VISIBILITY
-decltype(declval<_Fp&>()())
-__invoke(_Fp& __f)
-{
- return __f();
-}
-
-template <class _Fp, class _A0>
-inline _LIBCPP_INLINE_VISIBILITY
-decltype(declval<_Fp&>()(declval<_A0&>()))
-__invoke(_Fp& __f, _A0& __a0)
-{
- return __f(__a0);
-}
-
-template <class _Fp, class _A0, class _A1>
-inline _LIBCPP_INLINE_VISIBILITY
-decltype(declval<_Fp&>()(declval<_A0&>(), declval<_A1&>()))
-__invoke(_Fp& __f, _A0& __a0, _A1& __a1)
-{
- return __f(__a0, __a1);
-}
-
-template <class _Fp, class _A0, class _A1, class _A2>
-inline _LIBCPP_INLINE_VISIBILITY
-decltype(declval<_Fp&>()(declval<_A0&>(), declval<_A1&>(), declval<_A2&>()))
-__invoke(_Fp& __f, _A0& __a0, _A1& __a1, _A2& __a2)
-{
- return __f(__a0, __a1, __a2);
-}
-
-template <class _Fp, bool = __has_result_type<__weak_result_type<_Fp> >::value>
-struct __invoke_return
-{
- typedef typename __weak_result_type<_Fp>::result_type type;
-};
-
-template <class _Fp>
-struct __invoke_return<_Fp, false>
-{
- typedef decltype(_VSTD::__invoke(declval<_Fp&>())) type;
-};
-
-template <class _Tp, class _A0>
-struct __invoke_return0
-{
- typedef decltype(_VSTD::__invoke(declval<_Tp&>(), declval<_A0&>())) type;
-};
-
-template <class _Rp, class _Tp, class _A0>
-struct __invoke_return0<_Rp _Tp::*, _A0>
-{
- typedef typename __enable_invoke<_Rp _Tp::*, _A0>::type type;
-};
-
-template <class _Tp, class _A0, class _A1>
-struct __invoke_return1
-{
- typedef decltype(_VSTD::__invoke(declval<_Tp&>(), declval<_A0&>(),
- declval<_A1&>())) type;
-};
-
-template <class _Rp, class _Class, class _A0, class _A1>
-struct __invoke_return1<_Rp _Class::*, _A0, _A1> {
- typedef typename __enable_invoke<_Rp _Class::*, _A0>::type type;
-};
-
-template <class _Tp, class _A0, class _A1, class _A2>
-struct __invoke_return2
-{
- typedef decltype(_VSTD::__invoke(declval<_Tp&>(), declval<_A0&>(),
- declval<_A1&>(),
- declval<_A2&>())) type;
-};
-
-template <class _Ret, class _Class, class _A0, class _A1, class _A2>
-struct __invoke_return2<_Ret _Class::*, _A0, _A1, _A2> {
- typedef typename __enable_invoke<_Ret _Class::*, _A0>::type type;
-};
-
-#endif // !defined(_LIBCPP_CXX03_LANG)
-
_LIBCPP_END_NAMESPACE_STD
#endif // _LIBCPP___FUNCTIONAL_WEAK_RESULT_TYPE_H