![]() |
Home | Libraries | People | FAQ | More |
Calls a Polymorphic Function Object with the arguments from a Sequence.
The corresponding metafunction, result_of::invoke_function_object
, does
not define a type
member,
if the nested result
class template of the target function object is empty.
The first template parameter can be specialized explicitly to avoid copying and/or to control the const qualification of a function object.
template< typename Function, class Sequence > typenameresult_of::invoke_function_object
<Function, Sequence>::type invoke_function_object(Function f, Sequence & s); template< typename Function, class Sequence > typenameresult_of::invoke_function_object
<Function, Sequence const>::type invoke_function_object(Function f, Sequence const & s);
Parameter | Requirement | Description |
---|---|---|
f |
Model of Polymorphic Function Object | The function object to call. |
s |
Model of Forward Sequence | The arguments. |
invoke_procedure(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_function_object.hpp>
struct sub
{
template<typename T, typename _>
struct result
{
typedef T type;
};
template<typename T>
T operator()(T lhs, T rhs) const
{
return lhs - rhs;
}
};
void try_it()
{
sub f;
assert(f(2,1) == invoke_function_object(f,make_vector
(2,1)));
}
Copyright © 2001-2007 Joel de Guzman, Dan Marsden, Tobias Schwinger |