File indexing completed on 2025-01-18 10:10:45
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014 #ifndef ROOT_RNotFn
0015 #define ROOT_RNotFn
0016
0017 #include <functional>
0018
0019
0020
0021
0022 #if !defined(__cpp_lib_not_fn) && !(defined(_LIBCPP_VERSION) && __cplusplus > 201103L)
0023
0024 #define R__NOTFN_BACKPORT
0025
0026 #include "ROOT/TypeTraits.hxx" // InvokeInvokeResult_t
0027
0028 #include <type_traits> // std::decay
0029 #include <utility> // std::forward, std::declval
0030
0031 namespace std {
0032
0033 namespace __ROOT_noinline {
0034 template <typename F>
0035 class not_fn_t {
0036 std::decay_t<F> fFun;
0037
0038 public:
0039 explicit not_fn_t(F &&f) : fFun(std::forward<F>(f)) {}
0040 not_fn_t(not_fn_t &&h) = default;
0041 not_fn_t(const not_fn_t &f) = default;
0042
0043 template <class... Args>
0044 auto
0045 operator()(Args &&...args) & -> decltype(!std::declval<ROOT::TypeTraits::InvokeResult_t<std::decay_t<F>, Args...>>())
0046 {
0047 return !fFun(std::forward<Args>(args)...);
0048 }
0049 template <class... Args>
0050 auto operator()(Args &&...args)
0051 const & -> decltype(!std::declval<ROOT::TypeTraits::InvokeResult_t<std::decay_t<F> const, Args...>>())
0052 {
0053 return !fFun(std::forward<Args>(args)...);
0054 }
0055 };
0056 }
0057
0058
0059 template <typename F>
0060 __ROOT_noinline::not_fn_t<F> not_fn(F &&f)
0061 {
0062 return __ROOT_noinline::not_fn_t<F>(std::forward<F>(f));
0063 }
0064 }
0065
0066 #endif
0067
0068 #endif