Why doesn't iter_swap use swap?

Phil Edwards phil@codesourcery.com
Mon Aug 23 22:49:00 GMT 2004


On Tue, Aug 24, 2004 at 12:32:18AM +0200, Gabriel Dos Reis wrote:
> Phil Edwards <phil@codesourcery.com> writes:
> 
> | Is there real-world code which exploits this capability?  We also talked
> | about that, and nobody could think of any offhand.
> 
> That argument usually is a two-edged sword.  If you get an answer in
> the immediate future, it does not tell you much (whether it is a
> really widespread good thing we should have ini the Standard).  If you
> get no answer, it does not tell you nobody uses it.  
> 
> The usual convervative approach is to assume that if it is there then
> someone may have used it.  Then it is a matter of whether you want to
> take the blame of breaking a working code -- there might be good
> reasons to do so.

Oh, I understand that completely.  By no means would I advocate breaking
code based solely on a straw poll.

So I'll expand my earlier statement.  In this case, I think the advantages
to being able to find specialized versions of swap outweigh the problems
caused by breaking calls to iter_swap with mismatched types.  As such code
already causes diagnostics to be emitted, the users either

- already know about it and are static_cast'ing their way around it, so
  we won't break anything, or

- already know about it and don't care about warnings, so turning it into
  a hard error forces them to fix/redesign/typecast.


In any case, I'm not proposing any short-term changes.

-- 
"This release is mostly intended to mop up the minor and trivial bug fixes
in the list and clear out the documentation changes.  As such, it should be
treated with even more suspicion than is normal."
    - dpkg 1.10.22 release note



More information about the Libstdc++ mailing list