Why doesn't iter_swap use swap?

Martin Sebor sebor@roguewave.com
Mon Aug 23 23:00:00 GMT 2004


Phil Edwards wrote:

...
> 
> chris and I discussed this on #c++ briefly.  Code like this generates
> warnings already.  Our iter_swap implementation does convertibility testing
> when concept checks are on, but only a simple assignment of the values.
> There's no attempt at, e.g., typecasting.  (Nor do I think there should be.)
> So I feel this shouldn't hold back anything.
> 
> Is there real-world code which exploits this capability?  We also talked
> about that, and nobody could think of any offhand.

I don't know of any, either. Note that many implementations including
ours call iter_swap() from swap_ranges(), despite the requirement to
call swap(), so the change would break this algorithm as well.

Martin



More information about the Libstdc++ mailing list