Boost logo

Boost :

From: Daniel Frey (daniel.frey_at_[hidden])
Date: 2004-07-29 02:14:56


Arkadiy Vertleyb wrote:
> However, when I use the native support, I run into a different problem that
> can be illustrated by the following code:
>
> template<class T, class U>
> typeof(T() + U()) sum(const T& t, const U& u)
> {
> return t + u;
> }

That's a common problem. You need to declare a function to return the
temporaries you need, this usually helps:

template< typename T > T provide();

template< typename T, typename U >
typeof( provide<T>() + provide<U>() ) sum(...) {}

Regards, Daniel

-- 
Daniel Frey
aixigo AG - financial solutions & technology
Schloß-Rahe-Straße 15, 52072 Aachen, Germany
fon: +49 (0)241 936737-42, fax: +49 (0)241 936737-99
eMail: daniel.frey_at_[hidden], web: http://www.aixigo.de
The hacks that we write today become the bugs of tomorrow.

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