|
Boost : |
From: Niels Dekker - mail address until 2008-12-31 (nd_mail_address_valid_until_2008-12-31_at_[hidden])
Date: 2008-07-31 17:20:18
Michael Marcin wrote:
> I remember reading or hearing a long time ago that in C++0x it is an
> error to call std::swap(x,y) directly and you have to do using
> std::swap; swap(x,y);.
Curiously, last year I worried about getting a C++0x error from doing
just that: "using std::swap; swap(x,y);"! Especially when one would use
the C++0x std::Swappable concept. Douglas Gregor dedicated a blog entry
to the issue:
http://conceptgcc.wordpress.com/2007/01/02/revisiting-name-lookup-with-the-swap-example/
> This seems very unfortunate especially since boost can get us
> ADL swap without that in C++03. Does anyone know if
> this is still true?
I really don't know. I /think/ that the current version of the
boost::swap utility should work in C++0x as well, at least in C++0x code
that doesn't have concept checking. Of course, boost::swap doesn't yet
support an rvalue as argument, like C++0x's std::swap will. But other
than that, I think it should work fine. Please let me know if I'm wrong!
Good night, Niels
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk