#include #include #include #include #include #include #include struct print { template void operator()(const T &_r) const { //std::cout << typeid(T).name() << "\n"; (*this)(_r, typename boost::mpl::is_sequence::type()); } template void operator()(const T &, const boost::mpl::true_ &) const { std::cout << "(\n"; boost::mpl::for_each(print()); std::cout << ")\n"; } template void operator()(const boost::mpl::pair &, const boost::mpl::false_ &) const { std::cout << "pair(" << typeid(T0).name() << ", " << typeid(T1).name() << ")" << "\n"; } template void operator()(const T &, const boost::mpl::false_ &) const { std::cout << typeid(T).name() << "\n"; } }; namespace boost { //namespace type_traits //{ //template //struct is_same; using boost::mpl::map; using boost::mpl::true_; using boost::mpl::insert; template struct is_same, map > { typedef boost::mpl::true_ type; }; template struct is_same, map > { typedef boost::mpl::true_ type; }; template struct is_same, map > { typedef boost::mpl::true_ type; }; template struct is_same, map > { typedef boost::mpl::true_ type; }; template struct is_same, map > { typedef boost::mpl::true_ type; }; //} } int main(int argc, char **argv) { using boost::mpl::long_; using boost::mpl::for_each; using boost::mpl::set; using boost::mpl::map; using boost::mpl::pair; using boost::mpl::insert; typedef long_<0> zero; typedef long_<1> one; typedef long_<2> two; typedef pair< zero, one > zero_2_one; typedef pair< one, one > one_2_one; for_each< insert< insert< set<>, insert< insert< map<>, zero_2_one >::type, one_2_one >::type >::type, insert< insert< map<>, one_2_one >::type, zero_2_one >::type >::type >(print()); return 0; }