Re: [hub] Hub is not a SequenceContainer
Joaquín M López Muñoz via Boost <[email protected]>
| Newsgroups | gmane.comp.lib.boost.devel |
|---|---|
| Message-ID | <[email protected]> |
> No dia 21 de abr. de 2026, às 22:05, Andrzej Krzemienski <[email protected]> escreveu: > > > std::hive is explicitly stated as not meeting even Container requirements, not to mention SequenceContainer requirements: https://eel.is/c++draft/hive.overview#6 > > Its location in clause 23.3 "Sequence containers" makes the situation unnecessarily confusing. > > Container requirements require equality comparison, which std::hive, and therefore boost::container::hub, does not provide. It is debatable whether a container should provide it. It is debatable whether std::unordered_map should provide a quadratic comparison operator only to satisfy the concept. But it is what it is. But this is the least of the concerns. > > std::hive, and therefore boost::container::hub cannot be a SequenceContainer,because the whole idea of the concept is that the user controls the order of elements manually via insertions at desired places. This is reflected in operation > > a.insert(p, t) > Effects: Inserts a copy of `t` before `p`. > > (https://eel.is/c++draft/sequence.reqmts#26) > > std::hive provides an operation with this syntax, but with different semantics: the value of the iterator will be ignored and the container will insert the element at an arbitrary location. Users cannot control the sequence of elements. std::hive is more like std::multiset in this aspect (modulo the performance benefits). But the specification of std::hive, although misleading, in the end states clearly that it is not a sequence container. > > The docs for boost::container::hub should make it abundantly clear that it does not satisfy the requirements of a SequenceContainer. Noted, will fix the docs. 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/3Z4NJUMYPR65UEL7FOFWTDEXUPN7LN2D/