47_Pragma(
"GCC diagnostic ignored \"-Woverloaded-virtual\"")
59 string talk() {
return "__"+name+
"__"; }
65 string Block<I>::name =
_Fmt(
"Block<%2i>") % I;
74 virtual void eat (X& x) = 0;
79 template<
class X,
class BASE>
84 DoIt () { cout <<
"ctor DoIt<"<< X::name <<
" >\n";}
85 virtual ~DoIt() { cout <<
"dtor DoIt<"<< X::name <<
" >\n";}
87 void eat (X& x) { cout <<
"devouring" << x.talk() <<
"\n";}
91 using TheTypes = Types< Block<1>
99 typedef InstantiateForEach<TheTypes,TakeIt> TheInterface;
102 struct BaseImpl :
public TheInterface
104 void eat() { cout <<
"gulp!\n"; }
107 typedef InstantiateChained<TheTypes,DoIt, BaseImpl> NumberBabbler;
116 class TypeListGenerator_test :
public Test
121 NumberBabbler me_can_has_more_numberz;
123 CHECK (
INSTANCEOF (TheInterface, &me_can_has_more_numberz));
125 TheTypes::Tail::Head b2;
126 TheTypes::Tail::Tail::Tail::Head b5;
127 TheTypes::Tail::Tail::Tail::Tail::Tail::Head b13;
129 me_can_has_more_numberz.eat (b2);
130 me_can_has_more_numberz.eat (b5);
132 TakeIt<Block<13>>& subInterface = me_can_has_more_numberz;
134 subInterface.eat (b13);
135 me_can_has_more_numberz.eat();
137 INFO (
test,
"SizeOf = %zu",
sizeof(me_can_has_more_numberz));
143 LAUNCHER (TypeListGenerator_test,
"unit common");