On Tuesday, August 23, 2011 11:22:45 PM UTC-7, Frédéric Bron wrote:
It is time to include the type trait extension to the official boost trunk.
These traits can detect if you can use a given operator with given arguments.

For example: has_plus<double, int>::value is true because the
following program compiles without error:
double lhs;
int rhs;
lhs+rhs;


I just want to make the connection with the thread I opened last week: "[math][tools][units] generic libraries not generic enough"

The point I want to make is that if there were a uniform facility to deduce the result of a built-in operator over some arithmetic types then library authors could do a better job at writting generic libraries on some exotic arithmetic types and combinations, for example

multiply_typeof_helper<double, int>::type --> double

the name is of course borrowed from boost.Units were it is intesively used:

boost::unit::multiplies_typeof_helper<quantity<si::length>, quantity<si::length> >::type --> quantity<si::area>

I just wanted to make the connection between the two problems; and hopeful solve the has_operator and typeof_operator problem together.

Alfredo
PS: what if to types can not be multiplied, etc, the has_multiplies will tell or
multiplies_typeof_helper can return void, or boost::none.

We have come to three proposed lists of names (A, B and C):
https://svn.boost.org/trac/boost/wiki/GuideLines/Naming/OperatorTraitNames
I have included the corresponding names of standard keywords, standard
function objects from <functional>, boost Proto and boost Operators.

Please give your preference between A, B and C before Sept. 5th.

Regards,

Frédéric
______________________________
_________________
Boost-users mailing list
Boost...@lists.boost.org
http://lists.boost.org/mailman/listinfo.cgi/boost-users