#define XERR
#include "cluster.ih"

void Cluster::inspect()
{
        // d_iter visits all elements in order.txt
    for ( ; d_iter != d_end; ++d_iter) // visit all elements
    {
        if (not programSrc(*d_iter))              // txt files are OK
            continue;
                                                // get the local path
        string prefix = fs::path{ d_iter->name }.parent_path();

        auto result = d_map.emplace(prefix, Prefix{});
        activate(result.first, d_iter);           // deactivate other sections
    }

    for (MapValue const &value: d_map)
    {
        if (value.second.count != 1)
            err() << d_path << value.first << ": elements not clustered\n";
    }

    d_next = d_map.begin();                     // preparing for next()
}
