19 General utilities library [utilities]

19.14 Function objects [function.objects]

19.14.11 Function template not_­fn [func.not_fn]

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 Cpp17MoveConstructible requirements.
is_­constructible_­v<FD, F> shall be true.
fd shall be a callable object.
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)...);              // see [func.require]
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)...);   // see [func.require]