Boost logo

Boost :

From: Darin Adler (darin_at_[hidden])
Date: 1999-12-10 17:30:30


> | Programs are definitely allowed (and recommended) to specialize function
> | templates like std::swap and std::less; in fact my recent change to
> | smart_ptr.hpp does just that.

> Stop. You can't specialize a template function. You *overload* it. Two
> differents things; althought they might be seen as having similar
> effects.

I had suspected this, given some of what I've been reading in comp.std.c++.

Given this, it seems that there's an error in my additions to smart_ptr.hpp.
The swap() and less() function templates that I added should be in the boost
namespace rather than in the std namespace, since they aren't template
specializations, but rather function templates that overload the existing
function templates.

The current version puts them in namespace std, which is illegal.

This was definitely something I was confused about, and I'd like to get it
right in smart_ptr.hpp.

    -- Darin


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