Inspirel banner

Programming Distributed Systems with YAMI4

3.9.2 C++

Iteration support is provided by an additional nested type iterator, defined in the parameters class. Together with standard operations begin(), end() and its own increment and dereference for extracting the parameter_entry proxy, the iterator allows complete traversal over the whole collection.

A typical usage pattern could be similar to the following code that prints the names of all entries in the given parameters object:

parameters::iterator it;
for (it = params.begin(); it != params.end(); ++i)
{
    parameter_entry e = *it;

    std::cout << e.name() << '\n';
}

Note:

The ``arrow'' operator is not supported as the parameter_entry proxy object is created on the fly and returned by value.

Note:

Individual entries can be modified during the iteration, but they should not be added nor removed from the collection while the iteration is in progress.

The size of the whole collection can be always obtained with the size() function of the parameters object.