Boost logo

Boost :

From: Daniel Frey (daniel.frey_at_[hidden])
Date: 2004-07-29 08:18:42


Arkadiy Vertleyb wrote:
> I am afraid this doesnt help :(

Oops, my fault. But the following works, at least on the 3.3.1 where I
tested it 2 minutes ago :)

template<class T, class U> struct operator_plus_result
{
    static T t();
    static U u();
    typedef __typeof__( t() + u() ) type;
};

template<class T, class U>
typename operator_plus_result<T,U>::type
sum(const T& t, const U& u)
{
    return t + u;
}

int main()
{
    sum(5, 3.14);
}

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