Boost logo

Boost :

From: Darin Adler (darin_at_[hidden])
Date: 1999-12-09 11:57:25


> It struck me that my rational number class could do with a std::abs()
> implementation.

The key here is that this is a new function, overloading the existing one.
The abs in the std namespace is not a template. If it was, a specialization
would belong in std.

Since abs is not a template and the we are overloading abs, not specializing
an existing template, then the thing to do is to put it in the same
namespace as rational. The standard does not allow the option of overloading
in namespace std.

The standard allows adding specializations of templates defined in the std
namespace as long as there's a user-defined name involved, but it doesn't
allow overloading something in the std namespace that's not a template.
[17.4.3.1/1]

    -- Darin


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