Boost logo

Boost :

From: David Abrahams (david.abrahams_at_[hidden])
Date: 2001-10-20 04:48:45


----- Original Message -----
From: "Darin Adler" <darin_at_[hidden]>

> But this doesn't seem to be an argument for or against a boost::swap
> function. So it doesn't seem relevant to my point (e).
>
> A boost::swap function is helpful in at least two ways:
>
> 1) more efficiency with some standard library implementations -- this
is
> a Boost quality of implementation issue for me at least
> 2) if shared_ptr goes into std::, helps remind implementers that a
> std::swap overload would be appropriate

If we go this route, we should take the opportunity to dispatch to a
swap_algorithm class template's static member function, so that users can
partially-specialize the behavior of swap.

> I think that providing operator< does this too, without a comment to
explain
> the rationale. While the partial specialization of std::less is illegal
and
> this is legal

Why is that? AFAIK it is always legal to provide a specialization of a
standard class type on a UDT, so long as the semantics are consistent with
the unspecialized template.

> , I think that a class that supports operator< but not other
> comparison operators is still a curious anomaly, more evidence of "longing
> for a key comparison abstraction".
>
> But this request for rationale is a minor point.

Yep.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk