Boost logo

Boost :

Subject: Re: [boost] [swap] please update documentation with the header I need to include
From: Frank Mori Hess (frank.hess_at_[hidden])
Date: 2009-06-29 10:43:38


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Monday 29 June 2009, Peter Simons wrote:
> Hi Niels,
>
> > [It's] not recommended to do an unqualified call to boost::swap:
> >
> > std::string a1[42];
> > std::string a2[42];
> >
> > boost::swap(a1, a2); // Okay.
> >
> > using boost::swap;
> > swap(a1, a2); // Does not compile!
>
> why do you think this code won't compile? As far as I can tell, ADL
> would resolve the call to invoke std::swap(). In fact, ADL is the very
> reason why some people recommend the exact opposite of what you've been
> saying, i.e. swap() should always be called unqualified.

They recommend that swap be called unqualified and ADL used in the context of
working around the limitations of std::swap. boost::swap on the other hand
handles the ADL internally.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)

iEYEARECAAYFAkpI0xoACgkQ5vihyNWuA4W91QCgz4XGn+jpGf3GUSN0u4K9NUAZ
cm0AoJRs/ghIj8Be+QoLsCeSj6gYxsdc
=8AkT
-----END PGP SIGNATURE-----


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk