Boost logo

Boost :

From: Andy Little (andy_at_[hidden])
Date: 2004-07-04 09:58:26


"Andy Little" <andy_at_[hidden]> wrote in message
news:cc8gss$7c8$1_at_sea.gmane.org...
>
> result_of<operator_plus(int,int)>::type z = operator_plus()(x,y);
> result_of<operator_minus(int,int)>::type z = operator_minus()(x,y);
> result_of<operator_multiplies(int,int)>::type z =
> operator_multiplies()(x,y);

One problem with this scheme is getting traits information out of it. For
instance the original std::plus has std::plus<T>::first_argument_type.
If operator_plus is a plain class, operator_plus(A,B) is in fact just three
encoded parameters so always has to be wrapped in something if passed as one
parameter, (Please correct me if I'm wrong, I'm not too up on function
object template params), whereas operator_plus<A,B> works as one parameter
and as a traits class.

result_of<operator_plus<A,B> >::type seems to be a lot simpler to deal with
in this respect than result_of<operator_plus(A,B) >:: type

Apologies for sending 4 posts in a row. I would like to use 'official
methods' if possible, but this whole area is quite important to my
physical-quantities project.

regards
Andy Little


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