function_ref¶
An implementation of function_ref.
-
template<class
F
>
classtl
::
function_ref
¶ A lightweight non-owning reference to a callable.
Example:
void foo (function_ref<int(int)> func) { std::cout << "Result is " << func(21); //42 } foo([](int i) { return i*2; });
-
template<class
R
, class ...Args
>
classtl
::
function_ref
<R(Args...)>¶ Specialization for function types.
Special Members
-
constexpr
function_ref
() noexcept = delete¶
-
constexpr
function_ref
(function_ref const &rhs) noexcept¶ Creates a tl::function_ref which refers to the same callable as rhs.
-
template<typename
F
>
constexprfunction_ref
(F &&f) noexcept¶ Creates a tl::function_ref which refers to f.
f must be invocable with Args…, returning a type convertible to R.
-
function_ref &
operator=
(function_ref const &rhs) noexcept¶ Makes *this refer to the same callable as rhs.
-
template<typename
F
>
constexpr function_ref &operator=
(F &&f) noexcept¶ Makes *this refer to f.
f must be invocable with Args…, returning a type convertible to R.
-
constexpr void
swap
(function_ref &rhs) noexcept¶ Swaps the callables referred to by *this and rhs.
-
constexpr