File indexing completed on 2026-05-03 08:13:31
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010 #ifndef _LIBCPP___CXX03___FUNCTIONAL_UNARY_NEGATE_H
0011 #define _LIBCPP___CXX03___FUNCTIONAL_UNARY_NEGATE_H
0012
0013 #include <__cxx03/__config>
0014 #include <__cxx03/__functional/unary_function.h>
0015
0016 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
0017 # pragma GCC system_header
0018 #endif
0019
0020 _LIBCPP_BEGIN_NAMESPACE_STD
0021
0022 #if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_NEGATORS)
0023
0024 template <class _Predicate>
0025 class _LIBCPP_TEMPLATE_VIS
0026 _LIBCPP_DEPRECATED_IN_CXX17 unary_negate : public __unary_function<typename _Predicate::argument_type, bool> {
0027 _Predicate __pred_;
0028
0029 public:
0030 _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI explicit unary_negate(const _Predicate& __pred)
0031 : __pred_(__pred) {}
0032 _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI bool
0033 operator()(const typename _Predicate::argument_type& __x) const {
0034 return !__pred_(__x);
0035 }
0036 };
0037
0038 template <class _Predicate>
0039 _LIBCPP_DEPRECATED_IN_CXX17 inline _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI unary_negate<_Predicate>
0040 not1(const _Predicate& __pred) {
0041 return unary_negate<_Predicate>(__pred);
0042 }
0043
0044 #endif
0045
0046 _LIBCPP_END_NAMESPACE_STD
0047
0048 #endif