23 General utilities library [utilities]
template <class F> unspecified not_fn(F&& f);
Effects:
Equivalent to
return call_wrapper(std::forward<F>(f));
where
call_wrapper is an exposition only class defined as follows:
class call_wrapper {
using FD = decay_t<F>;
FD fd;
explicit call_wrapper(F&& f);
public:
call_wrapper(call_wrapper&&) = default;
call_wrapper(const call_wrapper&) = default;
template<class... Args>
auto operator()(Args&&...) &
-> decltype(!declval<invoke_result_t<FD&, Args...>>());
template<class... Args>
auto operator()(Args&&...) const&
-> decltype(!declval<invoke_result_t<const FD&, Args...>>());
template<class... Args>
auto operator()(Args&&...) &&
-> decltype(!declval<invoke_result_t<FD, Args...>>());
template<class... Args>
auto operator()(Args&&...) const&&
-> decltype(!declval<invoke_result_t<const FD, Args...>>());
};
explicit call_wrapper(F&& f);
Requires:
FD shall satisfy the requirements of
MoveConstructible. is_constructible_v<FD, F> shall be
true. Effects:
Initializes
fd from
std::forward<F>(f). Throws:
Any exception thrown by construction of
fd. template<class... Args>
auto operator()(Args&&... args) &
-> decltype(!declval<invoke_result_t<FD&, Args...>>());
template<class... Args>
auto operator()(Args&&... args) const&
-> decltype(!declval<invoke_result_t<const FD&, Args...>>());
Effects:
Equivalent to:
return !INVOKE(fd, std::forward<Args>(args)...);
template<class... Args>
auto operator()(Args&&... args) &&
-> decltype(!declval<invoke_result_t<FD, Args...>>());
template<class... Args>
auto operator()(Args&&... args) const&&
-> decltype(!declval<invoke_result_t<const FD, Args...>>());
Effects:
Equivalent to:
return !INVOKE(std::move(fd), std::forward<Args>(args)...);