[hub] Hub is not a SequenceContainer

Andrzej Krzemienski via Boost <[email protected]>
Newsgroups gmane.comp.lib.boost.devel
Message-ID <CAOenAXhWByRJ-58+ELUtPK3CTRfJVw5NzaS37KdPO6ss2TeRgg@mail.gmail.com>
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.

Regards,
&rzej;
_______________________________________________
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/JA3LZOTHPUWECWLL6KLOTZHBKNMWYEN3/
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.