[RFA] Removing const from std::swap
Gabriel Dos Reis
gdr@integrable-solutions.net
Thu May 19 19:35:00 GMT 2005
Joe Buck <Joe.Buck@synopsys.COM> writes:
| 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).
I think the point was that Assignable was too strong and too fuzzy
assumption for the three-assignment implementation to work.
Can the implementation use const? If yes, must it? I think that is a
recipe for non-portability.
-- Gaby
More information about the Libstdc++
mailing list