Boost C++ Libraries

...one of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

Click here to view the latest version of this page.
PrevUpHomeNext
invoke_procedure
Description

Calls a Callable Object with the arguments from a Sequence. The result of the call is ignored.

The first template parameter can be specialized explicitly to avoid copying and/or to control the const qualification of a function object.

For pointers to class members 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).

The target function must not be a pointer to a member object (dereferencing such a pointer without returning anything does not make sense, so it isn't implemented).

Synopsis
template<
    typename Function,
    class Sequence
    >
typename result_of::invoke_procedure<Function, Sequence>::type
invoke_procedure(Function f, Sequence & s);

template<
    typename Function,
    class Sequence
    >
typename result_of::invoke_procedure<Function, Sequence const>::type
invoke_procedure(Function f, Sequence const & s);
Parameters

Parameter

Requirement

Description

f

Model of Callable Object

The function to call.

s

Model of Forward Sequence

The arguments.

Expression Semantics
invoke_procedure(f,s);

Return type: void

Semantics: Invokes f with the elements in s as arguments.

/functional/invocation/invoke_procedure.hpp>

Example
vector<int,int> v(1,2);
using namespace boost::lambda;
invoke_procedure(_1 += _2, v);
assert(front(v) == 3);
See also

PrevUpHomeNext