Boost logo

Boost :

Subject: [boost] [MPL] wrapper for if_ selecting integral_c
From: Jordans, R. (r.jordans_at_[hidden])
Date: 2008-10-20 07:05:45


I would like to suggest an addition to Boost MPL. In the project I am working on I often need to select integral values, either using MPL or home-brew template logic. Where MPL is preferred due to consistency.

This requires me to do something like:

int value = if_<condition, int_<value1>, int_<value2> >::type::value;

Which (when adding namespaces to the above) is too much typing in my opinion and reduces readability of my code.

Would it be useful to add a new variant of if_ to Boost MPL that would enable the following? (by combining the syntax of if_ and integral_c)

type value = if_integral_c<condition, type, value1, value2>::value

Best regards,
Roel Jordans

Boost list run by bdawes at, gregod at, cpdaniel at, john at