
On 03/12/08 09:56, Max Motovilov wrote:
No, they don't look similar. As far as I can tell from a one-minute look, the solution is simply a nested for_each loop and does not provide an actual sequence adapter, despite the name cross_product_view.
That's the danger of one-minute looks... I take that back. Yes, the whole thing is a sequence and output pairs are indeed lazily generated. I am not sure if this approach can be generalized to an arbitrary number of sequences. Perhaps it can be, by making the whole thing a recursive template instead of 3 separate ones. I'd try it just to see which version results in simpler code (gut feeling: the recursive template) and in faster compilation times (gut feeling: my current implementation) but customers and management are jointly snapping at my heels...
So, in view of that, could you explain why it's not a sequence adapter?
The usual explanation: needed more coffee :)
I'm afraid I was wrong. here's what I get as the transform output with my type_name_print: test_product boost::mpl::cross_product_view < boost::mpl::range_c < int , 0 , 3
, boost::mpl::range_c < int , 100 , 104
where the function producing this is: typedef mpl::range_c<int,0,3> seq0; typedef mpl::range_c<int,100,104> seq1; void test_product(void) { std::cout<<"test_product\n"; typedef mpl::cross_product_view<seq0,seq1> type; #ifdef TYPE_TREE_PRINT ::utility::type_name_print<type>(); #else type::print_each(); #endif } and with #define TYPE_TREE_PRINT. Which I expected to see was something contains pair's of mpl::integral_c<int,I>. So..., the code I posted is useless :( Sorry for noise. Back to drawing board.