#include #include #include "HierarchyGenerators.h" using namespace ::Loki; // // Helper class for simulating (ranking) partial ordering // template struct Order : Order {}; template<> struct Order<0> {}; template class Unit> class PrintGenScatterHierarchy { template PrintGenScatterHierarchy(GenScatterHierarchy, Unit> *a, Order<1>) { printf("%s\n", typeid(*a).name()); GenScatterHierarchy *left = a; PrintGenScatterHierarchy X1(left); GenScatterHierarchy *right = a; PrintGenScatterHierarchy X2(right); } template PrintGenScatterHierarchy(GenScatterHierarchy *a, Order<0>) { printf("%s\n", typeid(*a).name()); Unit *left = a; (void)left; printf("%s\n", typeid(*left).name()); } PrintGenScatterHierarchy(GenScatterHierarchy *a, Order<1>) { (void)a; printf("%s\n", typeid(*a).name()); } public: template explicit PrintGenScatterHierarchy(GenScatterHierarchy *a) { PrintGenScatterHierarchy(a, Order<1>()); } }; template class TestUnit {}; template struct A {}; int main() { typedef TYPELIST_10(A<1>, A<2>, A<3>, A<4>, A<5>, A<6>, A<7>, A<8>, A<9>, A<10>) TestList_t; GenScatterHierarchy TestGenScatterHierarchy; PrintGenScatterHierarchy X(&TestGenScatterHierarchy); }