[rtsan] Remove mkfifoat interceptor (#116997)
[llvm-project.git] / libcxx / include / __cxx03 / __functional / not_fn.h
blob8b9264af64c58fdea2336f19cb4592f5bc97fc78
1 // -*- C++ -*-
2 //===----------------------------------------------------------------------===//
3 //
4 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5 // See https://llvm.org/LICENSE.txt for license information.
6 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //
8 //===----------------------------------------------------------------------===//
10 #ifndef _LIBCPP___FUNCTIONAL_NOT_FN_H
11 #define _LIBCPP___FUNCTIONAL_NOT_FN_H
13 #include <__cxx03/__config>
14 #include <__cxx03/__functional/invoke.h>
15 #include <__cxx03/__functional/perfect_forward.h>
16 #include <__cxx03/__type_traits/decay.h>
17 #include <__cxx03/__type_traits/enable_if.h>
18 #include <__cxx03/__type_traits/is_constructible.h>
19 #include <__cxx03/__utility/forward.h>
21 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
22 # pragma GCC system_header
23 #endif
25 _LIBCPP_BEGIN_NAMESPACE_STD
27 #if _LIBCPP_STD_VER >= 17
29 struct __not_fn_op {
30 template <class... _Args>
31 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 auto operator()(_Args&&... __args) const
32 noexcept(noexcept(!std::invoke(std::forward<_Args>(__args)...)))
33 -> decltype(!std::invoke(std::forward<_Args>(__args)...)) {
34 return !std::invoke(std::forward<_Args>(__args)...);
38 template <class _Fn>
39 struct __not_fn_t : __perfect_forward<__not_fn_op, _Fn> {
40 using __perfect_forward<__not_fn_op, _Fn>::__perfect_forward;
43 template <class _Fn,
44 class = enable_if_t< is_constructible_v<decay_t<_Fn>, _Fn> && is_move_constructible_v<decay_t<_Fn>> >>
45 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 auto not_fn(_Fn&& __f) {
46 return __not_fn_t<decay_t<_Fn>>(std::forward<_Fn>(__f));
49 #endif // _LIBCPP_STD_VER >= 17
51 _LIBCPP_END_NAMESPACE_STD
53 #endif // _LIBCPP___FUNCTIONAL_NOT_FN_H