on Wed Nov 21 2007, Roman Perepelitsa
I need metafunction cross_product, which should transform 2 sequences to a sequence of pairs.
Example:
typedef list
l1; typedef list l2; typedef cross_product ::type c; typedef list< pair , pair , pair , pair e; BOOST_MPL_ASSERT((equal
)); The best definition I came up with is the following:
template
struct product : transform > { }; template
struct cross_product : fold< typename transform >::type, list<>, joint_view<_1, _2> > { }; Is there a better way to do it?
Depends what your criteria for "better-ness" are.
How can I get rid of 'struct product' and implement it as one metafunction?
If you're just trying to minimize the amount of code, the above is pretty good. -- Dave Abrahams Boost Consulting http://www.boost-consulting.com