Boost logo

Boost :

From: Niels Dekker - mail address until 2008-12-31 (nd_mail_address_valid_until_2008-12-31_at_[hidden])
Date: 2008-08-01 10:39:01


> What about removing the using-declaration, "using std::swap;", and
> adding an extra function, boost_swap_impl::swap<T>? Which would
> directly call std::swap, as follows:
>
> namespace boost_swap_impl
> {
> template<class T>
> void swap(T& left, T& right)
> {
> std::swap(left,right);
> }
> }

Hmmm... not such a good idea of mine! Doing so would lead to ambiguity
when the type T would /not/ have its own swap overload, while it would
have the std namespace as an associated namespace. For example, when T
would be a pointer-to-std::string or an std::time_base::dateorder enum.

I wish this boost_swap_impl::swap could have been a little less
"specialized"! (But still, it would need to be more specialized than
boost::swap itself!)

Anyway, I think we should add unit tests for std types!

Kind regards, Niels


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