1050b064fSChristopher Di Bella // -*- C++ -*- 2050b064fSChristopher Di Bella //===----------------------------------------------------------------------===// 3050b064fSChristopher Di Bella // 4050b064fSChristopher Di Bella // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 5050b064fSChristopher Di Bella // See https://llvm.org/LICENSE.txt for license information. 6050b064fSChristopher Di Bella // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 7050b064fSChristopher Di Bella // 8050b064fSChristopher Di Bella //===----------------------------------------------------------------------===// 9050b064fSChristopher Di Bella 10050b064fSChristopher Di Bella #ifndef _LIBCPP___FUNCTIONAL_BINARY_NEGATE_H 11050b064fSChristopher Di Bella #define _LIBCPP___FUNCTIONAL_BINARY_NEGATE_H 12050b064fSChristopher Di Bella 13050b064fSChristopher Di Bella #include <__config> 14050b064fSChristopher Di Bella #include <__functional/binary_function.h> 15050b064fSChristopher Di Bella 16050b064fSChristopher Di Bella #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) 17050b064fSChristopher Di Bella # pragma GCC system_header 18050b064fSChristopher Di Bella #endif 19050b064fSChristopher Di Bella 20050b064fSChristopher Di Bella _LIBCPP_BEGIN_NAMESPACE_STD 21050b064fSChristopher Di Bella 22050b064fSChristopher Di Bella #if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_NEGATORS) 23050b064fSChristopher Di Bella 24050b064fSChristopher Di Bella template <class _Predicate> 25050b064fSChristopher Di Bella class _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX17 binary_negate 26681cde7dSNikolas Klauser : public __binary_function<typename _Predicate::first_argument_type, 27050b064fSChristopher Di Bella typename _Predicate::second_argument_type, 28*9783f28cSLouis Dionne bool> { 29050b064fSChristopher Di Bella _Predicate __pred_; 30050b064fSChristopher Di Bella 31*9783f28cSLouis Dionne public: binary_negate(const _Predicate & __pred)32*9783f28cSLouis Dionne _LIBCPP_HIDE_FROM_ABI explicit _LIBCPP_CONSTEXPR_SINCE_CXX14 binary_negate(const _Predicate& __pred) 33*9783f28cSLouis Dionne : __pred_(__pred) {} 34*9783f28cSLouis Dionne operator()35*9783f28cSLouis Dionne _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI bool operator()( 36*9783f28cSLouis Dionne const typename _Predicate::first_argument_type& __x, const typename _Predicate::second_argument_type& __y) const { 37*9783f28cSLouis Dionne return !__pred_(__x, __y); 38*9783f28cSLouis Dionne } 39050b064fSChristopher Di Bella }; 40050b064fSChristopher Di Bella 41050b064fSChristopher Di Bella template <class _Predicate> 42*9783f28cSLouis Dionne _LIBCPP_DEPRECATED_IN_CXX17 inline _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI binary_negate<_Predicate> not2(const _Predicate & __pred)43*9783f28cSLouis Dionnenot2(const _Predicate& __pred) { 44*9783f28cSLouis Dionne return binary_negate<_Predicate>(__pred); 45*9783f28cSLouis Dionne } 46050b064fSChristopher Di Bella 47050b064fSChristopher Di Bella #endif // _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_NEGATORS) 48050b064fSChristopher Di Bella 49050b064fSChristopher Di Bella _LIBCPP_END_NAMESPACE_STD 50050b064fSChristopher Di Bella 51050b064fSChristopher Di Bella #endif // _LIBCPP___FUNCTIONAL_BINARY_NEGATE_H 52