Boost logo

Boost Users :

From: suresh.t_at_[hidden]
Date: 2005-01-21 05:58:51


hi,

I am new to boost.
I have a class that takes in 10 template parameters (std::size_t N1 to
N10).

I need to create a mpl::list_c using N1 to N10. I have an empty
mpl::list_c (acc). I plan to check each of N1 to N10 and if the value > 0
i will insert into the list.
Can someone please tell me how i could do this. I have tried for one N1
alone using an mpl::if_ but that doest seem to work

template <std::size_t N1,std::size_t N2 =0,std::size_t N3 = 0,
       std::size_t N4 = 0,std::size_t N5 = 0,
       std::size_t N6 = 0,std::size_t N7 = 0,
       std::size_t N8 = 0,std::size_t N9 = 0,std::size_t N10 = 0>
struct access_list{

typedef mpl::list_c<int> acc;

//I tried for N1 this way but this does not word
typedef mpl::if_<
        mpl::bool_<N1 != 0>,
        typename mpl::push_back<acc,mpl::int_<N1> >::type,
        mpl::false_
>::type type;
};
---------------------------------------------------------------------------------------------------------
Suresh


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net