El 17/04/2026 a las 10:06, Alexander Grund via Boost escribió:
Am 17.04.26 um 09:51 schrieb Joaquin M López Muñoz via Boost:
El 17/04/2026 a las 0:23, Jean-Louis Leroy via Boost escribió:
Third, the interface is rather unusual, and it allows one hub to iterate over another hub's elements:
hub<T> h, g; h.visit(g.begin(), g.end(), fun); I guess it can be useful to iterate over a narrower range. But in that spirit, I would expect 'visit' to return the "end" iterator.
To be quite honest, I don't see tremendous value on iterating over a range narrower than the whole container, because insertion order in hub is arbitrary and there's no meaningul property that elements of a subrange would share --same rationale applies to other unordered containers like, for instance, std::unordered_map. The function visit(first, last, f) is there for operational closure reasons, so to say.
If your functor could break out of iteration, like Ions suggested visit_while it could make sense to be able to "resume" iteration where it left off
Umm, yes, that's a potential use case, thank you! FWIW, visit_while is already provided in the version of hub under review. Joaquín M López Muñoz