Boost logo

Boost :

From: Dietmar Kuehl (dietmar_kuehl_at_[hidden])
Date: 2001-01-31 21:07:07


Matthew Austern wrote:

> I don't really see this as more than half a solution, because standard
> library implementors can't use it without a whole lot of changes in the
> library portions of the C++ standard. You certainly couldn't use
> swap_t when writing std::sort(), or abs_t when writing std::valarray().

Why would an algorithm want to use 'swap_t'? 'swap_t' is only used for
two purposes:
- To implement 'swap()'.
- To allow users partial specialization of 'swap()', although somewhat
  indirectly.

Of course, a library implementation conforming to the current standard
would call 'swap_t' something like '_Swap_t' to stay in the correct
namespace but other than that I don't see any reason not to use 'swap_t'
for the implementation of 'swap()' and documenting this fact: It would be
a conforming extension to allow users [partial] specialization of '_Swap_t'.
If this approach is mandated by the next revision of the standard, the
names would change but this should not be a problem because the next
standard will [hopefully] allow template typedef's, too :-)


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