Boost logo

Boost :

Subject: Re: [boost] [swap] please update documentation...
From: Niels Dekker - address until 2010-10-10 (niels_address_until_2010-10-10_at_[hidden])
Date: 2009-06-29 13:33:18

>> I'm very surprised it doesn't pick std::swap, as found by
>> argument-dependent lookup. What version of GCC are you using exactly?

Peter Simons wrote:
> The test program was compiled with g++ 4.4.0 20090526 (prerelease) on
> ArchLinux/x86.

Thanks Peter! It looks like a brandnew GCC bug to me... Can you please
confirm that the following simplified version also compiles and runs on
your installation of GCC 4.4.0? And if so, does it indeed throw
"foo::swap is called"?

  #include <string>
  #include <algorithm>

  namespace foo
    template<class T1, class T2>
    void swap(T1&, T2&)
      throw "foo::swap is called";

  int main()
    std::string a1[42];
    std::string a2[42];

    using foo::swap;
    swap(a1, a2);


So far, I've tried Comeau C/C++ (online at, MSVC 2008 SP1, gcc-4 (GCC) 4.3.2
20080827 (beta) 2 within cygwin, and g++ 4.1.2 at None of them pick foo::swap. Instead, all
of them yield a compile error, trying to call std::swap.

Kind regards, Niels

Boost list run by bdawes at, gregod at, cpdaniel at, john at