Re: Asymmetry of user-difined swap and distance

2009-08-07 Thread Maxim Dementiev
On Fri, 7 Aug 2009 19:19:03 +0100 Jonathan Wakely wrote: 2009/8/7 Maxim Dementiev: It means that swap for user types could be defined either in std namespace or in the user type namespace (argument-dependent name lookup). Yes, this is intentional. swap() is a point of customisation point

Asymmetry of user-difined swap and distance

2009-08-07 Thread Maxim Dementiev
Hi, Let's have a look at std::pair<>::swap and std::lower_bound<> implementations. 1. pair::swap in http://gcc.gnu.org/viewcvs/trunk/libstdc%2B%2B-v3/include/bits/stl_pair.h?view=markup void swap(pair& __p) { using std::swap; swap(first, __p.first); sw