Why use boost :: ice_or instead of || and boost :: ice_and instead of && in enable_if?

As stated in the question, is there a reason why people use the version of the structure over normal conditional expressions?

+5
source share
1 answer

Excerpt from Acceleration Encoding Recommendation for Integral Constant Expressions :

Do not use logical operators in integral constant expressions; use meta-programming templates instead.

The header contains several workaround patterns that act as logical operators, for example, instead of:

INTEGRAL_CONSTANT1 || INTEGRAL_CONSTANT2

Using:

::boost::type_traits::ice_or<INTEGRAL_CONSTANT1,INTEGRAL_CONSTANT2>::value

. ( , Borland Microsoft), , , , . , , .

. ( , .)

+9

All Articles