I have a template class with an overloaded + operator. This is working fine when I am adding two ints or two doubles. How do I get it to add and int and a double and return th
Get a compiler that supports the new C++0x decltype operator.
template < typename T1, typename T2 > auto add(T1 t1, T2 t2) -> decltype(t1+t2) { return t1 + t2; }
Now you don't have to fart around with those "traits" classes.