22 #if !defined(__cpp_lib_not_fn) && !(defined(_LIBCPP_VERSION) && __cplusplus > 201103L)
24 #define R__NOTFN_BACKPORT
26 #include <type_traits>
34 typename std::decay<F>::type fFun;
37 explicit not_fn_t(F &&f) : fFun(std::forward<F>(f)) {}
38 not_fn_t(not_fn_t &&h) =
default;
39 not_fn_t(
const not_fn_t &f) =
default;
41 template <
class... Args>
42 auto operator()(Args &&... args) & -> decltype(
43 !std::declval<
typename std::result_of<
typename std::decay<F>::type(Args...)>::type>())
45 return !fFun(std::forward<Args>(args)...);
47 template <
class... Args>
48 auto operator()(Args &&... args) const & -> decltype(
49 !std::declval<typename std::result_of<typename std::decay<F>::type const(Args...)>::type>())
51 return !fFun(std::forward<Args>(args)...);
58 Detail::not_fn_t<F> not_fn(F &&f)
60 return Detail::not_fn_t<F>(std::forward<F>(f));