#include "boost/fusion/adapted/mpl.hpp" #include "boost/fusion/container/map/convert.hpp" #include "boost/fusion/sequence/intrinsic/at.hpp" #include "boost/fusion/support/pair.hpp" #include "boost/fusion/view/transform_view.hpp" using namespace boost; struct TestType0 : mpl::int_<0> {}; struct TestType1 : mpl::int_<1> {}; struct TestType2 : mpl::int_<2> {}; struct TestType3 : mpl::int_<3> {}; struct TestType4 : mpl::int_<4> {}; struct TestType5 : mpl::int_<5> {}; struct TestType6 : mpl::int_<6> {}; struct TestType7 : mpl::int_<7> {}; struct TestType8 : mpl::int_<8> {}; struct TestType9 : mpl::int_<9> {}; typedef fusion::vector10 < TestType0, TestType1, TestType2, TestType3, TestType4, TestType5, TestType6, TestType7, TestType8 > MainTypes; struct OddWidget { int dummy_; }; struct EvenWidget { int dummy_; }; struct Transformer { template struct result; template struct result : fusion::pair::type> {}; }; int main() { typedef boost::fusion::transform_view < MainTypes, Transformer > WidgetsView; typedef typename boost::fusion::result_of::as_map < WidgetsView >::type WidgetContainer; WidgetContainer widgets; return fusion::at_key( widgets ).dummy_; }