Boost logo

Boost :

From: Kevlin Henney (Kevlin.Henney_at_[hidden])
Date: 1999-12-10 05:10:54


> There is a std::abs() template function, for the complex class.
> Therefore it is both legal to put the rational abs() function in the
> std namespace and highly recommended since a generic algorithm should
> be able to use std::abs() on any numeric type including user defined
> types.

Unfortunately this qualifies as an overload rather than a specialisation,
and so therefore is not permitted. The abs for complex is in terms of
complex<T> rather than simply just T, and so although you would be
permitted to specialise abs for complex< rational<T> > this does not give
you general licence to specialise for rational<T>.

Kevlin


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