![]() |
Home | Libraries | People | FAQ | More |
Calls a Deferred Callable Object with the arguments from a Sequence.
The corresponding metafunction, result_of::invoke
does not define a type
member for target functions of
non-class type whose arity is not satisfied by the size of the sequence.
The first template parameter can be specialized explicitly to avoid copying and/or to control the const qualification of a function object.
If the target function is a pointer to a class members, the corresponding
object can be specified as a reference, pointer, or smart pointer. In
case of the latter, a freestanding get_pointer
function
must be defined (Boost provides this function for std::auto_ptr
and boost::shared_ptr
).
template< typename Function, class Sequence > typenameresult_of::invoke
<Function, Sequence>::type invoke(Function f, Sequence & s); template< typename Function, class Sequence > typenameresult_of::invoke
<Function, Sequence const>::type invoke(Function f, Sequence const & s);
Parameter | Requirement | Description |
---|---|---|
f |
A Deferred Callable Object | The function to call. |
s |
A Forward Sequence | The arguments. |
invoke(f,s);
Return type: Return type of f
when invoked with the elements in
s
as its arguments.
Semantics: Invokes f
with the elements in s
as arguments and returns the result of the call expression.
#include <boost/fusion/functional/invocation/invoke.hpp>
std::plus
<int> add; assert(invoke(add,make_vector
(1,1)) == 2);
Copyright © 2001-2005 Joel de Guzman, Dan Marsden |