Boost logo

Boost :

From: Jeremy Siek (jsiek_at_[hidden])
Date: 2002-02-19 15:01:31


Also the example has the problem that you can't define operator+ as a pure
function template. One of the arguments needs to be a user defined type.

On Tue, 19 Feb 2002, Herb Sutter wrote:
hsutte>
hsutte> I didn't quite follow that. Let's assume both auto and strict typeof:
hsutte>
hsutte> template<typename A, typename B>
hsutte> operator+(A a, B b)
hsutte> {
hsutte> return a + b;
hsutte> }
hsutte>
hsutte> typeof( operator+<X,Y>( X(), Y() ) )
hsutte> typeof( X() + Y() )
hsutte>
hsutte> In this example, what is the type you are looking for? Can the two be
hsutte> different? I'm actually still trying to get my head around operator+ invoking
hsutte> operator+ on its own operands, which looks infinitely recursive, so I'm sure I
hsutte> don't yet understand the problem and I want to be educated. Thanks,
hsutte>
hsutte> Herb

----------------------------------------------------------------------
 Jeremy Siek http://php.indiana.edu/~jsiek/
 Ph.D. Student, Indiana Univ. B'ton email: jsiek_at_[hidden]
 C++ Booster (http://www.boost.org) office phone: (812) 855-3608
----------------------------------------------------------------------


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