Boost logo

Boost Users :

Subject: Re: [Boost-users] [boost] [type traits] Extension to operator detection -> choose your preferred naming
From: Frédéric Bron (frederic.bron_at_[hidden])
Date: 2011-08-29 14:33:50


> 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
>
> I just wanted to make the connection between the two problems; and hopeful
> solve the has_operator and typeof_operator problem together.

The operator traits can detect if the operator return value can be
converted to a given type but not the precise return type.

> 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.

has_operator_multiplies<A, B>::value is false.

Frédéric


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net