Boost logo

Boost :

Subject: Re: [boost] [MPL] wrapper for if_ selecting integral_c
From: David Abrahams (dave_at_[hidden])
Date: 2008-10-20 12:13:08


on Mon Oct 20 2008, "Jordans, R." <r.jordans-AT-student.tue.nl> wrote:

> Hi,
>
> 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

You can easily write that template yourself if you need it. What is the
"type" argument above supposed to do?

-- 
Dave Abrahams
BoostPro Computing
http://www.boostpro.com

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk