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> I didn't quite follow that. Let's assume both auto and strict typeof:
hsutte> template<typename A, typename B>
hsutte> operator+(A a, B b)
hsutte> {
hsutte> return a + b;
hsutte> }
hsutte> typeof( operator+<X,Y>( X(), Y() ) )
hsutte> typeof( X() + Y() )
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> Herb

 Jeremy Siek
 Ph.D. Student, Indiana Univ. B'ton email: jsiek_at_[hidden]
 C++ Booster ( office phone: (812) 855-3608

Boost list run by bdawes at, gregod at, cpdaniel at, john at