
OK, part of the problem is that mpl only supports vectors and lists of maximum size 20 by default. I guess vectors with several thousands of elements are beyond the realms of MPL code. Stephan Stephan Tolksdorf wrote:
Hi
I'm trying to build a mpl::vector which looks like
[(a,1),(a,2),...,(a,a),(a+1,1),...,(b,b)],
where a < b are int's and (x,y) stands for mpl::pair< int_<x>, int_<y> >.
The following code does not compile with MSVC 8. Could somebody tell me what's wrong with my code? Does someone have an idea how to solve this problem more elegantly with MPL? Any help is much appreciated.
Code snippet with the vector named "ListofNMPairs":
template <typename N> struct NPush : mpl::lambda< mpl::push_front< mpl::_1, mpl::pair
> >::type { }; template <typename S> struct MyRange : mpl::reverse_fold< mpl::range_c
, mpl::vector< >, NPush<S> >::type { }; typedef mpl::reverse_fold< mpl::range_c
, // a=16, b=65 mpl::vector< >, mpl::insert_range< mpl::_1, mpl::beginmpl::_1, MyRangempl::_2 > ::type ListofNMPairs;
Regards, Stephan