#define XERR
#include "cluster.ih"

Cluster::VectConstIterPair Cluster::next()
{
    VectConstIterPair ret;

    while (d_next != d_map.end())       // visit all d_map elements
    {
        ConstIterVect const &vect = d_next->second.vect;
        ++d_next;                       // prepare for the next call

        if (vect.size() > 0)            // elements are available
        {
            ret = VectConstIterPair{ vect.begin(), vect.end() };
            return ret;
        }
    }

    return ret = VectConstIterPair{ ConstIterVectIter{}, 
                                    ConstIterVectIter{} };
}
