#include <muu/function_view.h>
template <typename Func>
function_view class
A non-owning, type-erasing view of a callable object (functions, lambdas, etc.).
Template parameters | |
---|---|
Func | A nominal function signature for callables that will be view by instances of this class, e.g. void(int) . |
Public types
- using func_type = Func
- the nomimal function type signature of this view.
Constructors, destructors, conversion operators
- function_view() defaulted constexpr noexcept
- Default-constructs a 'null' function view.
-
function_view(const function_
view&) defaulted constexpr noexcept - Copy constructor.
-
template <typename F>function_view(F&& func) constexpr noexcept
- Constructs a function_
view by wrapping a callable. - operator bool() const explicit constexpr noexcept
- Returns true if the view represents a callable (i.e. is not null).
Public functions
- auto operator()(Args&& ...) const -> decltype(auto) constexpr noexcept(…)
- Invokes the wrapped callable with the given arguments.
-
auto operator=(const function_
view&) -> function_ view& defaulted constexpr noexcept - Copy-assignment operator.
Function documentation
template <typename Func>
template <typename F>
muu::function_view::function_view(F&& func) constexpr noexcept
template <typename F>
Constructs a function_
Template parameters | |
---|---|
F | A function, lambda or other callable type with a signature compatible with func_ |
Parameters | |
func | The callable to view/invoke. |