blob: 3591b8ee0d5a33363c5499b061acec03b8d4e1e7 [file] [log] [blame]
// -*- C++ -*-
//===----------------------------------------------------------------------===//
//
// 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___CXX03___FUNCTIONAL_UNARY_NEGATE_H
#define _LIBCPP___CXX03___FUNCTIONAL_UNARY_NEGATE_H
#include <__cxx03/__config>
#include <__cxx03/__functional/unary_function.h>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
#endif
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _Predicate>
class _LIBCPP_TEMPLATE_VIS unary_negate : public __unary_function<typename _Predicate::argument_type, bool> {
_Predicate __pred_;
public:
_LIBCPP_HIDE_FROM_ABI explicit unary_negate(const _Predicate& __pred) : __pred_(__pred) {}
_LIBCPP_HIDE_FROM_ABI bool operator()(const typename _Predicate::argument_type& __x) const { return !__pred_(__x); }
};
template <class _Predicate>
inline _LIBCPP_HIDE_FROM_ABI unary_negate<_Predicate> not1(const _Predicate& __pred) {
return unary_negate<_Predicate>(__pred);
}
_LIBCPP_END_NAMESPACE_STD
#endif // _LIBCPP___CXX03___FUNCTIONAL_UNARY_NEGATE_H