[RFA] Removing const from std::swap

Paolo Carlini pcarlini@suse.de
Thu May 19 14:28:00 GMT 2005

Hi everyone,

some time ago, in an overzealous (it seems ;) series of const- tweaks to
the algorithms, I touched std::swap too, adding a const to the temporary

  template<typename _Tp>
    inline void
    swap(_Tp& __a, _Tp& __b)
      // concept requirements

      const _Tp __tmp = __a;
      __a = __b;
      __b = __tmp;

This is strictly speaking absolutely legal, as the concept check also
demonstrates, but now people on the c++.moderated list, Howard Hinnant
for example, believe that this is "overly pedantic" ;) ... Shall I
remove it? If we keep it, auto_ptrs cannot be swapped, as an extension,


More information about the Libstdc++ mailing list