76 template<
char i,
char ii,
char iii>
80 return one.o_ + two.o_ + three.o_;
84 int fun0 () {
return -1; }
85 int fun1 (
int i1) {
return i1; }
86 int fun2 (
int i1,
int i2) {
return i1+i2; }
87 int fun3 (
int i1,
int i2,
int i3) {
return i1+i2+i3; }
117 check_signatureTypeManip ();
142 check_signatureTypeManip ()
154 NewSig& fun = getNumberz<1,5,9>;
163 cout <<
"\t:\n\t: ---Apply---\n";
174 CHECK (-1 == Apply<0>::invoke<int> (fun0, tup0) );
175 CHECK (11 == Apply<1>::invoke<int> (fun1, tup1) );
176 CHECK (11+12 == Apply<2>::invoke<int> (fun2, tup2) );
177 CHECK (11+12+13 == Apply<3>::invoke<int> (fun3, tup3) );
184 CHECK (-1 == apply(fun0, tup0) );
185 CHECK (11 == apply(fun1, tup1) );
186 CHECK (11+12 == apply(fun2, tup2) );
187 CHECK (11+12+13 == apply(fun3, tup3) );
199 function<int()> functor0 (fun0);
200 function<int(int)> functor1 (fun1);
201 function<int(int,int)> functor2 (fun2);
202 function<int(int,int,int)> functor3 (fun3);
204 CHECK (-1 == Apply<0>::invoke<int> (functor0, tup0) );
205 CHECK (11 == Apply<1>::invoke<int> (functor1, tup1) );
206 CHECK (11+12 == Apply<2>::invoke<int> (functor2, tup2) );
207 CHECK (11+12+13 == Apply<3>::invoke<int> (functor3, tup3) );
212 CHECK (11+12+13 ==
TupleApplicator<
int(
int,
int,
int)> (tup3) (functor3) );
214 CHECK (-1 == apply(functor0, tup0) );
215 CHECK (11 == apply(functor1, tup1) );
216 CHECK (11+12 == apply(functor2, tup2) );
217 CHECK (11+12+13 == apply(functor3, tup3) );
225 cout <<
"\t:\n\t: ---Bind----\n";
232 typedef function<int()> BoundFun;
234 BoundFun functor0 = Apply<0>::bind<BoundFun> (fun0, tup0);
235 BoundFun functor1 = Apply<1>::bind<BoundFun> (fun1, tup1);
236 BoundFun functor2 = Apply<2>::bind<BoundFun> (fun2, tup3);
237 BoundFun functor3 = Apply<3>::bind<BoundFun> (fun3, tup3);
239 CHECK (-1 == functor0() );
240 CHECK (11 == functor1() );
241 CHECK (11+12 == functor2() );
242 CHECK (11+12+13 == functor3() );
249 CHECK (-1 == functor0() );
250 CHECK (11 == functor1() );
251 CHECK (11+12 == functor2() );
252 CHECK (11+12+13 == functor3() );
264 function<int()> unbound_functor0 (fun0);
265 function<int(int)> unbound_functor1 (fun1);
266 function<int(int,int)> unbound_functor2 (fun2);
267 function<int(int,int,int)> unbound_functor3 (fun3);
269 typedef function<int()> BoundFun;
271 BoundFun functor0 = Apply<0>::bind<BoundFun> (unbound_functor0, tup0);
272 BoundFun functor1 = Apply<1>::bind<BoundFun> (unbound_functor1, tup1);
273 BoundFun functor2 = Apply<2>::bind<BoundFun> (unbound_functor2, tup3);
274 BoundFun functor3 = Apply<3>::bind<BoundFun> (unbound_functor3, tup3);
276 CHECK (-1 == functor0() );
277 CHECK (11 == functor1() );
278 CHECK (11+12 == functor2() );
279 CHECK (11+12+13 == functor3() );
286 CHECK (-1 == functor0() );
287 CHECK (11 == functor1() );
288 CHECK (11+12 == functor2() );
289 CHECK (11+12+13 == functor3() );
307 CHECK (-1 == clo0() );
308 CHECK (11 == clo1() );
309 CHECK (11+12 == clo2() );
310 CHECK (11+12+13 == clo3() );
312 function<int()> unbound_functor0 (fun0);
313 function<int(int)> unbound_functor1 (fun1);
314 function<int(int,int)> unbound_functor2 (fun2);
315 function<int(int,int,int)> unbound_functor3 (fun3);
322 CHECK (-1 == clo0() );
323 CHECK (11 == clo1() );
324 CHECK (11+12 == clo2() );
325 CHECK (11+12+13 == clo3() );
327 CHECK (-1 == closure(fun0,tup0) () );
328 CHECK (11 == closure(fun1,tup1) () );
329 CHECK (11+12 == closure(fun2,tup2) () );
330 CHECK (11+12+13 == closure(fun3,tup3) () );
332 CHECK (-1 == closure(unbound_functor0,tup0) () );
333 CHECK (11 == closure(unbound_functor1,tup1) () );
334 CHECK (11+12 == closure(unbound_functor2,tup2) () );
335 CHECK (11+12+13 == closure(unbound_functor3,tup3) () );
346 CHECK (22+33+44 == numClo() );
A template metaprogramming technique for manipulating collections of types.
typename BuildTupleType< TYPES >::Type Tuple
Build a std::tuple from types given as type sequence.
Partial function application and building a complete function closure.
Implementation namespace for support and library code.
Metaprogramming tools for transforming functor types.
Simple test class runner.
A collection of frequently used helper functions to support unit testing.
an extension to typelist-diagnostics.hpp, allowing to dump the contents of a Tuple datatype...
ExampleStrategy::Qualifier two(string additionalArg)
definition of another qualifier two(arg), accepting an additional argument
ExampleStrategy::Qualifier one()
definition of a qualifier one()
Support for writing metaprogramming unit-tests dealing with typelists and flags.
Metaprogramming: Helpers for manipulating lists-of-types.