Date: Tue, 15 Mar 2022 18:24:05 -0500
On Mon, Mar 14, 2022 at 7:20 PM Matt Bentley via SG14 <sg14_at_[hidden]>
wrote:
> The unordered version of the operator is trivial, but slower -
> it allocates pointers to each of the elements in each of the containers,
> then sorts the pointers via the values they point to, then does a
> standard == left-hand/right-hand compare via the pointers.
> This means (a) == allocates, (b) == is slower due to jumping around in
> memory and not necessarily following element sequence.
>
My opinion is that it should have one, and if it does, the expectation is
that it is unordered.
For most containers (other than string), I rarely use its comparison
operators, but when I need them, they are very handy.
We are supposed to be designing a coherent standard library, and all the
containers in the standard library are equality comparable. This should
not be a snowflake.
How does the complexity compare with the complexity of
unordered_multiset::operator==?
wrote:
> The unordered version of the operator is trivial, but slower -
> it allocates pointers to each of the elements in each of the containers,
> then sorts the pointers via the values they point to, then does a
> standard == left-hand/right-hand compare via the pointers.
> This means (a) == allocates, (b) == is slower due to jumping around in
> memory and not necessarily following element sequence.
>
My opinion is that it should have one, and if it does, the expectation is
that it is unordered.
For most containers (other than string), I rarely use its comparison
operators, but when I need them, they are very handy.
We are supposed to be designing a coherent standard library, and all the
containers in the standard library are equality comparable. This should
not be a snowflake.
How does the complexity compare with the complexity of
unordered_multiset::operator==?
-- Nevin ":-)" Liber <mailto:nevin_at_[hidden] <nevin_at_[hidden]>> +1-847-691-1404
Received on 2022-03-15 23:24:45