[mpl] integer for_each

Hi.
I have a function which is templated with an integer
template <int N>
void f()
{
...
}
Within this function, I wish to use mpl::for_each to call another
integer-templated (say, g()) function, with all numbers from 0 to N-1.
How can I achieve this?
I thought of making a mpl::vector

Yuval Ronen wrote:
Hi. I have a function which is templated with an integer
template <int N> void f() { ... }
Within this function, I wish to use mpl::for_each to call another integer-templated (say, g()) function, with all numbers from 0 to N-1.
How can I achieve this?
I thought of making a mpl::vector
, int_<1>, ..., int_<N-1> >, and then use mpl::for_each to iterate it, but I don't know how to generate this mpl::vector. How can I do that? Or maybe there's a better way? BTW: I first thought of using mpl::vector_c, but it seems that mpl:for_each doesn't support mpl::vector_c, only mpl::vector. Is this true?
See mpl::range_c HTH, Dave -- Dave Abrahams Boost Consulting http://www.boost-consulting.com
participants (2)
-
David Abrahams
-
Yuval Ronen