
Boost : 
Subject: Re: [boost] [MPL] wrapper for if_ selecting integral_c
From: David Abrahams (dave_at_[hidden])
Date: 20081021 15:01:32
on Tue Oct 21 2008, "Jordans, R." <r.jordansATstudent.tue.nl> wrote:
> I've written the template myself, but I need to be able to compile it on different
> systems (Linux, OSX 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;
> };
> }
> }
template <typename C, typename T, T value1, T value2>
struct if_integral_c
: integral_c<T,(C::type::value?value1:value2)>
{};
would be more correct and more interoperable.
> But from what I've understood not all compilers like it when you use a
> template typename parameter as type for other template parameters
Sorry, I don't understand what you mean.
 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