Quote:Original post by Nitage
Ok - slightly different question:
If I have two types, say A and B, is there any expression which gives me the return type of A*B?
I'm using an older version of something that was in the boost sandbox for that, but I think it's been replaced by boost::mpl. I currently use something that looks like this:
boost::result_of_plus<A, B>::type
boost::result_of_multiplies<A, B>::type
and you can specialize the result_of structs for your own custom types as well. If you'd like the header I can send it to you, but it did not make it into any official boost release. Again, I think the functionality got folded into boost::mpl. Someone else may know for sure.
Here's an example (It's pretty ugly though).
template <typename LHS, typename RHS>inline typename boost::result_of_plus<LHS, RHS>::type operator +(const LHS &lhs, const RHS &rhs){ typename boost::result_of_plus<LHS, RHS>::type nrv(lhs); nrv += rhs; return nrv;}