|
| | function_ref () noexcept |
| | Creates an empty function_ref in an invalid state.
|
|
| function_ref (const function_ref &) noexcept=default |
|
function_ref & | operator= (const function_ref &) noexcept=default |
| template<typename CallableType, typename = std::enable_if_t<!is_function_pointer<CallableType>::value && !has_same_decayed_type<CallableType, function_ref>::value && is_invocable<CallableType, ArgTypes...>::value>> |
| | function_ref (CallableType &&callable) noexcept |
| | Creates a function_ref with a callable whose lifetime has to be longer than function_ref.
|
| | function_ref (ReturnType(*function)(ArgTypes...)) noexcept |
| | Creates a function_ref from a function pointer.
|
|
| function_ref (function_ref &&rhs) noexcept |
|
function_ref & | operator= (function_ref &&rhs) noexcept |
| ReturnType | operator() (ArgTypes... args) const noexcept |
| | Calls the provided callable.
|
| | operator bool () const noexcept |
| | Checks whether a valid target is contained.
|
| void | swap (function_ref &rhs) noexcept |
| | Swaps the contents of two function_ref's.
|
template<class ReturnType, class... ArgTypes>
class iox::cxx::function_ref< ReturnType(ArgTypes...)>
cxx::function_ref is a non-owning reference to a callable.
It has these features:
* No heap usage
* No exceptions
* Stateful lambda support
* C++11/14 support
- Attention
- Invoking an empty function_ref can lead to a program termination!
{
callback();
}
fuu([]{ doSomething(); });
auto callable = [&]{ doSomething(); };
cxx::function_ref<void()> callback(callable);
callback();
Definition function_ref.hpp:34
template<class ReturnType, class... ArgTypes>
template<typename CallableType, typename = std::enable_if_t<!is_function_pointer<CallableType>::value && !has_same_decayed_type<CallableType, function_ref>::value && is_invocable<CallableType, ArgTypes...>::value>>