Template Class Invocable¶
Defined in File functional_traits.hpp
Class Documentation¶
-
template<typename
Functor>
classripple::Invocable¶ The Invocable type defines an object which stores a functor which can be invoked.
- Note
This class always owns the functor.
- Note
This class always owns the functor object.
- Template Parameters
Functor: The type of the functor to invoke.
- Template Parameters
Functor: The type of the functor to invoke.
Public Functions
-
template<typename
F>Invocable(F &&functor) noexcept¶ Takes a functor to store for the invocable.
- Parameters
functor: The functor to store.
- Template Parameters
F: The type of the functor.
-
Invocable(const Functor &functor) noexcept¶ Takes a functor and copies it into this invocable.
- Parameters
functor: The functor to store.
-
Invocable(const Invocable &other) noexcept¶ Copy constructor which simply copies the functor from the other invocable into this one.
- Parameters
other: The other invocable object to copy.
-
Invocable(Invocable &&other) noexcept¶ Move constructor which moves the functor from the other invocable into this one.
- Parameters
other: The other invocable object to move.
-
auto
operator=(const Invocable &other) noexcept -> Invocable&¶ Copy assignment to copy the invocable from the other invocable into this one.
- Return
A reference to the modified invocable.
- Parameters
other: The other invocable to copy from.
-
auto
operator=(Invocable &&other) noexcept -> Invocable&¶ Move assignment to move the invocable from the other invocable into this one.
- Return
A reference to the modified invocable.
- Parameters
other: The other invocable to move into this one.
-
template<typename ...
Args>
autooperator()(Args&&... args) const noexcept -> void¶ Overload of the function call operator to invoke the invocable.
This overload preserves the state of the invocable, passing the arguments to the stored functor.
- Todo:
Add compile time check that the Args are all convertible to the type of the arguments for the functor.
- Parameters
args: The arguments to invoke the functor with.
- Template Parameters
Args: The types of the additional arguments.
-
template<typename ...
Args>
autooperator()(Args&&... args) noexcept -> void¶ Overload of the function call operator to invoke the invocable.
This overload may not preserve the state of the invocable., and passes the arguments to the stored functor.
- Todo:
Add compile time check that the Args are all convertible to the type of the arguments for the functor.
- Parameters
args: The arguments to invoke the functor with.
- Template Parameters
Args: The types of the additional arguments.