My Project
stxxl::for_each_m (mutating)
Author
Roman Dementiev (2006)

stxxl::for_each_m is a mutating version of stxxl::for_each, i.e. the restriction that Unary Function functor can not apply only constant operations through its argument does not exist.

Prototype

template < typename ExtIterator, typename UnaryFunction >
UnaryFunction for_each_m ( ExtIterator first,
ExtIterator last,
UnaryFunction functor,
int nbuffers
)

Description

Requirements on types

Preconditions

[first, last) is a valid range.

Complexity

Example

struct AddX
{
int x;
AddX(int x_): x(x_) {}
void operator() (int & val)
{ val += x; }
};
typedef stxxl::VECTOR_GENERATOR<int>::result vector_type;
int main()
{
vector_type A(N);
// fill A with some values ...
// Add 5 to each value in the vector
stxxl::for_each_m(A.begin(), A.end(), AddX(5));
}