00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038 #ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_TUPLE_H_
00039 #define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_TUPLE_H_
00040
00041 #include <utility>
00042
00043
00044
00045
00046
00047
00048 #if defined(__SYMBIAN32__) || (defined(__SUNPRO_CC) && __SUNPRO_CC < 0x590)
00049 # define GTEST_DECLARE_TUPLE_AS_FRIEND_ public:
00050 #else
00051 # define GTEST_DECLARE_TUPLE_AS_FRIEND_ \
00052 template <GTEST_10_TYPENAMES_(U)> friend class tuple; \
00053 private:
00054 #endif
00055
00056
00057
00058
00059 #if defined(_MSC_VER) && _MSC_VER >= 1600
00060 # error "gtest's tuple doesn't compile on Visual Studio 2010 or later. \
00061 GTEST_USE_OWN_TR1_TUPLE must be set to 0 on those compilers."
00062 #endif
00063
00064
00065 #define GTEST_0_TUPLE_(T) tuple<>
00066 #define GTEST_1_TUPLE_(T) tuple<T##0, void, void, void, void, void, void, \
00067 void, void, void>
00068 #define GTEST_2_TUPLE_(T) tuple<T##0, T##1, void, void, void, void, void, \
00069 void, void, void>
00070 #define GTEST_3_TUPLE_(T) tuple<T##0, T##1, T##2, void, void, void, void, \
00071 void, void, void>
00072 #define GTEST_4_TUPLE_(T) tuple<T##0, T##1, T##2, T##3, void, void, void, \
00073 void, void, void>
00074 #define GTEST_5_TUPLE_(T) tuple<T##0, T##1, T##2, T##3, T##4, void, void, \
00075 void, void, void>
00076 #define GTEST_6_TUPLE_(T) tuple<T##0, T##1, T##2, T##3, T##4, T##5, void, \
00077 void, void, void>
00078 #define GTEST_7_TUPLE_(T) tuple<T##0, T##1, T##2, T##3, T##4, T##5, T##6, \
00079 void, void, void>
00080 #define GTEST_8_TUPLE_(T) tuple<T##0, T##1, T##2, T##3, T##4, T##5, T##6, \
00081 T##7, void, void>
00082 #define GTEST_9_TUPLE_(T) tuple<T##0, T##1, T##2, T##3, T##4, T##5, T##6, \
00083 T##7, T##8, void>
00084 #define GTEST_10_TUPLE_(T) tuple<T##0, T##1, T##2, T##3, T##4, T##5, T##6, \
00085 T##7, T##8, T##9>
00086
00087
00088 #define GTEST_0_TYPENAMES_(T)
00089 #define GTEST_1_TYPENAMES_(T) typename T##0
00090 #define GTEST_2_TYPENAMES_(T) typename T##0, typename T##1
00091 #define GTEST_3_TYPENAMES_(T) typename T##0, typename T##1, typename T##2
00092 #define GTEST_4_TYPENAMES_(T) typename T##0, typename T##1, typename T##2, \
00093 typename T##3
00094 #define GTEST_5_TYPENAMES_(T) typename T##0, typename T##1, typename T##2, \
00095 typename T##3, typename T##4
00096 #define GTEST_6_TYPENAMES_(T) typename T##0, typename T##1, typename T##2, \
00097 typename T##3, typename T##4, typename T##5
00098 #define GTEST_7_TYPENAMES_(T) typename T##0, typename T##1, typename T##2, \
00099 typename T##3, typename T##4, typename T##5, typename T##6
00100 #define GTEST_8_TYPENAMES_(T) typename T##0, typename T##1, typename T##2, \
00101 typename T##3, typename T##4, typename T##5, typename T##6, typename T##7
00102 #define GTEST_9_TYPENAMES_(T) typename T##0, typename T##1, typename T##2, \
00103 typename T##3, typename T##4, typename T##5, typename T##6, \
00104 typename T##7, typename T##8
00105 #define GTEST_10_TYPENAMES_(T) typename T##0, typename T##1, typename T##2, \
00106 typename T##3, typename T##4, typename T##5, typename T##6, \
00107 typename T##7, typename T##8, typename T##9
00108
00109
00110
00111
00112 namespace std {
00113 namespace tr1 {
00114
00115 template <typename T0 = void, typename T1 = void, typename T2 = void,
00116 typename T3 = void, typename T4 = void, typename T5 = void,
00117 typename T6 = void, typename T7 = void, typename T8 = void,
00118 typename T9 = void>
00119 class tuple;
00120
00121
00122
00123 namespace gtest_internal {
00124
00125
00126 template <typename T>
00127 struct ByRef { typedef const T& type; };
00128 template <typename T>
00129 struct ByRef<T&> { typedef T& type; };
00130
00131
00132 #define GTEST_BY_REF_(T) typename ::std::tr1::gtest_internal::ByRef<T>::type
00133
00134
00135
00136 template <typename T>
00137 struct AddRef { typedef T& type; };
00138 template <typename T>
00139 struct AddRef<T&> { typedef T& type; };
00140
00141
00142 #define GTEST_ADD_REF_(T) typename ::std::tr1::gtest_internal::AddRef<T>::type
00143
00144
00145 template <int k> class Get;
00146
00147
00148
00149 template <bool kIndexValid, int kIndex, class Tuple>
00150 struct TupleElement;
00151
00152 template <GTEST_10_TYPENAMES_(T)>
00153 struct TupleElement<true, 0, GTEST_10_TUPLE_(T) > {
00154 typedef T0 type;
00155 };
00156
00157 template <GTEST_10_TYPENAMES_(T)>
00158 struct TupleElement<true, 1, GTEST_10_TUPLE_(T) > {
00159 typedef T1 type;
00160 };
00161
00162 template <GTEST_10_TYPENAMES_(T)>
00163 struct TupleElement<true, 2, GTEST_10_TUPLE_(T) > {
00164 typedef T2 type;
00165 };
00166
00167 template <GTEST_10_TYPENAMES_(T)>
00168 struct TupleElement<true, 3, GTEST_10_TUPLE_(T) > {
00169 typedef T3 type;
00170 };
00171
00172 template <GTEST_10_TYPENAMES_(T)>
00173 struct TupleElement<true, 4, GTEST_10_TUPLE_(T) > {
00174 typedef T4 type;
00175 };
00176
00177 template <GTEST_10_TYPENAMES_(T)>
00178 struct TupleElement<true, 5, GTEST_10_TUPLE_(T) > {
00179 typedef T5 type;
00180 };
00181
00182 template <GTEST_10_TYPENAMES_(T)>
00183 struct TupleElement<true, 6, GTEST_10_TUPLE_(T) > {
00184 typedef T6 type;
00185 };
00186
00187 template <GTEST_10_TYPENAMES_(T)>
00188 struct TupleElement<true, 7, GTEST_10_TUPLE_(T) > {
00189 typedef T7 type;
00190 };
00191
00192 template <GTEST_10_TYPENAMES_(T)>
00193 struct TupleElement<true, 8, GTEST_10_TUPLE_(T) > {
00194 typedef T8 type;
00195 };
00196
00197 template <GTEST_10_TYPENAMES_(T)>
00198 struct TupleElement<true, 9, GTEST_10_TUPLE_(T) > {
00199 typedef T9 type;
00200 };
00201
00202 }
00203
00204 template <>
00205 class tuple<> {
00206 public:
00207 tuple() {}
00208 tuple(const tuple& ) {}
00209 tuple& operator=(const tuple& ) { return *this; }
00210 };
00211
00212 template <GTEST_1_TYPENAMES_(T)>
00213 class GTEST_1_TUPLE_(T) {
00214 public:
00215 template <int k> friend class gtest_internal::Get;
00216
00217 tuple() : f0_() {}
00218
00219 explicit tuple(GTEST_BY_REF_(T0) f0) : f0_(f0) {}
00220
00221 tuple(const tuple& t) : f0_(t.f0_) {}
00222
00223 template <GTEST_1_TYPENAMES_(U)>
00224 tuple(const GTEST_1_TUPLE_(U)& t) : f0_(t.f0_) {}
00225
00226 tuple& operator=(const tuple& t) { return CopyFrom(t); }
00227
00228 template <GTEST_1_TYPENAMES_(U)>
00229 tuple& operator=(const GTEST_1_TUPLE_(U)& t) {
00230 return CopyFrom(t);
00231 }
00232
00233 GTEST_DECLARE_TUPLE_AS_FRIEND_
00234
00235 template <GTEST_1_TYPENAMES_(U)>
00236 tuple& CopyFrom(const GTEST_1_TUPLE_(U)& t) {
00237 f0_ = t.f0_;
00238 return *this;
00239 }
00240
00241 T0 f0_;
00242 };
00243
00244 template <GTEST_2_TYPENAMES_(T)>
00245 class GTEST_2_TUPLE_(T) {
00246 public:
00247 template <int k> friend class gtest_internal::Get;
00248
00249 tuple() : f0_(), f1_() {}
00250
00251 explicit tuple(GTEST_BY_REF_(T0) f0, GTEST_BY_REF_(T1) f1) : f0_(f0),
00252 f1_(f1) {}
00253
00254 tuple(const tuple& t) : f0_(t.f0_), f1_(t.f1_) {}
00255
00256 template <GTEST_2_TYPENAMES_(U)>
00257 tuple(const GTEST_2_TUPLE_(U)& t) : f0_(t.f0_), f1_(t.f1_) {}
00258 template <typename U0, typename U1>
00259 tuple(const ::std::pair<U0, U1>& p) : f0_(p.first), f1_(p.second) {}
00260
00261 tuple& operator=(const tuple& t) { return CopyFrom(t); }
00262
00263 template <GTEST_2_TYPENAMES_(U)>
00264 tuple& operator=(const GTEST_2_TUPLE_(U)& t) {
00265 return CopyFrom(t);
00266 }
00267 template <typename U0, typename U1>
00268 tuple& operator=(const ::std::pair<U0, U1>& p) {
00269 f0_ = p.first;
00270 f1_ = p.second;
00271 return *this;
00272 }
00273
00274 GTEST_DECLARE_TUPLE_AS_FRIEND_
00275
00276 template <GTEST_2_TYPENAMES_(U)>
00277 tuple& CopyFrom(const GTEST_2_TUPLE_(U)& t) {
00278 f0_ = t.f0_;
00279 f1_ = t.f1_;
00280 return *this;
00281 }
00282
00283 T0 f0_;
00284 T1 f1_;
00285 };
00286
00287 template <GTEST_3_TYPENAMES_(T)>
00288 class GTEST_3_TUPLE_(T) {
00289 public:
00290 template <int k> friend class gtest_internal::Get;
00291
00292 tuple() : f0_(), f1_(), f2_() {}
00293
00294 explicit tuple(GTEST_BY_REF_(T0) f0, GTEST_BY_REF_(T1) f1,
00295 GTEST_BY_REF_(T2) f2) : f0_(f0), f1_(f1), f2_(f2) {}
00296
00297 tuple(const tuple& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_) {}
00298
00299 template <GTEST_3_TYPENAMES_(U)>
00300 tuple(const GTEST_3_TUPLE_(U)& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_) {}
00301
00302 tuple& operator=(const tuple& t) { return CopyFrom(t); }
00303
00304 template <GTEST_3_TYPENAMES_(U)>
00305 tuple& operator=(const GTEST_3_TUPLE_(U)& t) {
00306 return CopyFrom(t);
00307 }
00308
00309 GTEST_DECLARE_TUPLE_AS_FRIEND_
00310
00311 template <GTEST_3_TYPENAMES_(U)>
00312 tuple& CopyFrom(const GTEST_3_TUPLE_(U)& t) {
00313 f0_ = t.f0_;
00314 f1_ = t.f1_;
00315 f2_ = t.f2_;
00316 return *this;
00317 }
00318
00319 T0 f0_;
00320 T1 f1_;
00321 T2 f2_;
00322 };
00323
00324 template <GTEST_4_TYPENAMES_(T)>
00325 class GTEST_4_TUPLE_(T) {
00326 public:
00327 template <int k> friend class gtest_internal::Get;
00328
00329 tuple() : f0_(), f1_(), f2_(), f3_() {}
00330
00331 explicit tuple(GTEST_BY_REF_(T0) f0, GTEST_BY_REF_(T1) f1,
00332 GTEST_BY_REF_(T2) f2, GTEST_BY_REF_(T3) f3) : f0_(f0), f1_(f1), f2_(f2),
00333 f3_(f3) {}
00334
00335 tuple(const tuple& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_), f3_(t.f3_) {}
00336
00337 template <GTEST_4_TYPENAMES_(U)>
00338 tuple(const GTEST_4_TUPLE_(U)& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_),
00339 f3_(t.f3_) {}
00340
00341 tuple& operator=(const tuple& t) { return CopyFrom(t); }
00342
00343 template <GTEST_4_TYPENAMES_(U)>
00344 tuple& operator=(const GTEST_4_TUPLE_(U)& t) {
00345 return CopyFrom(t);
00346 }
00347
00348 GTEST_DECLARE_TUPLE_AS_FRIEND_
00349
00350 template <GTEST_4_TYPENAMES_(U)>
00351 tuple& CopyFrom(const GTEST_4_TUPLE_(U)& t) {
00352 f0_ = t.f0_;
00353 f1_ = t.f1_;
00354 f2_ = t.f2_;
00355 f3_ = t.f3_;
00356 return *this;
00357 }
00358
00359 T0 f0_;
00360 T1 f1_;
00361 T2 f2_;
00362 T3 f3_;
00363 };
00364
00365 template <GTEST_5_TYPENAMES_(T)>
00366 class GTEST_5_TUPLE_(T) {
00367 public:
00368 template <int k> friend class gtest_internal::Get;
00369
00370 tuple() : f0_(), f1_(), f2_(), f3_(), f4_() {}
00371
00372 explicit tuple(GTEST_BY_REF_(T0) f0, GTEST_BY_REF_(T1) f1,
00373 GTEST_BY_REF_(T2) f2, GTEST_BY_REF_(T3) f3,
00374 GTEST_BY_REF_(T4) f4) : f0_(f0), f1_(f1), f2_(f2), f3_(f3), f4_(f4) {}
00375
00376 tuple(const tuple& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_), f3_(t.f3_),
00377 f4_(t.f4_) {}
00378
00379 template <GTEST_5_TYPENAMES_(U)>
00380 tuple(const GTEST_5_TUPLE_(U)& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_),
00381 f3_(t.f3_), f4_(t.f4_) {}
00382
00383 tuple& operator=(const tuple& t) { return CopyFrom(t); }
00384
00385 template <GTEST_5_TYPENAMES_(U)>
00386 tuple& operator=(const GTEST_5_TUPLE_(U)& t) {
00387 return CopyFrom(t);
00388 }
00389
00390 GTEST_DECLARE_TUPLE_AS_FRIEND_
00391
00392 template <GTEST_5_TYPENAMES_(U)>
00393 tuple& CopyFrom(const GTEST_5_TUPLE_(U)& t) {
00394 f0_ = t.f0_;
00395 f1_ = t.f1_;
00396 f2_ = t.f2_;
00397 f3_ = t.f3_;
00398 f4_ = t.f4_;
00399 return *this;
00400 }
00401
00402 T0 f0_;
00403 T1 f1_;
00404 T2 f2_;
00405 T3 f3_;
00406 T4 f4_;
00407 };
00408
00409 template <GTEST_6_TYPENAMES_(T)>
00410 class GTEST_6_TUPLE_(T) {
00411 public:
00412 template <int k> friend class gtest_internal::Get;
00413
00414 tuple() : f0_(), f1_(), f2_(), f3_(), f4_(), f5_() {}
00415
00416 explicit tuple(GTEST_BY_REF_(T0) f0, GTEST_BY_REF_(T1) f1,
00417 GTEST_BY_REF_(T2) f2, GTEST_BY_REF_(T3) f3, GTEST_BY_REF_(T4) f4,
00418 GTEST_BY_REF_(T5) f5) : f0_(f0), f1_(f1), f2_(f2), f3_(f3), f4_(f4),
00419 f5_(f5) {}
00420
00421 tuple(const tuple& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_), f3_(t.f3_),
00422 f4_(t.f4_), f5_(t.f5_) {}
00423
00424 template <GTEST_6_TYPENAMES_(U)>
00425 tuple(const GTEST_6_TUPLE_(U)& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_),
00426 f3_(t.f3_), f4_(t.f4_), f5_(t.f5_) {}
00427
00428 tuple& operator=(const tuple& t) { return CopyFrom(t); }
00429
00430 template <GTEST_6_TYPENAMES_(U)>
00431 tuple& operator=(const GTEST_6_TUPLE_(U)& t) {
00432 return CopyFrom(t);
00433 }
00434
00435 GTEST_DECLARE_TUPLE_AS_FRIEND_
00436
00437 template <GTEST_6_TYPENAMES_(U)>
00438 tuple& CopyFrom(const GTEST_6_TUPLE_(U)& t) {
00439 f0_ = t.f0_;
00440 f1_ = t.f1_;
00441 f2_ = t.f2_;
00442 f3_ = t.f3_;
00443 f4_ = t.f4_;
00444 f5_ = t.f5_;
00445 return *this;
00446 }
00447
00448 T0 f0_;
00449 T1 f1_;
00450 T2 f2_;
00451 T3 f3_;
00452 T4 f4_;
00453 T5 f5_;
00454 };
00455
00456 template <GTEST_7_TYPENAMES_(T)>
00457 class GTEST_7_TUPLE_(T) {
00458 public:
00459 template <int k> friend class gtest_internal::Get;
00460
00461 tuple() : f0_(), f1_(), f2_(), f3_(), f4_(), f5_(), f6_() {}
00462
00463 explicit tuple(GTEST_BY_REF_(T0) f0, GTEST_BY_REF_(T1) f1,
00464 GTEST_BY_REF_(T2) f2, GTEST_BY_REF_(T3) f3, GTEST_BY_REF_(T4) f4,
00465 GTEST_BY_REF_(T5) f5, GTEST_BY_REF_(T6) f6) : f0_(f0), f1_(f1), f2_(f2),
00466 f3_(f3), f4_(f4), f5_(f5), f6_(f6) {}
00467
00468 tuple(const tuple& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_), f3_(t.f3_),
00469 f4_(t.f4_), f5_(t.f5_), f6_(t.f6_) {}
00470
00471 template <GTEST_7_TYPENAMES_(U)>
00472 tuple(const GTEST_7_TUPLE_(U)& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_),
00473 f3_(t.f3_), f4_(t.f4_), f5_(t.f5_), f6_(t.f6_) {}
00474
00475 tuple& operator=(const tuple& t) { return CopyFrom(t); }
00476
00477 template <GTEST_7_TYPENAMES_(U)>
00478 tuple& operator=(const GTEST_7_TUPLE_(U)& t) {
00479 return CopyFrom(t);
00480 }
00481
00482 GTEST_DECLARE_TUPLE_AS_FRIEND_
00483
00484 template <GTEST_7_TYPENAMES_(U)>
00485 tuple& CopyFrom(const GTEST_7_TUPLE_(U)& t) {
00486 f0_ = t.f0_;
00487 f1_ = t.f1_;
00488 f2_ = t.f2_;
00489 f3_ = t.f3_;
00490 f4_ = t.f4_;
00491 f5_ = t.f5_;
00492 f6_ = t.f6_;
00493 return *this;
00494 }
00495
00496 T0 f0_;
00497 T1 f1_;
00498 T2 f2_;
00499 T3 f3_;
00500 T4 f4_;
00501 T5 f5_;
00502 T6 f6_;
00503 };
00504
00505 template <GTEST_8_TYPENAMES_(T)>
00506 class GTEST_8_TUPLE_(T) {
00507 public:
00508 template <int k> friend class gtest_internal::Get;
00509
00510 tuple() : f0_(), f1_(), f2_(), f3_(), f4_(), f5_(), f6_(), f7_() {}
00511
00512 explicit tuple(GTEST_BY_REF_(T0) f0, GTEST_BY_REF_(T1) f1,
00513 GTEST_BY_REF_(T2) f2, GTEST_BY_REF_(T3) f3, GTEST_BY_REF_(T4) f4,
00514 GTEST_BY_REF_(T5) f5, GTEST_BY_REF_(T6) f6,
00515 GTEST_BY_REF_(T7) f7) : f0_(f0), f1_(f1), f2_(f2), f3_(f3), f4_(f4),
00516 f5_(f5), f6_(f6), f7_(f7) {}
00517
00518 tuple(const tuple& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_), f3_(t.f3_),
00519 f4_(t.f4_), f5_(t.f5_), f6_(t.f6_), f7_(t.f7_) {}
00520
00521 template <GTEST_8_TYPENAMES_(U)>
00522 tuple(const GTEST_8_TUPLE_(U)& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_),
00523 f3_(t.f3_), f4_(t.f4_), f5_(t.f5_), f6_(t.f6_), f7_(t.f7_) {}
00524
00525 tuple& operator=(const tuple& t) { return CopyFrom(t); }
00526
00527 template <GTEST_8_TYPENAMES_(U)>
00528 tuple& operator=(const GTEST_8_TUPLE_(U)& t) {
00529 return CopyFrom(t);
00530 }
00531
00532 GTEST_DECLARE_TUPLE_AS_FRIEND_
00533
00534 template <GTEST_8_TYPENAMES_(U)>
00535 tuple& CopyFrom(const GTEST_8_TUPLE_(U)& t) {
00536 f0_ = t.f0_;
00537 f1_ = t.f1_;
00538 f2_ = t.f2_;
00539 f3_ = t.f3_;
00540 f4_ = t.f4_;
00541 f5_ = t.f5_;
00542 f6_ = t.f6_;
00543 f7_ = t.f7_;
00544 return *this;
00545 }
00546
00547 T0 f0_;
00548 T1 f1_;
00549 T2 f2_;
00550 T3 f3_;
00551 T4 f4_;
00552 T5 f5_;
00553 T6 f6_;
00554 T7 f7_;
00555 };
00556
00557 template <GTEST_9_TYPENAMES_(T)>
00558 class GTEST_9_TUPLE_(T) {
00559 public:
00560 template <int k> friend class gtest_internal::Get;
00561
00562 tuple() : f0_(), f1_(), f2_(), f3_(), f4_(), f5_(), f6_(), f7_(), f8_() {}
00563
00564 explicit tuple(GTEST_BY_REF_(T0) f0, GTEST_BY_REF_(T1) f1,
00565 GTEST_BY_REF_(T2) f2, GTEST_BY_REF_(T3) f3, GTEST_BY_REF_(T4) f4,
00566 GTEST_BY_REF_(T5) f5, GTEST_BY_REF_(T6) f6, GTEST_BY_REF_(T7) f7,
00567 GTEST_BY_REF_(T8) f8) : f0_(f0), f1_(f1), f2_(f2), f3_(f3), f4_(f4),
00568 f5_(f5), f6_(f6), f7_(f7), f8_(f8) {}
00569
00570 tuple(const tuple& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_), f3_(t.f3_),
00571 f4_(t.f4_), f5_(t.f5_), f6_(t.f6_), f7_(t.f7_), f8_(t.f8_) {}
00572
00573 template <GTEST_9_TYPENAMES_(U)>
00574 tuple(const GTEST_9_TUPLE_(U)& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_),
00575 f3_(t.f3_), f4_(t.f4_), f5_(t.f5_), f6_(t.f6_), f7_(t.f7_), f8_(t.f8_) {}
00576
00577 tuple& operator=(const tuple& t) { return CopyFrom(t); }
00578
00579 template <GTEST_9_TYPENAMES_(U)>
00580 tuple& operator=(const GTEST_9_TUPLE_(U)& t) {
00581 return CopyFrom(t);
00582 }
00583
00584 GTEST_DECLARE_TUPLE_AS_FRIEND_
00585
00586 template <GTEST_9_TYPENAMES_(U)>
00587 tuple& CopyFrom(const GTEST_9_TUPLE_(U)& t) {
00588 f0_ = t.f0_;
00589 f1_ = t.f1_;
00590 f2_ = t.f2_;
00591 f3_ = t.f3_;
00592 f4_ = t.f4_;
00593 f5_ = t.f5_;
00594 f6_ = t.f6_;
00595 f7_ = t.f7_;
00596 f8_ = t.f8_;
00597 return *this;
00598 }
00599
00600 T0 f0_;
00601 T1 f1_;
00602 T2 f2_;
00603 T3 f3_;
00604 T4 f4_;
00605 T5 f5_;
00606 T6 f6_;
00607 T7 f7_;
00608 T8 f8_;
00609 };
00610
00611 template <GTEST_10_TYPENAMES_(T)>
00612 class tuple {
00613 public:
00614 template <int k> friend class gtest_internal::Get;
00615
00616 tuple() : f0_(), f1_(), f2_(), f3_(), f4_(), f5_(), f6_(), f7_(), f8_(),
00617 f9_() {}
00618
00619 explicit tuple(GTEST_BY_REF_(T0) f0, GTEST_BY_REF_(T1) f1,
00620 GTEST_BY_REF_(T2) f2, GTEST_BY_REF_(T3) f3, GTEST_BY_REF_(T4) f4,
00621 GTEST_BY_REF_(T5) f5, GTEST_BY_REF_(T6) f6, GTEST_BY_REF_(T7) f7,
00622 GTEST_BY_REF_(T8) f8, GTEST_BY_REF_(T9) f9) : f0_(f0), f1_(f1), f2_(f2),
00623 f3_(f3), f4_(f4), f5_(f5), f6_(f6), f7_(f7), f8_(f8), f9_(f9) {}
00624
00625 tuple(const tuple& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_), f3_(t.f3_),
00626 f4_(t.f4_), f5_(t.f5_), f6_(t.f6_), f7_(t.f7_), f8_(t.f8_), f9_(t.f9_) {}
00627
00628 template <GTEST_10_TYPENAMES_(U)>
00629 tuple(const GTEST_10_TUPLE_(U)& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_),
00630 f3_(t.f3_), f4_(t.f4_), f5_(t.f5_), f6_(t.f6_), f7_(t.f7_), f8_(t.f8_),
00631 f9_(t.f9_) {}
00632
00633 tuple& operator=(const tuple& t) { return CopyFrom(t); }
00634
00635 template <GTEST_10_TYPENAMES_(U)>
00636 tuple& operator=(const GTEST_10_TUPLE_(U)& t) {
00637 return CopyFrom(t);
00638 }
00639
00640 GTEST_DECLARE_TUPLE_AS_FRIEND_
00641
00642 template <GTEST_10_TYPENAMES_(U)>
00643 tuple& CopyFrom(const GTEST_10_TUPLE_(U)& t) {
00644 f0_ = t.f0_;
00645 f1_ = t.f1_;
00646 f2_ = t.f2_;
00647 f3_ = t.f3_;
00648 f4_ = t.f4_;
00649 f5_ = t.f5_;
00650 f6_ = t.f6_;
00651 f7_ = t.f7_;
00652 f8_ = t.f8_;
00653 f9_ = t.f9_;
00654 return *this;
00655 }
00656
00657 T0 f0_;
00658 T1 f1_;
00659 T2 f2_;
00660 T3 f3_;
00661 T4 f4_;
00662 T5 f5_;
00663 T6 f6_;
00664 T7 f7_;
00665 T8 f8_;
00666 T9 f9_;
00667 };
00668
00669
00670
00671
00672
00673
00674
00675 inline tuple<> make_tuple() { return tuple<>(); }
00676
00677 template <GTEST_1_TYPENAMES_(T)>
00678 inline GTEST_1_TUPLE_(T) make_tuple(const T0& f0) {
00679 return GTEST_1_TUPLE_(T)(f0);
00680 }
00681
00682 template <GTEST_2_TYPENAMES_(T)>
00683 inline GTEST_2_TUPLE_(T) make_tuple(const T0& f0, const T1& f1) {
00684 return GTEST_2_TUPLE_(T)(f0, f1);
00685 }
00686
00687 template <GTEST_3_TYPENAMES_(T)>
00688 inline GTEST_3_TUPLE_(T) make_tuple(const T0& f0, const T1& f1, const T2& f2) {
00689 return GTEST_3_TUPLE_(T)(f0, f1, f2);
00690 }
00691
00692 template <GTEST_4_TYPENAMES_(T)>
00693 inline GTEST_4_TUPLE_(T) make_tuple(const T0& f0, const T1& f1, const T2& f2,
00694 const T3& f3) {
00695 return GTEST_4_TUPLE_(T)(f0, f1, f2, f3);
00696 }
00697
00698 template <GTEST_5_TYPENAMES_(T)>
00699 inline GTEST_5_TUPLE_(T) make_tuple(const T0& f0, const T1& f1, const T2& f2,
00700 const T3& f3, const T4& f4) {
00701 return GTEST_5_TUPLE_(T)(f0, f1, f2, f3, f4);
00702 }
00703
00704 template <GTEST_6_TYPENAMES_(T)>
00705 inline GTEST_6_TUPLE_(T) make_tuple(const T0& f0, const T1& f1, const T2& f2,
00706 const T3& f3, const T4& f4, const T5& f5) {
00707 return GTEST_6_TUPLE_(T)(f0, f1, f2, f3, f4, f5);
00708 }
00709
00710 template <GTEST_7_TYPENAMES_(T)>
00711 inline GTEST_7_TUPLE_(T) make_tuple(const T0& f0, const T1& f1, const T2& f2,
00712 const T3& f3, const T4& f4, const T5& f5, const T6& f6) {
00713 return GTEST_7_TUPLE_(T)(f0, f1, f2, f3, f4, f5, f6);
00714 }
00715
00716 template <GTEST_8_TYPENAMES_(T)>
00717 inline GTEST_8_TUPLE_(T) make_tuple(const T0& f0, const T1& f1, const T2& f2,
00718 const T3& f3, const T4& f4, const T5& f5, const T6& f6, const T7& f7) {
00719 return GTEST_8_TUPLE_(T)(f0, f1, f2, f3, f4, f5, f6, f7);
00720 }
00721
00722 template <GTEST_9_TYPENAMES_(T)>
00723 inline GTEST_9_TUPLE_(T) make_tuple(const T0& f0, const T1& f1, const T2& f2,
00724 const T3& f3, const T4& f4, const T5& f5, const T6& f6, const T7& f7,
00725 const T8& f8) {
00726 return GTEST_9_TUPLE_(T)(f0, f1, f2, f3, f4, f5, f6, f7, f8);
00727 }
00728
00729 template <GTEST_10_TYPENAMES_(T)>
00730 inline GTEST_10_TUPLE_(T) make_tuple(const T0& f0, const T1& f1, const T2& f2,
00731 const T3& f3, const T4& f4, const T5& f5, const T6& f6, const T7& f7,
00732 const T8& f8, const T9& f9) {
00733 return GTEST_10_TUPLE_(T)(f0, f1, f2, f3, f4, f5, f6, f7, f8, f9);
00734 }
00735
00736
00737
00738 template <typename Tuple> struct tuple_size;
00739
00740 template <GTEST_0_TYPENAMES_(T)>
00741 struct tuple_size<GTEST_0_TUPLE_(T) > {
00742 static const int value = 0;
00743 };
00744
00745 template <GTEST_1_TYPENAMES_(T)>
00746 struct tuple_size<GTEST_1_TUPLE_(T) > {
00747 static const int value = 1;
00748 };
00749
00750 template <GTEST_2_TYPENAMES_(T)>
00751 struct tuple_size<GTEST_2_TUPLE_(T) > {
00752 static const int value = 2;
00753 };
00754
00755 template <GTEST_3_TYPENAMES_(T)>
00756 struct tuple_size<GTEST_3_TUPLE_(T) > {
00757 static const int value = 3;
00758 };
00759
00760 template <GTEST_4_TYPENAMES_(T)>
00761 struct tuple_size<GTEST_4_TUPLE_(T) > {
00762 static const int value = 4;
00763 };
00764
00765 template <GTEST_5_TYPENAMES_(T)>
00766 struct tuple_size<GTEST_5_TUPLE_(T) > {
00767 static const int value = 5;
00768 };
00769
00770 template <GTEST_6_TYPENAMES_(T)>
00771 struct tuple_size<GTEST_6_TUPLE_(T) > {
00772 static const int value = 6;
00773 };
00774
00775 template <GTEST_7_TYPENAMES_(T)>
00776 struct tuple_size<GTEST_7_TUPLE_(T) > {
00777 static const int value = 7;
00778 };
00779
00780 template <GTEST_8_TYPENAMES_(T)>
00781 struct tuple_size<GTEST_8_TUPLE_(T) > {
00782 static const int value = 8;
00783 };
00784
00785 template <GTEST_9_TYPENAMES_(T)>
00786 struct tuple_size<GTEST_9_TUPLE_(T) > {
00787 static const int value = 9;
00788 };
00789
00790 template <GTEST_10_TYPENAMES_(T)>
00791 struct tuple_size<GTEST_10_TUPLE_(T) > {
00792 static const int value = 10;
00793 };
00794
00795 template <int k, class Tuple>
00796 struct tuple_element {
00797 typedef typename gtest_internal::TupleElement<
00798 k < (tuple_size<Tuple>::value), k, Tuple>::type type;
00799 };
00800
00801 #define GTEST_TUPLE_ELEMENT_(k, Tuple) typename tuple_element<k, Tuple >::type
00802
00803
00804
00805 namespace gtest_internal {
00806
00807 template <>
00808 class Get<0> {
00809 public:
00810 template <class Tuple>
00811 static GTEST_ADD_REF_(GTEST_TUPLE_ELEMENT_(0, Tuple))
00812 Field(Tuple& t) { return t.f0_; }
00813
00814 template <class Tuple>
00815 static GTEST_BY_REF_(GTEST_TUPLE_ELEMENT_(0, Tuple))
00816 ConstField(const Tuple& t) { return t.f0_; }
00817 };
00818
00819 template <>
00820 class Get<1> {
00821 public:
00822 template <class Tuple>
00823 static GTEST_ADD_REF_(GTEST_TUPLE_ELEMENT_(1, Tuple))
00824 Field(Tuple& t) { return t.f1_; }
00825
00826 template <class Tuple>
00827 static GTEST_BY_REF_(GTEST_TUPLE_ELEMENT_(1, Tuple))
00828 ConstField(const Tuple& t) { return t.f1_; }
00829 };
00830
00831 template <>
00832 class Get<2> {
00833 public:
00834 template <class Tuple>
00835 static GTEST_ADD_REF_(GTEST_TUPLE_ELEMENT_(2, Tuple))
00836 Field(Tuple& t) { return t.f2_; }
00837
00838 template <class Tuple>
00839 static GTEST_BY_REF_(GTEST_TUPLE_ELEMENT_(2, Tuple))
00840 ConstField(const Tuple& t) { return t.f2_; }
00841 };
00842
00843 template <>
00844 class Get<3> {
00845 public:
00846 template <class Tuple>
00847 static GTEST_ADD_REF_(GTEST_TUPLE_ELEMENT_(3, Tuple))
00848 Field(Tuple& t) { return t.f3_; }
00849
00850 template <class Tuple>
00851 static GTEST_BY_REF_(GTEST_TUPLE_ELEMENT_(3, Tuple))
00852 ConstField(const Tuple& t) { return t.f3_; }
00853 };
00854
00855 template <>
00856 class Get<4> {
00857 public:
00858 template <class Tuple>
00859 static GTEST_ADD_REF_(GTEST_TUPLE_ELEMENT_(4, Tuple))
00860 Field(Tuple& t) { return t.f4_; }
00861
00862 template <class Tuple>
00863 static GTEST_BY_REF_(GTEST_TUPLE_ELEMENT_(4, Tuple))
00864 ConstField(const Tuple& t) { return t.f4_; }
00865 };
00866
00867 template <>
00868 class Get<5> {
00869 public:
00870 template <class Tuple>
00871 static GTEST_ADD_REF_(GTEST_TUPLE_ELEMENT_(5, Tuple))
00872 Field(Tuple& t) { return t.f5_; }
00873
00874 template <class Tuple>
00875 static GTEST_BY_REF_(GTEST_TUPLE_ELEMENT_(5, Tuple))
00876 ConstField(const Tuple& t) { return t.f5_; }
00877 };
00878
00879 template <>
00880 class Get<6> {
00881 public:
00882 template <class Tuple>
00883 static GTEST_ADD_REF_(GTEST_TUPLE_ELEMENT_(6, Tuple))
00884 Field(Tuple& t) { return t.f6_; }
00885
00886 template <class Tuple>
00887 static GTEST_BY_REF_(GTEST_TUPLE_ELEMENT_(6, Tuple))
00888 ConstField(const Tuple& t) { return t.f6_; }
00889 };
00890
00891 template <>
00892 class Get<7> {
00893 public:
00894 template <class Tuple>
00895 static GTEST_ADD_REF_(GTEST_TUPLE_ELEMENT_(7, Tuple))
00896 Field(Tuple& t) { return t.f7_; }
00897
00898 template <class Tuple>
00899 static GTEST_BY_REF_(GTEST_TUPLE_ELEMENT_(7, Tuple))
00900 ConstField(const Tuple& t) { return t.f7_; }
00901 };
00902
00903 template <>
00904 class Get<8> {
00905 public:
00906 template <class Tuple>
00907 static GTEST_ADD_REF_(GTEST_TUPLE_ELEMENT_(8, Tuple))
00908 Field(Tuple& t) { return t.f8_; }
00909
00910 template <class Tuple>
00911 static GTEST_BY_REF_(GTEST_TUPLE_ELEMENT_(8, Tuple))
00912 ConstField(const Tuple& t) { return t.f8_; }
00913 };
00914
00915 template <>
00916 class Get<9> {
00917 public:
00918 template <class Tuple>
00919 static GTEST_ADD_REF_(GTEST_TUPLE_ELEMENT_(9, Tuple))
00920 Field(Tuple& t) { return t.f9_; }
00921
00922 template <class Tuple>
00923 static GTEST_BY_REF_(GTEST_TUPLE_ELEMENT_(9, Tuple))
00924 ConstField(const Tuple& t) { return t.f9_; }
00925 };
00926
00927 }
00928
00929 template <int k, GTEST_10_TYPENAMES_(T)>
00930 GTEST_ADD_REF_(GTEST_TUPLE_ELEMENT_(k, GTEST_10_TUPLE_(T)))
00931 get(GTEST_10_TUPLE_(T)& t) {
00932 return gtest_internal::Get<k>::Field(t);
00933 }
00934
00935 template <int k, GTEST_10_TYPENAMES_(T)>
00936 GTEST_BY_REF_(GTEST_TUPLE_ELEMENT_(k, GTEST_10_TUPLE_(T)))
00937 get(const GTEST_10_TUPLE_(T)& t) {
00938 return gtest_internal::Get<k>::ConstField(t);
00939 }
00940
00941
00942
00943
00944
00945 namespace gtest_internal {
00946
00947
00948
00949
00950
00951 template <int kSize1, int kSize2>
00952 struct SameSizeTuplePrefixComparator;
00953
00954 template <>
00955 struct SameSizeTuplePrefixComparator<0, 0> {
00956 template <class Tuple1, class Tuple2>
00957 static bool Eq(const Tuple1& , const Tuple2& ) {
00958 return true;
00959 }
00960 };
00961
00962 template <int k>
00963 struct SameSizeTuplePrefixComparator<k, k> {
00964 template <class Tuple1, class Tuple2>
00965 static bool Eq(const Tuple1& t1, const Tuple2& t2) {
00966 return SameSizeTuplePrefixComparator<k - 1, k - 1>::Eq(t1, t2) &&
00967 ::std::tr1::get<k - 1>(t1) == ::std::tr1::get<k - 1>(t2);
00968 }
00969 };
00970
00971 }
00972
00973 template <GTEST_10_TYPENAMES_(T), GTEST_10_TYPENAMES_(U)>
00974 inline bool operator==(const GTEST_10_TUPLE_(T)& t,
00975 const GTEST_10_TUPLE_(U)& u) {
00976 return gtest_internal::SameSizeTuplePrefixComparator<
00977 tuple_size<GTEST_10_TUPLE_(T) >::value,
00978 tuple_size<GTEST_10_TUPLE_(U) >::value>::Eq(t, u);
00979 }
00980
00981 template <GTEST_10_TYPENAMES_(T), GTEST_10_TYPENAMES_(U)>
00982 inline bool operator!=(const GTEST_10_TUPLE_(T)& t,
00983 const GTEST_10_TUPLE_(U)& u) { return !(t == u); }
00984
00985
00986
00987
00988 }
00989 }
00990
00991 #undef GTEST_0_TUPLE_
00992 #undef GTEST_1_TUPLE_
00993 #undef GTEST_2_TUPLE_
00994 #undef GTEST_3_TUPLE_
00995 #undef GTEST_4_TUPLE_
00996 #undef GTEST_5_TUPLE_
00997 #undef GTEST_6_TUPLE_
00998 #undef GTEST_7_TUPLE_
00999 #undef GTEST_8_TUPLE_
01000 #undef GTEST_9_TUPLE_
01001 #undef GTEST_10_TUPLE_
01002
01003 #undef GTEST_0_TYPENAMES_
01004 #undef GTEST_1_TYPENAMES_
01005 #undef GTEST_2_TYPENAMES_
01006 #undef GTEST_3_TYPENAMES_
01007 #undef GTEST_4_TYPENAMES_
01008 #undef GTEST_5_TYPENAMES_
01009 #undef GTEST_6_TYPENAMES_
01010 #undef GTEST_7_TYPENAMES_
01011 #undef GTEST_8_TYPENAMES_
01012 #undef GTEST_9_TYPENAMES_
01013 #undef GTEST_10_TYPENAMES_
01014
01015 #undef GTEST_DECLARE_TUPLE_AS_FRIEND_
01016 #undef GTEST_BY_REF_
01017 #undef GTEST_ADD_REF_
01018 #undef GTEST_TUPLE_ELEMENT_
01019
01020 #endif // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_TUPLE_H_