Subject: Re: [boost] [swap] please update documentation with the header I need to include
From: Daniel James (daniel_james_at_[hidden])
Date: 2009-06-29 06:07:29
2009/6/29 Peter Simons <simons_at_[hidden]>:
> Hi Niels,
> > [It's] not recommended to do an unqualified call to boost::swap:
> > std::string a1;
> > std::string a2;
> > 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().
Try it. std::swap can't swap arrays, boost::swap can. boost::swap will
also call swap via. ADL when appropriate and supports compilers that
don't support ADL. Which is why it's recommended that 'boost::swap' is
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk