|
Boost : |
Subject: Re: [boost] [swap] please update documentation...
From: Peter Simons (simons_at_[hidden])
Date: 2009-06-30 05:31:15
Hi Niels,
> Adam and Peter, could you please also test the following on g++ 4.4.0?
the program compiles fine, which made me wonder about my earlier report that
gcc 4.4.0 would choose boost::swap in the example program we previously
talked about. So I tried to repeat my finding. I edited an
std::cout << __PRETTY_FUNCTION__ << std::endl;"
into <boost/utility/swap.hpp>, compiled the following program, and ran it:
#include <iostream>
#include <string>
#include <boost/swap.hpp>
int main(int, char * [])
{
std::string a1[42];
std::string a2[42];
boost::swap(a1, a2); // Okay.
using boost::swap;
swap(a1, a2); // Does not compile!
return 0;
}
Surely enough, the output is
g++ -pedantic test.cpp && ./a.out
void boost::swap(T1&, T2&) [with T1 = std::string [42], T2 = std::string [42]]
..., just like last time but then I looked real hard at the source code and
finally noticed that the program calls boost::swap() explicitly, too, which
is where that debug output comes from.
In other words, I was wrong: gcc 4.4.0 does *not* pick boost::swap by ADL in
this example.
I'm sorry for causing confusion.
Take care,
Peter
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk