Boost logo

Boost :

From: Gabriel Dos Reis (dosreis_at_[hidden])
Date: 1999-12-10 17:26:27


Darin Adler <darin_at_[hidden]> writes:

| > So the letter of the law makes it illegal, but was this really the
| > intention? Seems to me this causes nasty problems for generic
| > libraries. Since std::abs() is not all-applicable, it forces
| > the *user* to do "using std::abs;" etc, for every operation
| > of this nature that is used in the algorithm. What if the algorithm
| > is large and there are lots of these? Nasty barrier to reuse...
|
| In a template function definition, it seems that you could put "using
| std::abs" inside the function scope and then call abs(), instead of calling
| std::abs() directly. Would that work?

Definitely yes.

| I think the reason that std::abs is not a function template is the fact that
| it comes from the C header <math.h>/<cmath>.

Actually, I see no good reason to make std::abs() a template
function. We should not start overusing template as that was the case
with classes. std::rel_op::* is a good example of what we should avoid.

-- Gaby


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