std::invocable, std::regular_invocable

Header: <concepts>

The invocable concept specifies that a callable type F can be called with a set of arguments Args… using the function template std::invoke.

# Declarations

template< class F, class... Args >
concept invocable =
requires(F&& f, Args&&... args) {
std::invoke(std::forward<F>(f), std::forward<Args>(args)...);
/* not required to be equality-preserving */
};

(since C++20)

template< class F, class... Args >
concept regular_invocable = std::invocable<F, Args...>;

(since C++20)

# Notes

The distinction between invocable and regular_invocable is purely semantic.

A random number generator may satisfy invocable but cannot satisfy regular_invocable (comical ones excluded).

# See also