67 template<
char i,
char ii,
char iii>
71 return one.o_ + two.o_ + three.o_;
75 int fun0 () {
return -1; }
76 int fun1 (
int i1) {
return i1; }
77 int fun2 (
int i1,
int i2) {
return i1+i2; }
78 int fun3 (
int i1,
int i2,
int i3) {
return i1+i2+i3; }
108 check_signatureTypeManip ();
133 check_signatureTypeManip ()
145 NewSig& fun = getNumberz<1,5,9>;
154 cout <<
"\t:\n\t: ---Apply---\n";
165 CHECK (-1 == Apply<0>::invoke<int> (fun0, tup0) );
166 CHECK (11 == Apply<1>::invoke<int> (fun1, tup1) );
167 CHECK (11+12 == Apply<2>::invoke<int> (fun2, tup2) );
168 CHECK (11+12+13 == Apply<3>::invoke<int> (fun3, tup3) );
175 CHECK (-1 == apply(fun0, tup0) );
176 CHECK (11 == apply(fun1, tup1) );
177 CHECK (11+12 == apply(fun2, tup2) );
178 CHECK (11+12+13 == apply(fun3, tup3) );
190 function<int()> functor0 (fun0);
191 function<int(int)> functor1 (fun1);
192 function<int(int,int)> functor2 (fun2);
193 function<int(int,int,int)> functor3 (fun3);
195 CHECK (-1 == Apply<0>::invoke<int> (functor0, tup0) );
196 CHECK (11 == Apply<1>::invoke<int> (functor1, tup1) );
197 CHECK (11+12 == Apply<2>::invoke<int> (functor2, tup2) );
198 CHECK (11+12+13 == Apply<3>::invoke<int> (functor3, tup3) );
203 CHECK (11+12+13 ==
TupleApplicator<
int(
int,
int,
int)> (tup3) (functor3) );
205 CHECK (-1 == apply(functor0, tup0) );
206 CHECK (11 == apply(functor1, tup1) );
207 CHECK (11+12 == apply(functor2, tup2) );
208 CHECK (11+12+13 == apply(functor3, tup3) );
216 cout <<
"\t:\n\t: ---Bind----\n";
223 typedef function<int()> BoundFun;
225 BoundFun functor0 = Apply<0>::bind<BoundFun> (fun0, tup0);
226 BoundFun functor1 = Apply<1>::bind<BoundFun> (fun1, tup1);
227 BoundFun functor2 = Apply<2>::bind<BoundFun> (fun2, tup3);
228 BoundFun functor3 = Apply<3>::bind<BoundFun> (fun3, tup3);
230 CHECK (-1 == functor0() );
231 CHECK (11 == functor1() );
232 CHECK (11+12 == functor2() );
233 CHECK (11+12+13 == functor3() );
240 CHECK (-1 == functor0() );
241 CHECK (11 == functor1() );
242 CHECK (11+12 == functor2() );
243 CHECK (11+12+13 == functor3() );
255 function<int()> unbound_functor0 (fun0);
256 function<int(int)> unbound_functor1 (fun1);
257 function<int(int,int)> unbound_functor2 (fun2);
258 function<int(int,int,int)> unbound_functor3 (fun3);
260 typedef function<int()> BoundFun;
262 BoundFun functor0 = Apply<0>::bind<BoundFun> (unbound_functor0, tup0);
263 BoundFun functor1 = Apply<1>::bind<BoundFun> (unbound_functor1, tup1);
264 BoundFun functor2 = Apply<2>::bind<BoundFun> (unbound_functor2, tup3);
265 BoundFun functor3 = Apply<3>::bind<BoundFun> (unbound_functor3, tup3);
267 CHECK (-1 == functor0() );
268 CHECK (11 == functor1() );
269 CHECK (11+12 == functor2() );
270 CHECK (11+12+13 == functor3() );
277 CHECK (-1 == functor0() );
278 CHECK (11 == functor1() );
279 CHECK (11+12 == functor2() );
280 CHECK (11+12+13 == functor3() );
298 CHECK (-1 == clo0() );
299 CHECK (11 == clo1() );
300 CHECK (11+12 == clo2() );
301 CHECK (11+12+13 == clo3() );
303 function<int()> unbound_functor0 (fun0);
304 function<int(int)> unbound_functor1 (fun1);
305 function<int(int,int)> unbound_functor2 (fun2);
306 function<int(int,int,int)> unbound_functor3 (fun3);
313 CHECK (-1 == clo0() );
314 CHECK (11 == clo1() );
315 CHECK (11+12 == clo2() );
316 CHECK (11+12+13 == clo3() );
318 CHECK (-1 == closure(fun0,tup0) () );
319 CHECK (11 == closure(fun1,tup1) () );
320 CHECK (11+12 == closure(fun2,tup2) () );
321 CHECK (11+12+13 == closure(fun3,tup3) () );
323 CHECK (-1 == closure(unbound_functor0,tup0) () );
324 CHECK (11 == closure(unbound_functor1,tup1) () );
325 CHECK (11+12 == closure(unbound_functor2,tup2) () );
326 CHECK (11+12+13 == closure(unbound_functor3,tup3) () );
337 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.
Simplistic 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.