|
Boost : |
From: Gabriel Dos Reis (Gabriel.Dos-Reis_at_[hidden])
Date: 1999-12-17 18:08:49
Alan Griffiths <alan_at_[hidden]> writes:
[...]
| >> /2/ Require any client code that references an abs function in a class
| >> where an abs member function exists to use a proxy function like:
| >>
| >> template<typename number_type>
| >> number_type proxy_abs(number_type x)
| >> { using std::abs; return abs(x); )
| >>
| >> (I guess this is what you intend. However, I think this would be a
| >> maintenance disaster.)
| >
| >This is what I do (modulo compiler bugs) in the rational class. It is nasty,
| >but I don't see it as a big issue. Then again, I don't view the rational
| >class as "client" code - it's library code (as will be all generic stuff, in
| >principle), and as such needs to take careful account of such issues.
|
| No but rational<> should appear as much like a fundamental type as
| possible to the eventual user. That user should be able to say
| "std::abs(a_rational)".
It is wrong to let a user believe that rational<> is a fundamental type.
-- Gaby
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk