On 19/02/11 06:51, Frédéric Bron wrote:
Is it possible to determine at compile-time if a type has subtraction semantics? E.g. in struct A<T> I would like to decide at compile-time not to execute&A::subtract in the register_fns method. Then the subtract method is not instantiated and there is no error.
You can look at the code that will be reviewed soon for an extension of type traits.
#include
boost::has_operator_minus
::value is what you want: is true if x-y returns something convertible to T is false if operator-(T, T) does not exist.
This looks good but it isn't compiling for me right now. Just compiling
this include:
#include