https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91541

--- Comment #8 from frankhb1989 at gmail dot com ---
(In reply to frankhb1989 from comment #5)
> (In reply to Jonathan Wakely from comment #4)
> > This might strictly conform to the requirements, but it's stupid. Why would
> > you do that?
> > 
> > Allocator equality doesn't care about the value type, as evidenced by the
> > requirement that a==b is equivalent to a==Y::rebind<T>::other(b). So if the
> > result of == doesn't care about the value type, then why would
> > is_always_equal depend on it?
> 
> ..., and it actually throws on
> comparison, then ... .
> 

... My bad. I should have meant that it might throw when the result of the
result of == for node_allocator is `false`. This is even more stupid: `a ==
Y::rebind<T>::other(b)` does not effectively imply that two values of type
`Y::rebind<T>::other` will always be equal, even that there are requirements of
"reflexive, symmetric, and transitive" on "a1 == a2", consistent false negative
results are not prevented because such requirements are not also forced on "a
== b", so such definitions are allowed:

bool operator==(const X&, const X&) noexcept
{
        return true;
}

bool operator==(const Y& a1, const Y& a2) noexcept
{
        return &a1 == &a2;
}

bool operator==(const X& a, const Y& b) noexcept
{
        return a == Y::rebind<T>::other(b);
}

bool operator==(const Y& b, const X& a) noexcept
{
        return b == Y::rebind<U>::other(a);
}

where `T` is the container `value_type` equivalent to `value_type` of allocator
type `X` and `U` is the container node type equivalent `value_type` of
allocator type `Y`.

Reply via email to