Re: [hub] on the specialized iteration over elements

Joaquin M López Muñoz via Boost <[email protected]>
Newsgroups gmane.comp.lib.boost.devel
Message-ID <[email protected]>
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

_______________________________________________
Boost mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://lists.boost.org/mailman3/lists/boost.lists.boost.org/
Archived at: https://lists.boost.org/archives/list/[email protected]/message/BF52M464P4K6D2O4BY6VGXSF7TWEQFCH/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.