Boost logo

Boost :

Subject: Re: [boost] [MPL] wrapper for if_ selecting integral_c
From: Jordans, R. (r.jordans_at_[hidden])
Date: 2008-10-21 04:32:47

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

The idea there would be the same as in integral_c, to specify the type of value to select

I've written the template myself, but I need to be able to compile it on different systems (Linux, OS-X and Windows) and I'm not sure if every compiler will like it

My code for the template is as follows:

namespace boost {
    namespace mpl {
        template <typename C, typename T, T value1, T value2>
           struct if_integral_c
            static const T value =
              if_<C, integral_c<T, value1>, integral_c<T, value2> >::type::value;

But from what I've understood not all compilers like it when you use a template typename parameter as type for other template parameters

Is there a more universal solution to this or should I fix the types of value1 and value2 and cast it later to the correct type?


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