YugabyteDB (2.13.0.0-b42, bfc6a6643e7399ac8a0e81d06a3ee6d6571b33ab)

Coverage Report

Created: 2022-03-09 17:30

/Users/deen/code/yugabyte-db/src/yb/gutil/tuple.h
Line
Count
Source (jump to first uncovered line)
1
// Copyright (c) 2011 The Chromium Authors. All rights reserved.
2
// Use of this source code is governed by a BSD-style license that can be
3
// found in the LICENSE file.
4
//
5
// The following only applies to changes made to this file as part of YugaByte development.
6
//
7
// Portions Copyright (c) YugaByte, Inc.
8
//
9
// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
10
// in compliance with the License.  You may obtain a copy of the License at
11
//
12
// http://www.apache.org/licenses/LICENSE-2.0
13
//
14
// Unless required by applicable law or agreed to in writing, software distributed under the License
15
// is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
16
// or implied.  See the License for the specific language governing permissions and limitations
17
// under the License.
18
//
19
20
// A Tuple is a generic templatized container, similar in concept to std::pair.
21
// There are classes Tuple0 to Tuple6, cooresponding to the number of elements
22
// it contains.  The convenient MakeTuple() function takes 0 to 6 arguments,
23
// and will construct and return the appropriate Tuple object.  The functions
24
// DispatchToMethod and DispatchToFunction take a function pointer or instance
25
// and method pointer, and unpack a tuple into arguments to the call.
26
//
27
// Tuple elements are copied by value, and stored in the tuple.  See the unit
28
// tests for more details of how/when the values are copied.
29
//
30
// Example usage:
31
//   // These two methods of creating a Tuple are identical.
32
//   Tuple2<int, const char*> tuple_a(1, "wee");
33
//   Tuple2<int, const char*> tuple_b = MakeTuple(1, "wee");
34
//
35
//   void SomeFunc(int a, const char* b) { }
36
//   DispatchToFunction(&SomeFunc, tuple_a);  // SomeFunc(1, "wee")
37
//   DispatchToFunction(
38
//       &SomeFunc, MakeTuple(10, "foo"));    // SomeFunc(10, "foo")
39
//
40
//   struct { void SomeMeth(int a, int b, int c) { } } foo;
41
//   DispatchToMethod(&foo, &Foo::SomeMeth, MakeTuple(1, 2, 3));
42
//   // foo->SomeMeth(1, 2, 3);
43
44
#ifndef BASE_TUPLE_H__
45
#define BASE_TUPLE_H__
46
47
#include "yb/gutil/bind_helpers.h"
48
49
// Traits ----------------------------------------------------------------------
50
//
51
// A simple traits class for tuple arguments.
52
//
53
// ValueType: the bare, nonref version of a type (same as the type for nonrefs).
54
// RefType: the ref version of a type (same as the type for refs).
55
// ParamType: what type to pass to functions (refs should not be constified).
56
57
template <class P>
58
struct TupleTraits {
59
  typedef P ValueType;
60
  typedef P& RefType;
61
  typedef const P& ParamType;
62
};
63
64
template <class P>
65
struct TupleTraits<P&> {
66
  typedef P ValueType;
67
  typedef P& RefType;
68
  typedef P& ParamType;
69
};
70
71
template <class P>
72
struct TupleTypes { };
73
74
// Tuple -----------------------------------------------------------------------
75
//
76
// This set of classes is useful for bundling 0 or more heterogeneous data types
77
// into a single variable.  The advantage of this is that it greatly simplifies
78
// function objects that need to take an arbitrary number of parameters; see
79
// RunnableMethod and IPC::MessageWithTuple.
80
//
81
// Tuple0 is supplied to act as a 'void' type.  It can be used, for example,
82
// when dispatching to a function that accepts no arguments (see the
83
// Dispatchers below).
84
// Tuple1<A> is rarely useful.  One such use is when A is non-const ref that you
85
// want filled by the dispatchee, and the tuple is merely a container for that
86
// output (a "tier").  See MakeRefTuple and its usages.
87
88
struct Tuple0 {
89
  typedef Tuple0 ValueTuple;
90
  typedef Tuple0 RefTuple;
91
  typedef Tuple0 ParamTuple;
92
};
93
94
template <class A>
95
struct Tuple1 {
96
 public:
97
  typedef A TypeA;
98
99
  Tuple1() {}
100
  explicit Tuple1(typename TupleTraits<A>::ParamType a_) : a(a_) {}
101
102
  A a;
103
};
104
105
template <class A, class B>
106
struct Tuple2 {
107
 public:
108
  typedef A TypeA;
109
  typedef B TypeB;
110
111
  Tuple2() {}
112
  Tuple2(typename TupleTraits<A>::ParamType a_,
113
         typename TupleTraits<B>::ParamType b_)
114
      : a(a_), b(b_) {
115
  }
116
117
  A a;
118
  B b;
119
};
120
121
template <class A, class B, class C>
122
struct Tuple3 {
123
 public:
124
  typedef A TypeA;
125
  typedef B TypeB;
126
  typedef C TypeC;
127
128
  Tuple3() {}
129
  Tuple3(typename TupleTraits<A>::ParamType a_,
130
         typename TupleTraits<B>::ParamType b_,
131
         typename TupleTraits<C>::ParamType c_)
132
      : a(a_), b(b_), c(c_){
133
  }
134
135
  A a;
136
  B b;
137
  C c;
138
};
139
140
template <class A, class B, class C, class D>
141
struct Tuple4 {
142
 public:
143
  typedef A TypeA;
144
  typedef B TypeB;
145
  typedef C TypeC;
146
  typedef D TypeD;
147
148
  Tuple4() {}
149
  Tuple4(typename TupleTraits<A>::ParamType a_,
150
         typename TupleTraits<B>::ParamType b_,
151
         typename TupleTraits<C>::ParamType c_,
152
         typename TupleTraits<D>::ParamType d_)
153
      : a(a_), b(b_), c(c_), d(d_) {
154
  }
155
156
  A a;
157
  B b;
158
  C c;
159
  D d;
160
};
161
162
template <class A, class B, class C, class D, class E>
163
struct Tuple5 {
164
 public:
165
  typedef A TypeA;
166
  typedef B TypeB;
167
  typedef C TypeC;
168
  typedef D TypeD;
169
  typedef E TypeE;
170
171
  Tuple5() {}
172
  Tuple5(typename TupleTraits<A>::ParamType a_,
173
    typename TupleTraits<B>::ParamType b_,
174
    typename TupleTraits<C>::ParamType c_,
175
    typename TupleTraits<D>::ParamType d_,
176
    typename TupleTraits<E>::ParamType e_)
177
    : a(a_), b(b_), c(c_), d(d_), e(e_) {
178
  }
179
180
  A a;
181
  B b;
182
  C c;
183
  D d;
184
  E e;
185
};
186
187
template <class A, class B, class C, class D, class E, class F>
188
struct Tuple6 {
189
 public:
190
  typedef A TypeA;
191
  typedef B TypeB;
192
  typedef C TypeC;
193
  typedef D TypeD;
194
  typedef E TypeE;
195
  typedef F TypeF;
196
197
  Tuple6() {}
198
  Tuple6(typename TupleTraits<A>::ParamType a_,
199
    typename TupleTraits<B>::ParamType b_,
200
    typename TupleTraits<C>::ParamType c_,
201
    typename TupleTraits<D>::ParamType d_,
202
    typename TupleTraits<E>::ParamType e_,
203
    typename TupleTraits<F>::ParamType f_)
204
    : a(a_), b(b_), c(c_), d(d_), e(e_), f(f_) {
205
  }
206
207
  A a;
208
  B b;
209
  C c;
210
  D d;
211
  E e;
212
  F f;
213
};
214
215
template <class A, class B, class C, class D, class E, class F, class G>
216
struct Tuple7 {
217
 public:
218
  typedef A TypeA;
219
  typedef B TypeB;
220
  typedef C TypeC;
221
  typedef D TypeD;
222
  typedef E TypeE;
223
  typedef F TypeF;
224
  typedef G TypeG;
225
226
  Tuple7() {}
227
  Tuple7(typename TupleTraits<A>::ParamType a_,
228
    typename TupleTraits<B>::ParamType b_,
229
    typename TupleTraits<C>::ParamType c_,
230
    typename TupleTraits<D>::ParamType d_,
231
    typename TupleTraits<E>::ParamType e_,
232
    typename TupleTraits<F>::ParamType f_,
233
    typename TupleTraits<G>::ParamType g_)
234
    : a(a_), b(b_), c(c_), d(d_), e(e_), f(f_), g(g_) {
235
  }
236
237
  A a;
238
  B b;
239
  C c;
240
  D d;
241
  E e;
242
  F f;
243
  G g;
244
};
245
246
template <class A, class B, class C, class D, class E, class F, class G,
247
          class H>
248
struct Tuple8 {
249
 public:
250
  typedef A TypeA;
251
  typedef B TypeB;
252
  typedef C TypeC;
253
  typedef D TypeD;
254
  typedef E TypeE;
255
  typedef F TypeF;
256
  typedef G TypeG;
257
  typedef H TypeH;
258
259
  Tuple8() {}
260
  Tuple8(typename TupleTraits<A>::ParamType a_,
261
    typename TupleTraits<B>::ParamType b_,
262
    typename TupleTraits<C>::ParamType c_,
263
    typename TupleTraits<D>::ParamType d_,
264
    typename TupleTraits<E>::ParamType e_,
265
    typename TupleTraits<F>::ParamType f_,
266
    typename TupleTraits<G>::ParamType g_,
267
    typename TupleTraits<H>::ParamType h_)
268
    : a(a_), b(b_), c(c_), d(d_), e(e_), f(f_), g(g_), h(h_) {
269
  }
270
271
  A a;
272
  B b;
273
  C c;
274
  D d;
275
  E e;
276
  F f;
277
  G g;
278
  H h;
279
};
280
281
// Tuple types ----------------------------------------------------------------
282
//
283
// Allows for selection of ValueTuple/RefTuple/ParamTuple without needing the
284
// definitions of class types the tuple takes as parameters.
285
286
template <>
287
struct TupleTypes< Tuple0 > {
288
  typedef Tuple0 ValueTuple;
289
  typedef Tuple0 RefTuple;
290
  typedef Tuple0 ParamTuple;
291
};
292
293
template <class A>
294
struct TupleTypes< Tuple1<A> > {
295
  typedef Tuple1<typename TupleTraits<A>::ValueType> ValueTuple;
296
  typedef Tuple1<typename TupleTraits<A>::RefType> RefTuple;
297
  typedef Tuple1<typename TupleTraits<A>::ParamType> ParamTuple;
298
};
299
300
template <class A, class B>
301
struct TupleTypes< Tuple2<A, B> > {
302
  typedef Tuple2<typename TupleTraits<A>::ValueType,
303
                 typename TupleTraits<B>::ValueType> ValueTuple;
304
typedef Tuple2<typename TupleTraits<A>::RefType,
305
               typename TupleTraits<B>::RefType> RefTuple;
306
  typedef Tuple2<typename TupleTraits<A>::ParamType,
307
                 typename TupleTraits<B>::ParamType> ParamTuple;
308
};
309
310
template <class A, class B, class C>
311
struct TupleTypes< Tuple3<A, B, C> > {
312
  typedef Tuple3<typename TupleTraits<A>::ValueType,
313
                 typename TupleTraits<B>::ValueType,
314
                 typename TupleTraits<C>::ValueType> ValueTuple;
315
typedef Tuple3<typename TupleTraits<A>::RefType,
316
               typename TupleTraits<B>::RefType,
317
               typename TupleTraits<C>::RefType> RefTuple;
318
  typedef Tuple3<typename TupleTraits<A>::ParamType,
319
                 typename TupleTraits<B>::ParamType,
320
                 typename TupleTraits<C>::ParamType> ParamTuple;
321
};
322
323
template <class A, class B, class C, class D>
324
struct TupleTypes< Tuple4<A, B, C, D> > {
325
  typedef Tuple4<typename TupleTraits<A>::ValueType,
326
                 typename TupleTraits<B>::ValueType,
327
                 typename TupleTraits<C>::ValueType,
328
                 typename TupleTraits<D>::ValueType> ValueTuple;
329
typedef Tuple4<typename TupleTraits<A>::RefType,
330
               typename TupleTraits<B>::RefType,
331
               typename TupleTraits<C>::RefType,
332
               typename TupleTraits<D>::RefType> RefTuple;
333
  typedef Tuple4<typename TupleTraits<A>::ParamType,
334
                 typename TupleTraits<B>::ParamType,
335
                 typename TupleTraits<C>::ParamType,
336
                 typename TupleTraits<D>::ParamType> ParamTuple;
337
};
338
339
template <class A, class B, class C, class D, class E>
340
struct TupleTypes< Tuple5<A, B, C, D, E> > {
341
  typedef Tuple5<typename TupleTraits<A>::ValueType,
342
                 typename TupleTraits<B>::ValueType,
343
                 typename TupleTraits<C>::ValueType,
344
                 typename TupleTraits<D>::ValueType,
345
                 typename TupleTraits<E>::ValueType> ValueTuple;
346
typedef Tuple5<typename TupleTraits<A>::RefType,
347
               typename TupleTraits<B>::RefType,
348
               typename TupleTraits<C>::RefType,
349
               typename TupleTraits<D>::RefType,
350
               typename TupleTraits<E>::RefType> RefTuple;
351
  typedef Tuple5<typename TupleTraits<A>::ParamType,
352
                 typename TupleTraits<B>::ParamType,
353
                 typename TupleTraits<C>::ParamType,
354
                 typename TupleTraits<D>::ParamType,
355
                 typename TupleTraits<E>::ParamType> ParamTuple;
356
};
357
358
template <class A, class B, class C, class D, class E, class F>
359
struct TupleTypes< Tuple6<A, B, C, D, E, F> > {
360
  typedef Tuple6<typename TupleTraits<A>::ValueType,
361
                 typename TupleTraits<B>::ValueType,
362
                 typename TupleTraits<C>::ValueType,
363
                 typename TupleTraits<D>::ValueType,
364
                 typename TupleTraits<E>::ValueType,
365
                 typename TupleTraits<F>::ValueType> ValueTuple;
366
typedef Tuple6<typename TupleTraits<A>::RefType,
367
               typename TupleTraits<B>::RefType,
368
               typename TupleTraits<C>::RefType,
369
               typename TupleTraits<D>::RefType,
370
               typename TupleTraits<E>::RefType,
371
               typename TupleTraits<F>::RefType> RefTuple;
372
  typedef Tuple6<typename TupleTraits<A>::ParamType,
373
                 typename TupleTraits<B>::ParamType,
374
                 typename TupleTraits<C>::ParamType,
375
                 typename TupleTraits<D>::ParamType,
376
                 typename TupleTraits<E>::ParamType,
377
                 typename TupleTraits<F>::ParamType> ParamTuple;
378
};
379
380
template <class A, class B, class C, class D, class E, class F, class G>
381
struct TupleTypes< Tuple7<A, B, C, D, E, F, G> > {
382
  typedef Tuple7<typename TupleTraits<A>::ValueType,
383
                 typename TupleTraits<B>::ValueType,
384
                 typename TupleTraits<C>::ValueType,
385
                 typename TupleTraits<D>::ValueType,
386
                 typename TupleTraits<E>::ValueType,
387
                 typename TupleTraits<F>::ValueType,
388
                 typename TupleTraits<G>::ValueType> ValueTuple;
389
typedef Tuple7<typename TupleTraits<A>::RefType,
390
               typename TupleTraits<B>::RefType,
391
               typename TupleTraits<C>::RefType,
392
               typename TupleTraits<D>::RefType,
393
               typename TupleTraits<E>::RefType,
394
               typename TupleTraits<F>::RefType,
395
               typename TupleTraits<G>::RefType> RefTuple;
396
  typedef Tuple7<typename TupleTraits<A>::ParamType,
397
                 typename TupleTraits<B>::ParamType,
398
                 typename TupleTraits<C>::ParamType,
399
                 typename TupleTraits<D>::ParamType,
400
                 typename TupleTraits<E>::ParamType,
401
                 typename TupleTraits<F>::ParamType,
402
                 typename TupleTraits<G>::ParamType> ParamTuple;
403
};
404
405
template <class A, class B, class C, class D, class E, class F, class G,
406
          class H>
407
struct TupleTypes< Tuple8<A, B, C, D, E, F, G, H> > {
408
  typedef Tuple8<typename TupleTraits<A>::ValueType,
409
                 typename TupleTraits<B>::ValueType,
410
                 typename TupleTraits<C>::ValueType,
411
                 typename TupleTraits<D>::ValueType,
412
                 typename TupleTraits<E>::ValueType,
413
                 typename TupleTraits<F>::ValueType,
414
                 typename TupleTraits<G>::ValueType,
415
                 typename TupleTraits<H>::ValueType> ValueTuple;
416
typedef Tuple8<typename TupleTraits<A>::RefType,
417
               typename TupleTraits<B>::RefType,
418
               typename TupleTraits<C>::RefType,
419
               typename TupleTraits<D>::RefType,
420
               typename TupleTraits<E>::RefType,
421
               typename TupleTraits<F>::RefType,
422
               typename TupleTraits<G>::RefType,
423
               typename TupleTraits<H>::RefType> RefTuple;
424
  typedef Tuple8<typename TupleTraits<A>::ParamType,
425
                 typename TupleTraits<B>::ParamType,
426
                 typename TupleTraits<C>::ParamType,
427
                 typename TupleTraits<D>::ParamType,
428
                 typename TupleTraits<E>::ParamType,
429
                 typename TupleTraits<F>::ParamType,
430
                 typename TupleTraits<G>::ParamType,
431
                 typename TupleTraits<H>::ParamType> ParamTuple;
432
};
433
434
// Tuple creators -------------------------------------------------------------
435
//
436
// Helper functions for constructing tuples while inferring the template
437
// argument types.
438
439
0
inline Tuple0 MakeTuple() {
440
0
  return Tuple0();
441
0
}
442
443
template <class A>
444
inline Tuple1<A> MakeTuple(const A& a) {
445
  return Tuple1<A>(a);
446
}
447
448
template <class A, class B>
449
inline Tuple2<A, B> MakeTuple(const A& a, const B& b) {
450
  return Tuple2<A, B>(a, b);
451
}
452
453
template <class A, class B, class C>
454
inline Tuple3<A, B, C> MakeTuple(const A& a, const B& b, const C& c) {
455
  return Tuple3<A, B, C>(a, b, c);
456
}
457
458
template <class A, class B, class C, class D>
459
inline Tuple4<A, B, C, D> MakeTuple(const A& a, const B& b, const C& c,
460
                                    const D& d) {
461
  return Tuple4<A, B, C, D>(a, b, c, d);
462
}
463
464
template <class A, class B, class C, class D, class E>
465
inline Tuple5<A, B, C, D, E> MakeTuple(const A& a, const B& b, const C& c,
466
                                       const D& d, const E& e) {
467
  return Tuple5<A, B, C, D, E>(a, b, c, d, e);
468
}
469
470
template <class A, class B, class C, class D, class E, class F>
471
inline Tuple6<A, B, C, D, E, F> MakeTuple(const A& a, const B& b, const C& c,
472
                                          const D& d, const E& e, const F& f) {
473
  return Tuple6<A, B, C, D, E, F>(a, b, c, d, e, f);
474
}
475
476
template <class A, class B, class C, class D, class E, class F, class G>
477
inline Tuple7<A, B, C, D, E, F, G> MakeTuple(const A& a, const B& b, const C& c,
478
                                             const D& d, const E& e, const F& f,
479
                                             const G& g) {
480
  return Tuple7<A, B, C, D, E, F, G>(a, b, c, d, e, f, g);
481
}
482
483
template <class A, class B, class C, class D, class E, class F, class G,
484
          class H>
485
inline Tuple8<A, B, C, D, E, F, G, H> MakeTuple(const A& a, const B& b,
486
                                                const C& c, const D& d,
487
                                                const E& e, const F& f,
488
                                                const G& g, const H& h) {
489
  return Tuple8<A, B, C, D, E, F, G, H>(a, b, c, d, e, f, g, h);
490
}
491
492
// The following set of helpers make what Boost refers to as "Tiers" - a tuple
493
// of references.
494
495
template <class A>
496
inline Tuple1<A&> MakeRefTuple(A& a) {
497
  return Tuple1<A&>(a);
498
}
499
500
template <class A, class B>
501
inline Tuple2<A&, B&> MakeRefTuple(A& a, B& b) {
502
  return Tuple2<A&, B&>(a, b);
503
}
504
505
template <class A, class B, class C>
506
inline Tuple3<A&, B&, C&> MakeRefTuple(A& a, B& b, C& c) {
507
  return Tuple3<A&, B&, C&>(a, b, c);
508
}
509
510
template <class A, class B, class C, class D>
511
inline Tuple4<A&, B&, C&, D&> MakeRefTuple(A& a, B& b, C& c, D& d) {
512
  return Tuple4<A&, B&, C&, D&>(a, b, c, d);
513
}
514
515
template <class A, class B, class C, class D, class E>
516
inline Tuple5<A&, B&, C&, D&, E&> MakeRefTuple(A& a, B& b, C& c, D& d, E& e) {
517
  return Tuple5<A&, B&, C&, D&, E&>(a, b, c, d, e);
518
}
519
520
template <class A, class B, class C, class D, class E, class F>
521
inline Tuple6<A&, B&, C&, D&, E&, F&> MakeRefTuple(A& a, B& b, C& c, D& d, E& e,
522
                                                   F& f) {
523
  return Tuple6<A&, B&, C&, D&, E&, F&>(a, b, c, d, e, f);
524
}
525
526
template <class A, class B, class C, class D, class E, class F, class G>
527
inline Tuple7<A&, B&, C&, D&, E&, F&, G&> MakeRefTuple(A& a, B& b, C& c, D& d,
528
                                                       E& e, F& f, G& g) {
529
  return Tuple7<A&, B&, C&, D&, E&, F&, G&>(a, b, c, d, e, f, g);
530
}
531
532
template <class A, class B, class C, class D, class E, class F, class G,
533
          class H>
534
inline Tuple8<A&, B&, C&, D&, E&, F&, G&, H&> MakeRefTuple(A& a, B& b, C& c,
535
                                                           D& d, E& e, F& f,
536
                                                           G& g, H& h) {
537
  return Tuple8<A&, B&, C&, D&, E&, F&, G&, H&>(a, b, c, d, e, f, g, h);
538
}
539
540
// Dispatchers ----------------------------------------------------------------
541
//
542
// Helper functions that call the given method on an object, with the unpacked
543
// tuple arguments.  Notice that they all have the same number of arguments,
544
// so you need only write:
545
//   DispatchToMethod(object, &Object::method, args);
546
// This is very useful for templated dispatchers, since they don't need to know
547
// what type |args| is.
548
549
// Non-Static Dispatchers with no out params.
550
551
template <class ObjT, class Method>
552
inline void DispatchToMethod(ObjT* obj, Method method, const Tuple0& arg) {
553
  (obj->*method)();
554
}
555
556
template <class ObjT, class Method, class A>
557
inline void DispatchToMethod(ObjT* obj, Method method, const A& arg) {
558
  (obj->*method)(yb::internal::UnwrapTraits<A>::Unwrap(arg));
559
}
560
561
template <class ObjT, class Method, class A>
562
inline void DispatchToMethod(ObjT* obj, Method method, const Tuple1<A>& arg) {
563
  (obj->*method)(yb::internal::UnwrapTraits<A>::Unwrap(arg.a));
564
}
565
566
template<class ObjT, class Method, class A, class B>
567
inline void DispatchToMethod(ObjT* obj,
568
                             Method method,
569
                             const Tuple2<A, B>& arg) {
570
  (obj->*method)(yb::internal::UnwrapTraits<A>::Unwrap(arg.a),
571
                 yb::internal::UnwrapTraits<B>::Unwrap(arg.b));
572
}
573
574
template<class ObjT, class Method, class A, class B, class C>
575
inline void DispatchToMethod(ObjT* obj, Method method,
576
                             const Tuple3<A, B, C>& arg) {
577
  (obj->*method)(yb::internal::UnwrapTraits<A>::Unwrap(arg.a),
578
                 yb::internal::UnwrapTraits<B>::Unwrap(arg.b),
579
                 yb::internal::UnwrapTraits<C>::Unwrap(arg.c));
580
}
581
582
template<class ObjT, class Method, class A, class B, class C, class D>
583
inline void DispatchToMethod(ObjT* obj, Method method,
584
                             const Tuple4<A, B, C, D>& arg) {
585
  (obj->*method)(yb::internal::UnwrapTraits<A>::Unwrap(arg.a),
586
                 yb::internal::UnwrapTraits<B>::Unwrap(arg.b),
587
                 yb::internal::UnwrapTraits<C>::Unwrap(arg.c),
588
                 yb::internal::UnwrapTraits<D>::Unwrap(arg.d));
589
}
590
591
template<class ObjT, class Method, class A, class B, class C, class D, class E>
592
inline void DispatchToMethod(ObjT* obj, Method method,
593
                             const Tuple5<A, B, C, D, E>& arg) {
594
  (obj->*method)(yb::internal::UnwrapTraits<A>::Unwrap(arg.a),
595
                 yb::internal::UnwrapTraits<B>::Unwrap(arg.b),
596
                 yb::internal::UnwrapTraits<C>::Unwrap(arg.c),
597
                 yb::internal::UnwrapTraits<D>::Unwrap(arg.d),
598
                 yb::internal::UnwrapTraits<E>::Unwrap(arg.e));
599
}
600
601
template<class ObjT, class Method, class A, class B, class C, class D, class E,
602
         class F>
603
inline void DispatchToMethod(ObjT* obj, Method method,
604
                             const Tuple6<A, B, C, D, E, F>& arg) {
605
  (obj->*method)(yb::internal::UnwrapTraits<A>::Unwrap(arg.a),
606
                 yb::internal::UnwrapTraits<B>::Unwrap(arg.b),
607
                 yb::internal::UnwrapTraits<C>::Unwrap(arg.c),
608
                 yb::internal::UnwrapTraits<D>::Unwrap(arg.d),
609
                 yb::internal::UnwrapTraits<E>::Unwrap(arg.e),
610
                 yb::internal::UnwrapTraits<F>::Unwrap(arg.f));
611
}
612
613
template<class ObjT, class Method, class A, class B, class C, class D, class E,
614
         class F, class G>
615
inline void DispatchToMethod(ObjT* obj, Method method,
616
                             const Tuple7<A, B, C, D, E, F, G>& arg) {
617
  (obj->*method)(yb::internal::UnwrapTraits<A>::Unwrap(arg.a),
618
                 yb::internal::UnwrapTraits<B>::Unwrap(arg.b),
619
                 yb::internal::UnwrapTraits<C>::Unwrap(arg.c),
620
                 yb::internal::UnwrapTraits<D>::Unwrap(arg.d),
621
                 yb::internal::UnwrapTraits<E>::Unwrap(arg.e),
622
                 yb::internal::UnwrapTraits<F>::Unwrap(arg.f),
623
                 yb::internal::UnwrapTraits<G>::Unwrap(arg.g));
624
}
625
626
template<class ObjT, class Method, class A, class B, class C, class D, class E,
627
         class F, class G, class H>
628
inline void DispatchToMethod(ObjT* obj, Method method,
629
                             const Tuple8<A, B, C, D, E, F, G, H>& arg) {
630
  (obj->*method)(yb::internal::UnwrapTraits<A>::Unwrap(arg.a),
631
                 yb::internal::UnwrapTraits<B>::Unwrap(arg.b),
632
                 yb::internal::UnwrapTraits<C>::Unwrap(arg.c),
633
                 yb::internal::UnwrapTraits<D>::Unwrap(arg.d),
634
                 yb::internal::UnwrapTraits<E>::Unwrap(arg.e),
635
                 yb::internal::UnwrapTraits<F>::Unwrap(arg.f),
636
                 yb::internal::UnwrapTraits<G>::Unwrap(arg.g),
637
                 yb::internal::UnwrapTraits<H>::Unwrap(arg.h));
638
}
639
640
// Static Dispatchers with no out params.
641
642
template <class Function>
643
inline void DispatchToFunction(Function function, const Tuple0& arg) {
644
  (*function)();
645
}
646
647
template <class Function, class A>
648
inline void DispatchToFunction(Function function, const A& arg) {
649
  (*function)(arg);
650
}
651
652
template <class Function, class A>
653
inline void DispatchToFunction(Function function, const Tuple1<A>& arg) {
654
  (*function)(yb::internal::UnwrapTraits<A>::Unwrap(arg.a));
655
}
656
657
template<class Function, class A, class B>
658
inline void DispatchToFunction(Function function, const Tuple2<A, B>& arg) {
659
  (*function)(yb::internal::UnwrapTraits<A>::Unwrap(arg.a),
660
              yb::internal::UnwrapTraits<B>::Unwrap(arg.b));
661
}
662
663
template<class Function, class A, class B, class C>
664
inline void DispatchToFunction(Function function, const Tuple3<A, B, C>& arg) {
665
  (*function)(yb::internal::UnwrapTraits<A>::Unwrap(arg.a),
666
              yb::internal::UnwrapTraits<B>::Unwrap(arg.b),
667
              yb::internal::UnwrapTraits<C>::Unwrap(arg.c));
668
}
669
670
template<class Function, class A, class B, class C, class D>
671
inline void DispatchToFunction(Function function,
672
                               const Tuple4<A, B, C, D>& arg) {
673
  (*function)(yb::internal::UnwrapTraits<A>::Unwrap(arg.a),
674
              yb::internal::UnwrapTraits<B>::Unwrap(arg.b),
675
              yb::internal::UnwrapTraits<C>::Unwrap(arg.c),
676
              yb::internal::UnwrapTraits<D>::Unwrap(arg.d));
677
}
678
679
template<class Function, class A, class B, class C, class D, class E>
680
inline void DispatchToFunction(Function function,
681
                               const Tuple5<A, B, C, D, E>& arg) {
682
  (*function)(yb::internal::UnwrapTraits<A>::Unwrap(arg.a),
683
              yb::internal::UnwrapTraits<B>::Unwrap(arg.b),
684
              yb::internal::UnwrapTraits<C>::Unwrap(arg.c),
685
              yb::internal::UnwrapTraits<D>::Unwrap(arg.d),
686
              yb::internal::UnwrapTraits<E>::Unwrap(arg.e));
687
}
688
689
template<class Function, class A, class B, class C, class D, class E, class F>
690
inline void DispatchToFunction(Function function,
691
                               const Tuple6<A, B, C, D, E, F>& arg) {
692
  (*function)(yb::internal::UnwrapTraits<A>::Unwrap(arg.a),
693
              yb::internal::UnwrapTraits<B>::Unwrap(arg.b),
694
              yb::internal::UnwrapTraits<C>::Unwrap(arg.c),
695
              yb::internal::UnwrapTraits<D>::Unwrap(arg.d),
696
              yb::internal::UnwrapTraits<E>::Unwrap(arg.e),
697
              yb::internal::UnwrapTraits<F>::Unwrap(arg.f));
698
}
699
700
template<class Function, class A, class B, class C, class D, class E, class F,
701
         class G>
702
inline void DispatchToFunction(Function function,
703
                               const Tuple7<A, B, C, D, E, F, G>& arg) {
704
  (*function)(yb::internal::UnwrapTraits<A>::Unwrap(arg.a),
705
              yb::internal::UnwrapTraits<B>::Unwrap(arg.b),
706
              yb::internal::UnwrapTraits<C>::Unwrap(arg.c),
707
              yb::internal::UnwrapTraits<D>::Unwrap(arg.d),
708
              yb::internal::UnwrapTraits<E>::Unwrap(arg.e),
709
              yb::internal::UnwrapTraits<F>::Unwrap(arg.f),
710
              yb::internal::UnwrapTraits<G>::Unwrap(arg.g));
711
}
712
713
template<class Function, class A, class B, class C, class D, class E, class F,
714
         class G, class H>
715
inline void DispatchToFunction(Function function,
716
                               const Tuple8<A, B, C, D, E, F, G, H>& arg) {
717
  (*function)(yb::internal::UnwrapTraits<A>::Unwrap(arg.a),
718
              yb::internal::UnwrapTraits<B>::Unwrap(arg.b),
719
              yb::internal::UnwrapTraits<C>::Unwrap(arg.c),
720
              yb::internal::UnwrapTraits<D>::Unwrap(arg.d),
721
              yb::internal::UnwrapTraits<E>::Unwrap(arg.e),
722
              yb::internal::UnwrapTraits<F>::Unwrap(arg.f),
723
              yb::internal::UnwrapTraits<G>::Unwrap(arg.g),
724
              yb::internal::UnwrapTraits<H>::Unwrap(arg.h));
725
}
726
727
// Dispatchers with 0 out param (as a Tuple0).
728
729
template <class ObjT, class Method>
730
inline void DispatchToMethod(ObjT* obj,
731
                             Method method,
732
                             const Tuple0& arg, Tuple0*) {
733
  (obj->*method)();
734
}
735
736
template <class ObjT, class Method, class A>
737
inline void DispatchToMethod(ObjT* obj, Method method, const A& arg, Tuple0*) {
738
  (obj->*method)(yb::internal::UnwrapTraits<A>::Unwrap(arg));
739
}
740
741
template <class ObjT, class Method, class A>
742
inline void DispatchToMethod(ObjT* obj,
743
                             Method method,
744
                             const Tuple1<A>& arg, Tuple0*) {
745
  (obj->*method)(yb::internal::UnwrapTraits<A>::Unwrap(arg.a));
746
}
747
748
template<class ObjT, class Method, class A, class B>
749
inline void DispatchToMethod(ObjT* obj,
750
                             Method method,
751
                             const Tuple2<A, B>& arg, Tuple0*) {
752
  (obj->*method)(yb::internal::UnwrapTraits<A>::Unwrap(arg.a),
753
                 yb::internal::UnwrapTraits<B>::Unwrap(arg.b));
754
}
755
756
template<class ObjT, class Method, class A, class B, class C>
757
inline void DispatchToMethod(ObjT* obj, Method method,
758
                             const Tuple3<A, B, C>& arg, Tuple0*) {
759
  (obj->*method)(yb::internal::UnwrapTraits<A>::Unwrap(arg.a),
760
                 yb::internal::UnwrapTraits<B>::Unwrap(arg.b),
761
                 yb::internal::UnwrapTraits<C>::Unwrap(arg.c));
762
}
763
764
template<class ObjT, class Method, class A, class B, class C, class D>
765
inline void DispatchToMethod(ObjT* obj, Method method,
766
                             const Tuple4<A, B, C, D>& arg, Tuple0*) {
767
  (obj->*method)(yb::internal::UnwrapTraits<A>::Unwrap(arg.a),
768
                 yb::internal::UnwrapTraits<B>::Unwrap(arg.b),
769
                 yb::internal::UnwrapTraits<C>::Unwrap(arg.c),
770
                 yb::internal::UnwrapTraits<D>::Unwrap(arg.d));
771
}
772
773
template<class ObjT, class Method, class A, class B, class C, class D, class E>
774
inline void DispatchToMethod(ObjT* obj, Method method,
775
                             const Tuple5<A, B, C, D, E>& arg, Tuple0*) {
776
  (obj->*method)(yb::internal::UnwrapTraits<A>::Unwrap(arg.a),
777
                 yb::internal::UnwrapTraits<B>::Unwrap(arg.b),
778
                 yb::internal::UnwrapTraits<C>::Unwrap(arg.c),
779
                 yb::internal::UnwrapTraits<D>::Unwrap(arg.d),
780
                 yb::internal::UnwrapTraits<E>::Unwrap(arg.e));
781
}
782
783
template<class ObjT, class Method, class A, class B, class C, class D, class E,
784
         class F>
785
inline void DispatchToMethod(ObjT* obj, Method method,
786
                             const Tuple6<A, B, C, D, E, F>& arg, Tuple0*) {
787
  (obj->*method)(yb::internal::UnwrapTraits<A>::Unwrap(arg.a),
788
                 yb::internal::UnwrapTraits<B>::Unwrap(arg.b),
789
                 yb::internal::UnwrapTraits<C>::Unwrap(arg.c),
790
                 yb::internal::UnwrapTraits<D>::Unwrap(arg.d),
791
                 yb::internal::UnwrapTraits<E>::Unwrap(arg.e),
792
                 yb::internal::UnwrapTraits<F>::Unwrap(arg.f));
793
}
794
795
// Dispatchers with 1 out param.
796
797
template<class ObjT, class Method,
798
         class OutA>
799
inline void DispatchToMethod(ObjT* obj, Method method,
800
                             const Tuple0& in,
801
                             Tuple1<OutA>* out) {
802
  (obj->*method)(&out->a);
803
}
804
805
template<class ObjT, class Method, class InA,
806
         class OutA>
807
inline void DispatchToMethod(ObjT* obj, Method method,
808
                             const InA& in,
809
                             Tuple1<OutA>* out) {
810
  (obj->*method)(in, &out->a);
811
}
812
813
template<class ObjT, class Method, class InA,
814
         class OutA>
815
inline void DispatchToMethod(ObjT* obj, Method method,
816
                             const Tuple1<InA>& in,
817
                             Tuple1<OutA>* out) {
818
  (obj->*method)(yb::internal::UnwrapTraits<InA>::Unwrap(in.a), &out->a);
819
}
820
821
template<class ObjT, class Method, class InA, class InB,
822
         class OutA>
823
inline void DispatchToMethod(ObjT* obj, Method method,
824
                             const Tuple2<InA, InB>& in,
825
                             Tuple1<OutA>* out) {
826
  (obj->*method)(yb::internal::UnwrapTraits<InA>::Unwrap(in.a),
827
                 yb::internal::UnwrapTraits<InB>::Unwrap(in.b),
828
                 &out->a);
829
}
830
831
template<class ObjT, class Method, class InA, class InB, class InC,
832
         class OutA>
833
inline void DispatchToMethod(ObjT* obj, Method method,
834
                             const Tuple3<InA, InB, InC>& in,
835
                             Tuple1<OutA>* out) {
836
  (obj->*method)(yb::internal::UnwrapTraits<InA>::Unwrap(in.a),
837
                 yb::internal::UnwrapTraits<InB>::Unwrap(in.b),
838
                 yb::internal::UnwrapTraits<InC>::Unwrap(in.c),
839
                 &out->a);
840
}
841
842
template<class ObjT, class Method, class InA, class InB, class InC, class InD,
843
         class OutA>
844
inline void DispatchToMethod(ObjT* obj, Method method,
845
                             const Tuple4<InA, InB, InC, InD>& in,
846
                             Tuple1<OutA>* out) {
847
  (obj->*method)(yb::internal::UnwrapTraits<InA>::Unwrap(in.a),
848
                 yb::internal::UnwrapTraits<InB>::Unwrap(in.b),
849
                 yb::internal::UnwrapTraits<InC>::Unwrap(in.c),
850
                 yb::internal::UnwrapTraits<InD>::Unwrap(in.d),
851
                 &out->a);
852
}
853
854
template<class ObjT, class Method, class InA, class InB, class InC, class InD,
855
         class InE, class OutA>
856
inline void DispatchToMethod(ObjT* obj, Method method,
857
                             const Tuple5<InA, InB, InC, InD, InE>& in,
858
                             Tuple1<OutA>* out) {
859
  (obj->*method)(yb::internal::UnwrapTraits<InA>::Unwrap(in.a),
860
                 yb::internal::UnwrapTraits<InB>::Unwrap(in.b),
861
                 yb::internal::UnwrapTraits<InC>::Unwrap(in.c),
862
                 yb::internal::UnwrapTraits<InD>::Unwrap(in.d),
863
                 yb::internal::UnwrapTraits<InE>::Unwrap(in.e),
864
                 &out->a);
865
}
866
867
template<class ObjT, class Method,
868
         class InA, class InB, class InC, class InD, class InE, class InF,
869
         class OutA>
870
inline void DispatchToMethod(ObjT* obj, Method method,
871
                             const Tuple6<InA, InB, InC, InD, InE, InF>& in,
872
                             Tuple1<OutA>* out) {
873
  (obj->*method)(yb::internal::UnwrapTraits<InA>::Unwrap(in.a),
874
                 yb::internal::UnwrapTraits<InB>::Unwrap(in.b),
875
                 yb::internal::UnwrapTraits<InC>::Unwrap(in.c),
876
                 yb::internal::UnwrapTraits<InD>::Unwrap(in.d),
877
                 yb::internal::UnwrapTraits<InE>::Unwrap(in.e),
878
                 yb::internal::UnwrapTraits<InF>::Unwrap(in.f),
879
                 &out->a);
880
}
881
882
// Dispatchers with 2 out params.
883
884
template<class ObjT, class Method,
885
         class OutA, class OutB>
886
inline void DispatchToMethod(ObjT* obj, Method method,
887
                             const Tuple0& in,
888
                             Tuple2<OutA, OutB>* out) {
889
  (obj->*method)(&out->a, &out->b);
890
}
891
892
template<class ObjT, class Method, class InA,
893
         class OutA, class OutB>
894
inline void DispatchToMethod(ObjT* obj, Method method,
895
                             const InA& in,
896
                             Tuple2<OutA, OutB>* out) {
897
  (obj->*method)(in, &out->a, &out->b);
898
}
899
900
template<class ObjT, class Method, class InA,
901
         class OutA, class OutB>
902
inline void DispatchToMethod(ObjT* obj, Method method,
903
                             const Tuple1<InA>& in,
904
                             Tuple2<OutA, OutB>* out) {
905
  (obj->*method)(
906
      yb::internal::UnwrapTraits<InA>::Unwrap(in.a), &out->a, &out->b);
907
}
908
909
template<class ObjT, class Method, class InA, class InB,
910
         class OutA, class OutB>
911
inline void DispatchToMethod(ObjT* obj, Method method,
912
                             const Tuple2<InA, InB>& in,
913
                             Tuple2<OutA, OutB>* out) {
914
  (obj->*method)(yb::internal::UnwrapTraits<InA>::Unwrap(in.a),
915
                 yb::internal::UnwrapTraits<InB>::Unwrap(in.b),
916
                 &out->a,
917
                 &out->b);
918
}
919
920
template<class ObjT, class Method, class InA, class InB, class InC,
921
         class OutA, class OutB>
922
inline void DispatchToMethod(ObjT* obj, Method method,
923
                             const Tuple3<InA, InB, InC>& in,
924
                             Tuple2<OutA, OutB>* out) {
925
  (obj->*method)(yb::internal::UnwrapTraits<InA>::Unwrap(in.a),
926
                 yb::internal::UnwrapTraits<InB>::Unwrap(in.b),
927
                 yb::internal::UnwrapTraits<InC>::Unwrap(in.c),
928
                 &out->a,
929
                 &out->b);
930
}
931
932
template<class ObjT, class Method, class InA, class InB, class InC, class InD,
933
         class OutA, class OutB>
934
inline void DispatchToMethod(ObjT* obj, Method method,
935
                             const Tuple4<InA, InB, InC, InD>& in,
936
                             Tuple2<OutA, OutB>* out) {
937
  (obj->*method)(yb::internal::UnwrapTraits<InA>::Unwrap(in.a),
938
                 yb::internal::UnwrapTraits<InB>::Unwrap(in.b),
939
                 yb::internal::UnwrapTraits<InC>::Unwrap(in.c),
940
                 yb::internal::UnwrapTraits<InD>::Unwrap(in.d),
941
                 &out->a,
942
                 &out->b);
943
}
944
945
template<class ObjT, class Method,
946
         class InA, class InB, class InC, class InD, class InE,
947
         class OutA, class OutB>
948
inline void DispatchToMethod(ObjT* obj, Method method,
949
                             const Tuple5<InA, InB, InC, InD, InE>& in,
950
                             Tuple2<OutA, OutB>* out) {
951
  (obj->*method)(yb::internal::UnwrapTraits<InA>::Unwrap(in.a),
952
                 yb::internal::UnwrapTraits<InB>::Unwrap(in.b),
953
                 yb::internal::UnwrapTraits<InC>::Unwrap(in.c),
954
                 yb::internal::UnwrapTraits<InD>::Unwrap(in.d),
955
                 yb::internal::UnwrapTraits<InE>::Unwrap(in.e),
956
                 &out->a,
957
                 &out->b);
958
}
959
960
template<class ObjT, class Method,
961
         class InA, class InB, class InC, class InD, class InE, class InF,
962
         class OutA, class OutB>
963
inline void DispatchToMethod(ObjT* obj, Method method,
964
                             const Tuple6<InA, InB, InC, InD, InE, InF>& in,
965
                             Tuple2<OutA, OutB>* out) {
966
  (obj->*method)(yb::internal::UnwrapTraits<InA>::Unwrap(in.a),
967
                 yb::internal::UnwrapTraits<InB>::Unwrap(in.b),
968
                 yb::internal::UnwrapTraits<InC>::Unwrap(in.c),
969
                 yb::internal::UnwrapTraits<InD>::Unwrap(in.d),
970
                 yb::internal::UnwrapTraits<InE>::Unwrap(in.e),
971
                 yb::internal::UnwrapTraits<InF>::Unwrap(in.f),
972
                 &out->a,
973
                 &out->b);
974
}
975
976
// Dispatchers with 3 out params.
977
978
template<class ObjT, class Method,
979
         class OutA, class OutB, class OutC>
980
inline void DispatchToMethod(ObjT* obj, Method method,
981
                             const Tuple0& in,
982
                             Tuple3<OutA, OutB, OutC>* out) {
983
  (obj->*method)(&out->a, &out->b, &out->c);
984
}
985
986
template<class ObjT, class Method, class InA,
987
         class OutA, class OutB, class OutC>
988
inline void DispatchToMethod(ObjT* obj, Method method,
989
                             const InA& in,
990
                             Tuple3<OutA, OutB, OutC>* out) {
991
  (obj->*method)(in, &out->a, &out->b, &out->c);
992
}
993
994
template<class ObjT, class Method, class InA,
995
         class OutA, class OutB, class OutC>
996
inline void DispatchToMethod(ObjT* obj, Method method,
997
                             const Tuple1<InA>& in,
998
                             Tuple3<OutA, OutB, OutC>* out) {
999
  (obj->*method)(yb::internal::UnwrapTraits<InA>::Unwrap(in.a),
1000
                 &out->a,
1001
                 &out->b,
1002
                 &out->c);
1003
}
1004
1005
template<class ObjT, class Method, class InA, class InB,
1006
         class OutA, class OutB, class OutC>
1007
inline void DispatchToMethod(ObjT* obj, Method method,
1008
                             const Tuple2<InA, InB>& in,
1009
                             Tuple3<OutA, OutB, OutC>* out) {
1010
  (obj->*method)(yb::internal::UnwrapTraits<InA>::Unwrap(in.a),
1011
                 yb::internal::UnwrapTraits<InB>::Unwrap(in.b),
1012
                 &out->a,
1013
                 &out->b,
1014
                 &out->c);
1015
}
1016
1017
template<class ObjT, class Method, class InA, class InB, class InC,
1018
         class OutA, class OutB, class OutC>
1019
inline void DispatchToMethod(ObjT* obj, Method method,
1020
                             const Tuple3<InA, InB, InC>& in,
1021
                             Tuple3<OutA, OutB, OutC>* out) {
1022
  (obj->*method)(yb::internal::UnwrapTraits<InA>::Unwrap(in.a),
1023
                 yb::internal::UnwrapTraits<InB>::Unwrap(in.b),
1024
                 yb::internal::UnwrapTraits<InC>::Unwrap(in.c),
1025
                 &out->a,
1026
                 &out->b,
1027
                 &out->c);
1028
}
1029
1030
template<class ObjT, class Method, class InA, class InB, class InC, class InD,
1031
         class OutA, class OutB, class OutC>
1032
inline void DispatchToMethod(ObjT* obj, Method method,
1033
                             const Tuple4<InA, InB, InC, InD>& in,
1034
                             Tuple3<OutA, OutB, OutC>* out) {
1035
  (obj->*method)(yb::internal::UnwrapTraits<InA>::Unwrap(in.a),
1036
                 yb::internal::UnwrapTraits<InB>::Unwrap(in.b),
1037
                 yb::internal::UnwrapTraits<InC>::Unwrap(in.c),
1038
                 yb::internal::UnwrapTraits<InD>::Unwrap(in.d),
1039
                 &out->a,
1040
                 &out->b,
1041
                 &out->c);
1042
}
1043
1044
template<class ObjT, class Method,
1045
         class InA, class InB, class InC, class InD, class InE,
1046
         class OutA, class OutB, class OutC>
1047
inline void DispatchToMethod(ObjT* obj, Method method,
1048
                             const Tuple5<InA, InB, InC, InD, InE>& in,
1049
                             Tuple3<OutA, OutB, OutC>* out) {
1050
  (obj->*method)(yb::internal::UnwrapTraits<InA>::Unwrap(in.a),
1051
                 yb::internal::UnwrapTraits<InB>::Unwrap(in.b),
1052
                 yb::internal::UnwrapTraits<InC>::Unwrap(in.c),
1053
                 yb::internal::UnwrapTraits<InD>::Unwrap(in.d),
1054
                 yb::internal::UnwrapTraits<InE>::Unwrap(in.e),
1055
                 &out->a,
1056
                 &out->b,
1057
                 &out->c);
1058
}
1059
1060
template<class ObjT, class Method,
1061
         class InA, class InB, class InC, class InD, class InE, class InF,
1062
         class OutA, class OutB, class OutC>
1063
inline void DispatchToMethod(ObjT* obj, Method method,
1064
                             const Tuple6<InA, InB, InC, InD, InE, InF>& in,
1065
                             Tuple3<OutA, OutB, OutC>* out) {
1066
  (obj->*method)(yb::internal::UnwrapTraits<InA>::Unwrap(in.a),
1067
                 yb::internal::UnwrapTraits<InB>::Unwrap(in.b),
1068
                 yb::internal::UnwrapTraits<InC>::Unwrap(in.c),
1069
                 yb::internal::UnwrapTraits<InD>::Unwrap(in.d),
1070
                 yb::internal::UnwrapTraits<InE>::Unwrap(in.e),
1071
                 yb::internal::UnwrapTraits<InF>::Unwrap(in.f),
1072
                 &out->a,
1073
                 &out->b,
1074
                 &out->c);
1075
}
1076
1077
// Dispatchers with 4 out params.
1078
1079
template<class ObjT, class Method,
1080
         class OutA, class OutB, class OutC, class OutD>
1081
inline void DispatchToMethod(ObjT* obj, Method method,
1082
                             const Tuple0& in,
1083
                             Tuple4<OutA, OutB, OutC, OutD>* out) {
1084
  (obj->*method)(&out->a, &out->b, &out->c, &out->d);
1085
}
1086
1087
template<class ObjT, class Method, class InA,
1088
         class OutA, class OutB, class OutC, class OutD>
1089
inline void DispatchToMethod(ObjT* obj, Method method,
1090
                             const InA& in,
1091
                             Tuple4<OutA, OutB, OutC, OutD>* out) {
1092
  (obj->*method)(yb::internal::UnwrapTraits<InA>::Unwrap(in),
1093
                 &out->a,
1094
                 &out->b,
1095
                 &out->c,
1096
                 &out->d);
1097
}
1098
1099
template<class ObjT, class Method, class InA,
1100
         class OutA, class OutB, class OutC, class OutD>
1101
inline void DispatchToMethod(ObjT* obj, Method method,
1102
                             const Tuple1<InA>& in,
1103
                             Tuple4<OutA, OutB, OutC, OutD>* out) {
1104
  (obj->*method)(yb::internal::UnwrapTraits<InA>::Unwrap(in.a),
1105
                 &out->a,
1106
                 &out->b,
1107
                 &out->c,
1108
                 &out->d);
1109
}
1110
1111
template<class ObjT, class Method, class InA, class InB,
1112
         class OutA, class OutB, class OutC, class OutD>
1113
inline void DispatchToMethod(ObjT* obj, Method method,
1114
                             const Tuple2<InA, InB>& in,
1115
                             Tuple4<OutA, OutB, OutC, OutD>* out) {
1116
  (obj->*method)(yb::internal::UnwrapTraits<InA>::Unwrap(in.a),
1117
                 yb::internal::UnwrapTraits<InB>::Unwrap(in.b),
1118
                 &out->a,
1119
                 &out->b,
1120
                 &out->c,
1121
                 &out->d);
1122
}
1123
1124
template<class ObjT, class Method, class InA, class InB, class InC,
1125
         class OutA, class OutB, class OutC, class OutD>
1126
inline void DispatchToMethod(ObjT* obj, Method method,
1127
                             const Tuple3<InA, InB, InC>& in,
1128
                             Tuple4<OutA, OutB, OutC, OutD>* out) {
1129
  (obj->*method)(yb::internal::UnwrapTraits<InA>::Unwrap(in.a),
1130
                 yb::internal::UnwrapTraits<InB>::Unwrap(in.b),
1131
                 yb::internal::UnwrapTraits<InC>::Unwrap(in.c),
1132
                 &out->a,
1133
                 &out->b,
1134
                 &out->c,
1135
                 &out->d);
1136
}
1137
1138
template<class ObjT, class Method, class InA, class InB, class InC, class InD,
1139
         class OutA, class OutB, class OutC, class OutD>
1140
inline void DispatchToMethod(ObjT* obj, Method method,
1141
                             const Tuple4<InA, InB, InC, InD>& in,
1142
                             Tuple4<OutA, OutB, OutC, OutD>* out) {
1143
  (obj->*method)(yb::internal::UnwrapTraits<InA>::Unwrap(in.a),
1144
                 yb::internal::UnwrapTraits<InB>::Unwrap(in.b),
1145
                 yb::internal::UnwrapTraits<InC>::Unwrap(in.c),
1146
                 yb::internal::UnwrapTraits<InD>::Unwrap(in.d),
1147
                 &out->a,
1148
                 &out->b,
1149
                 &out->c,
1150
                 &out->d);
1151
}
1152
1153
template<class ObjT, class Method,
1154
         class InA, class InB, class InC, class InD, class InE,
1155
         class OutA, class OutB, class OutC, class OutD>
1156
inline void DispatchToMethod(ObjT* obj, Method method,
1157
                             const Tuple5<InA, InB, InC, InD, InE>& in,
1158
                             Tuple4<OutA, OutB, OutC, OutD>* out) {
1159
  (obj->*method)(yb::internal::UnwrapTraits<InA>::Unwrap(in.a),
1160
                 yb::internal::UnwrapTraits<InB>::Unwrap(in.b),
1161
                 yb::internal::UnwrapTraits<InC>::Unwrap(in.c),
1162
                 yb::internal::UnwrapTraits<InD>::Unwrap(in.d),
1163
                 yb::internal::UnwrapTraits<InE>::Unwrap(in.e),
1164
                 &out->a,
1165
                 &out->b,
1166
                 &out->c,
1167
                 &out->d);
1168
}
1169
1170
template<class ObjT, class Method,
1171
         class InA, class InB, class InC, class InD, class InE, class InF,
1172
         class OutA, class OutB, class OutC, class OutD>
1173
inline void DispatchToMethod(ObjT* obj, Method method,
1174
                             const Tuple6<InA, InB, InC, InD, InE, InF>& in,
1175
                             Tuple4<OutA, OutB, OutC, OutD>* out) {
1176
  (obj->*method)(yb::internal::UnwrapTraits<InA>::Unwrap(in.a),
1177
                 yb::internal::UnwrapTraits<InB>::Unwrap(in.b),
1178
                 yb::internal::UnwrapTraits<InC>::Unwrap(in.c),
1179
                 yb::internal::UnwrapTraits<InD>::Unwrap(in.d),
1180
                 yb::internal::UnwrapTraits<InE>::Unwrap(in.e),
1181
                 yb::internal::UnwrapTraits<InF>::Unwrap(in.f),
1182
                 &out->a,
1183
                 &out->b,
1184
                 &out->c,
1185
                 &out->d);
1186
}
1187
1188
// Dispatchers with 5 out params.
1189
1190
template<class ObjT, class Method,
1191
         class OutA, class OutB, class OutC, class OutD, class OutE>
1192
inline void DispatchToMethod(ObjT* obj, Method method,
1193
                             const Tuple0& in,
1194
                             Tuple5<OutA, OutB, OutC, OutD, OutE>* out) {
1195
  (obj->*method)(&out->a, &out->b, &out->c, &out->d, &out->e);
1196
}
1197
1198
template<class ObjT, class Method, class InA,
1199
         class OutA, class OutB, class OutC, class OutD, class OutE>
1200
inline void DispatchToMethod(ObjT* obj, Method method,
1201
                             const InA& in,
1202
                             Tuple5<OutA, OutB, OutC, OutD, OutE>* out) {
1203
  (obj->*method)(yb::internal::UnwrapTraits<InA>::Unwrap(in),
1204
                 &out->a,
1205
                 &out->b,
1206
                 &out->c,
1207
                 &out->d,
1208
                 &out->e);
1209
}
1210
1211
template<class ObjT, class Method, class InA,
1212
         class OutA, class OutB, class OutC, class OutD, class OutE>
1213
inline void DispatchToMethod(ObjT* obj, Method method,
1214
                             const Tuple1<InA>& in,
1215
                             Tuple5<OutA, OutB, OutC, OutD, OutE>* out) {
1216
  (obj->*method)(yb::internal::UnwrapTraits<InA>::Unwrap(in.a),
1217
                 &out->a,
1218
                 &out->b,
1219
                 &out->c,
1220
                 &out->d,
1221
                 &out->e);
1222
}
1223
1224
template<class ObjT, class Method, class InA, class InB,
1225
         class OutA, class OutB, class OutC, class OutD, class OutE>
1226
inline void DispatchToMethod(ObjT* obj, Method method,
1227
                             const Tuple2<InA, InB>& in,
1228
                             Tuple5<OutA, OutB, OutC, OutD, OutE>* out) {
1229
  (obj->*method)(yb::internal::UnwrapTraits<InA>::Unwrap(in.a),
1230
                 yb::internal::UnwrapTraits<InB>::Unwrap(in.b),
1231
                 &out->a,
1232
                 &out->b,
1233
                 &out->c,
1234
                 &out->d,
1235
                 &out->e);
1236
}
1237
1238
template<class ObjT, class Method, class InA, class InB, class InC,
1239
         class OutA, class OutB, class OutC, class OutD, class OutE>
1240
inline void DispatchToMethod(ObjT* obj, Method method,
1241
                             const Tuple3<InA, InB, InC>& in,
1242
                             Tuple5<OutA, OutB, OutC, OutD, OutE>* out) {
1243
  (obj->*method)(yb::internal::UnwrapTraits<InA>::Unwrap(in.a),
1244
                 yb::internal::UnwrapTraits<InB>::Unwrap(in.b),
1245
                 yb::internal::UnwrapTraits<InC>::Unwrap(in.c),
1246
                 &out->a,
1247
                 &out->b,
1248
                 &out->c,
1249
                 &out->d,
1250
                 &out->e);
1251
}
1252
1253
template<class ObjT, class Method, class InA, class InB, class InC, class InD,
1254
         class OutA, class OutB, class OutC, class OutD, class OutE>
1255
inline void DispatchToMethod(ObjT* obj, Method method,
1256
                             const Tuple4<InA, InB, InC, InD>& in,
1257
                             Tuple5<OutA, OutB, OutC, OutD, OutE>* out) {
1258
  (obj->*method)(yb::internal::UnwrapTraits<InA>::Unwrap(in.a),
1259
                 yb::internal::UnwrapTraits<InB>::Unwrap(in.b),
1260
                 yb::internal::UnwrapTraits<InC>::Unwrap(in.c),
1261
                 yb::internal::UnwrapTraits<InD>::Unwrap(in.d),
1262
                 &out->a,
1263
                 &out->b,
1264
                 &out->c,
1265
                 &out->d,
1266
                 &out->e);
1267
}
1268
1269
template<class ObjT, class Method,
1270
         class InA, class InB, class InC, class InD, class InE,
1271
         class OutA, class OutB, class OutC, class OutD, class OutE>
1272
inline void DispatchToMethod(ObjT* obj, Method method,
1273
                             const Tuple5<InA, InB, InC, InD, InE>& in,
1274
                             Tuple5<OutA, OutB, OutC, OutD, OutE>* out) {
1275
  (obj->*method)(yb::internal::UnwrapTraits<InA>::Unwrap(in.a),
1276
                 yb::internal::UnwrapTraits<InB>::Unwrap(in.b),
1277
                 yb::internal::UnwrapTraits<InC>::Unwrap(in.c),
1278
                 yb::internal::UnwrapTraits<InD>::Unwrap(in.d),
1279
                 yb::internal::UnwrapTraits<InE>::Unwrap(in.e),
1280
                 &out->a,
1281
                 &out->b,
1282
                 &out->c,
1283
                 &out->d,
1284
                 &out->e);
1285
}
1286
1287
template<class ObjT, class Method,
1288
         class InA, class InB, class InC, class InD, class InE, class InF,
1289
         class OutA, class OutB, class OutC, class OutD, class OutE>
1290
inline void DispatchToMethod(ObjT* obj, Method method,
1291
                             const Tuple6<InA, InB, InC, InD, InE, InF>& in,
1292
                             Tuple5<OutA, OutB, OutC, OutD, OutE>* out) {
1293
  (obj->*method)(yb::internal::UnwrapTraits<InA>::Unwrap(in.a),
1294
                 yb::internal::UnwrapTraits<InB>::Unwrap(in.b),
1295
                 yb::internal::UnwrapTraits<InC>::Unwrap(in.c),
1296
                 yb::internal::UnwrapTraits<InD>::Unwrap(in.d),
1297
                 yb::internal::UnwrapTraits<InE>::Unwrap(in.e),
1298
                 yb::internal::UnwrapTraits<InF>::Unwrap(in.f),
1299
                 &out->a,
1300
                 &out->b,
1301
                 &out->c,
1302
                 &out->d,
1303
                 &out->e);
1304
}
1305
1306
#endif  // BASE_TUPLE_H__