Why doesn't iter_swap use swap?

Gabriel Dos Reis gdr@integrable-solutions.net
Tue Aug 24 09:27:00 GMT 2004


chris jefferson <caj@cs.york.ac.uk> writes:

| >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.
| >
| >
| If we decided changing iter_swap was too serious an undertaking at
| this point, then according to the standard, should we be using swap()
| or iter_swap() in our implementation of reverse/sort/etc.etc.? I read
| it as swap personally. If we changed iter_swap it would make no
| difference as iter_swap would just call swap. If not, then it might be
| necessary to remove mentions of std::iter_swap(a,b) for swap(*a,*b) so
| we meet requirements?

Arguments can be constructed for either sides.  I personnaly believe
that iter_swap should just defer to swap(), thereby providing a point
of customization.  Of course, that may mean inconveniencing some
religious anti-ADL camps.

-- Gaby



More information about the Libstdc++ mailing list