[RFA] Removing const from std::swap

Joe Buck Joe.Buck@synopsys.COM
Thu May 19 19:25:00 GMT 2005


On Thu, May 19, 2005 at 08:09:29PM +0200, Gabriel Dos Reis wrote:
> I guess, the question is whether the proper assumption (concept) for
> swap() is Assignable.  I think no (even though the standard says yes.
> Now, I see what you mean.) 

Maybe the answer should be that either the arguments are Assignable or
a specialization is provided that can do the swap, and that all standard
library classes that are, in principle, swap-able should supply
specializations if needed (e.g. auto_ptr).  Then there's the small
matter of swap versus iter_swap, and which is used by sorting algorithms.

Certainly Assignable is needed if the three-assignment implementation (or
copy ctor + two assignment) is to work ( T t(a); a = b; b = t).





More information about the Libstdc++ mailing list