Qucs-core
0.0.19
|
00001 // This file was GENERATED by command: 00002 // pump.py gtest-tuple.h.pump 00003 // DO NOT EDIT BY HAND!!! 00004 00005 // Copyright 2009 Google Inc. 00006 // All Rights Reserved. 00007 // 00008 // Redistribution and use in source and binary forms, with or without 00009 // modification, are permitted provided that the following conditions are 00010 // met: 00011 // 00012 // * Redistributions of source code must retain the above copyright 00013 // notice, this list of conditions and the following disclaimer. 00014 // * Redistributions in binary form must reproduce the above 00015 // copyright notice, this list of conditions and the following disclaimer 00016 // in the documentation and/or other materials provided with the 00017 // distribution. 00018 // * Neither the name of Google Inc. nor the names of its 00019 // contributors may be used to endorse or promote products derived from 00020 // this software without specific prior written permission. 00021 // 00022 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 00023 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 00024 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 00025 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 00026 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 00027 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 00028 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 00029 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 00030 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 00031 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 00032 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00033 // 00034 // Author: wan@google.com (Zhanyong Wan) 00035 00036 // Implements a subset of TR1 tuple needed by Google Test and Google Mock. 00037 00038 #ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_TUPLE_H_ 00039 #define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_TUPLE_H_ 00040 00041 #include <utility> // For ::std::pair. 00042 00043 // The compiler used in Symbian has a bug that prevents us from declaring the 00044 // tuple template as a friend (it complains that tuple is redefined). This 00045 // hack bypasses the bug by declaring the members that should otherwise be 00046 // private as public. 00047 // Sun Studio versions < 12 also have the above bug. 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 // GTEST_n_TUPLE_(T) is the type of an n-tuple. 00057 #define GTEST_0_TUPLE_(T) tuple<> 00058 #define GTEST_1_TUPLE_(T) tuple<T##0, void, void, void, void, void, void, \ 00059 void, void, void> 00060 #define GTEST_2_TUPLE_(T) tuple<T##0, T##1, void, void, void, void, void, \ 00061 void, void, void> 00062 #define GTEST_3_TUPLE_(T) tuple<T##0, T##1, T##2, void, void, void, void, \ 00063 void, void, void> 00064 #define GTEST_4_TUPLE_(T) tuple<T##0, T##1, T##2, T##3, void, void, void, \ 00065 void, void, void> 00066 #define GTEST_5_TUPLE_(T) tuple<T##0, T##1, T##2, T##3, T##4, void, void, \ 00067 void, void, void> 00068 #define GTEST_6_TUPLE_(T) tuple<T##0, T##1, T##2, T##3, T##4, T##5, void, \ 00069 void, void, void> 00070 #define GTEST_7_TUPLE_(T) tuple<T##0, T##1, T##2, T##3, T##4, T##5, T##6, \ 00071 void, void, void> 00072 #define GTEST_8_TUPLE_(T) tuple<T##0, T##1, T##2, T##3, T##4, T##5, T##6, \ 00073 T##7, void, void> 00074 #define GTEST_9_TUPLE_(T) tuple<T##0, T##1, T##2, T##3, T##4, T##5, T##6, \ 00075 T##7, T##8, void> 00076 #define GTEST_10_TUPLE_(T) tuple<T##0, T##1, T##2, T##3, T##4, T##5, T##6, \ 00077 T##7, T##8, T##9> 00078 00079 // GTEST_n_TYPENAMES_(T) declares a list of n typenames. 00080 #define GTEST_0_TYPENAMES_(T) 00081 #define GTEST_1_TYPENAMES_(T) typename T##0 00082 #define GTEST_2_TYPENAMES_(T) typename T##0, typename T##1 00083 #define GTEST_3_TYPENAMES_(T) typename T##0, typename T##1, typename T##2 00084 #define GTEST_4_TYPENAMES_(T) typename T##0, typename T##1, typename T##2, \ 00085 typename T##3 00086 #define GTEST_5_TYPENAMES_(T) typename T##0, typename T##1, typename T##2, \ 00087 typename T##3, typename T##4 00088 #define GTEST_6_TYPENAMES_(T) typename T##0, typename T##1, typename T##2, \ 00089 typename T##3, typename T##4, typename T##5 00090 #define GTEST_7_TYPENAMES_(T) typename T##0, typename T##1, typename T##2, \ 00091 typename T##3, typename T##4, typename T##5, typename T##6 00092 #define GTEST_8_TYPENAMES_(T) typename T##0, typename T##1, typename T##2, \ 00093 typename T##3, typename T##4, typename T##5, typename T##6, typename T##7 00094 #define GTEST_9_TYPENAMES_(T) typename T##0, typename T##1, typename T##2, \ 00095 typename T##3, typename T##4, typename T##5, typename T##6, \ 00096 typename T##7, typename T##8 00097 #define GTEST_10_TYPENAMES_(T) typename T##0, typename T##1, typename T##2, \ 00098 typename T##3, typename T##4, typename T##5, typename T##6, \ 00099 typename T##7, typename T##8, typename T##9 00100 00101 // In theory, defining stuff in the ::std namespace is undefined 00102 // behavior. We can do this as we are playing the role of a standard 00103 // library vendor. 00104 namespace std { 00105 namespace tr1 { 00106 00107 template <typename T0 = void, typename T1 = void, typename T2 = void, 00108 typename T3 = void, typename T4 = void, typename T5 = void, 00109 typename T6 = void, typename T7 = void, typename T8 = void, 00110 typename T9 = void> 00111 class tuple; 00112 00113 // Anything in namespace gtest_internal is Google Test's INTERNAL 00114 // IMPLEMENTATION DETAIL and MUST NOT BE USED DIRECTLY in user code. 00115 namespace gtest_internal { 00116 00117 // ByRef<T>::type is T if T is a reference; otherwise it's const T&. 00118 template <typename T> 00119 struct ByRef { typedef const T& type; }; // NOLINT 00120 template <typename T> 00121 struct ByRef<T&> { typedef T& type; }; // NOLINT 00122 00123 // A handy wrapper for ByRef. 00124 #define GTEST_BY_REF_(T) typename ::std::tr1::gtest_internal::ByRef<T>::type 00125 00126 // AddRef<T>::type is T if T is a reference; otherwise it's T&. This 00127 // is the same as tr1::add_reference<T>::type. 00128 template <typename T> 00129 struct AddRef { typedef T& type; }; // NOLINT 00130 template <typename T> 00131 struct AddRef<T&> { typedef T& type; }; // NOLINT 00132 00133 // A handy wrapper for AddRef. 00134 #define GTEST_ADD_REF_(T) typename ::std::tr1::gtest_internal::AddRef<T>::type 00135 00136 // A helper for implementing get<k>(). 00137 template <int k> class Get; 00138 00139 // A helper for implementing tuple_element<k, T>. kIndexValid is true 00140 // iff k < the number of fields in tuple type T. 00141 template <bool kIndexValid, int kIndex, class Tuple> 00142 struct TupleElement; 00143 00144 template <GTEST_10_TYPENAMES_(T)> 00145 struct TupleElement<true, 0, GTEST_10_TUPLE_(T) > { 00146 typedef T0 type; 00147 }; 00148 00149 template <GTEST_10_TYPENAMES_(T)> 00150 struct TupleElement<true, 1, GTEST_10_TUPLE_(T) > { 00151 typedef T1 type; 00152 }; 00153 00154 template <GTEST_10_TYPENAMES_(T)> 00155 struct TupleElement<true, 2, GTEST_10_TUPLE_(T) > { 00156 typedef T2 type; 00157 }; 00158 00159 template <GTEST_10_TYPENAMES_(T)> 00160 struct TupleElement<true, 3, GTEST_10_TUPLE_(T) > { 00161 typedef T3 type; 00162 }; 00163 00164 template <GTEST_10_TYPENAMES_(T)> 00165 struct TupleElement<true, 4, GTEST_10_TUPLE_(T) > { 00166 typedef T4 type; 00167 }; 00168 00169 template <GTEST_10_TYPENAMES_(T)> 00170 struct TupleElement<true, 5, GTEST_10_TUPLE_(T) > { 00171 typedef T5 type; 00172 }; 00173 00174 template <GTEST_10_TYPENAMES_(T)> 00175 struct TupleElement<true, 6, GTEST_10_TUPLE_(T) > { 00176 typedef T6 type; 00177 }; 00178 00179 template <GTEST_10_TYPENAMES_(T)> 00180 struct TupleElement<true, 7, GTEST_10_TUPLE_(T) > { 00181 typedef T7 type; 00182 }; 00183 00184 template <GTEST_10_TYPENAMES_(T)> 00185 struct TupleElement<true, 8, GTEST_10_TUPLE_(T) > { 00186 typedef T8 type; 00187 }; 00188 00189 template <GTEST_10_TYPENAMES_(T)> 00190 struct TupleElement<true, 9, GTEST_10_TUPLE_(T) > { 00191 typedef T9 type; 00192 }; 00193 00194 } // namespace gtest_internal 00195 00196 template <> 00197 class tuple<> { 00198 public: 00199 tuple() {} 00200 tuple(const tuple& /* t */) {} 00201 tuple& operator=(const tuple& /* t */) { return *this; } 00202 }; 00203 00204 template <GTEST_1_TYPENAMES_(T)> 00205 class GTEST_1_TUPLE_(T) { 00206 public: 00207 template <int k> friend class gtest_internal::Get; 00208 00209 tuple() : f0_() {} 00210 00211 explicit tuple(GTEST_BY_REF_(T0) f0) : f0_(f0) {} 00212 00213 tuple(const tuple& t) : f0_(t.f0_) {} 00214 00215 template <GTEST_1_TYPENAMES_(U)> 00216 tuple(const GTEST_1_TUPLE_(U)& t) : f0_(t.f0_) {} 00217 00218 tuple& operator=(const tuple& t) { return CopyFrom(t); } 00219 00220 template <GTEST_1_TYPENAMES_(U)> 00221 tuple& operator=(const GTEST_1_TUPLE_(U)& t) { 00222 return CopyFrom(t); 00223 } 00224 00225 GTEST_DECLARE_TUPLE_AS_FRIEND_ 00226 00227 template <GTEST_1_TYPENAMES_(U)> 00228 tuple& CopyFrom(const GTEST_1_TUPLE_(U)& t) { 00229 f0_ = t.f0_; 00230 return *this; 00231 } 00232 00233 T0 f0_; 00234 }; 00235 00236 template <GTEST_2_TYPENAMES_(T)> 00237 class GTEST_2_TUPLE_(T) { 00238 public: 00239 template <int k> friend class gtest_internal::Get; 00240 00241 tuple() : f0_(), f1_() {} 00242 00243 explicit tuple(GTEST_BY_REF_(T0) f0, GTEST_BY_REF_(T1) f1) : f0_(f0), 00244 f1_(f1) {} 00245 00246 tuple(const tuple& t) : f0_(t.f0_), f1_(t.f1_) {} 00247 00248 template <GTEST_2_TYPENAMES_(U)> 00249 tuple(const GTEST_2_TUPLE_(U)& t) : f0_(t.f0_), f1_(t.f1_) {} 00250 template <typename U0, typename U1> 00251 tuple(const ::std::pair<U0, U1>& p) : f0_(p.first), f1_(p.second) {} 00252 00253 tuple& operator=(const tuple& t) { return CopyFrom(t); } 00254 00255 template <GTEST_2_TYPENAMES_(U)> 00256 tuple& operator=(const GTEST_2_TUPLE_(U)& t) { 00257 return CopyFrom(t); 00258 } 00259 template <typename U0, typename U1> 00260 tuple& operator=(const ::std::pair<U0, U1>& p) { 00261 f0_ = p.first; 00262 f1_ = p.second; 00263 return *this; 00264 } 00265 00266 GTEST_DECLARE_TUPLE_AS_FRIEND_ 00267 00268 template <GTEST_2_TYPENAMES_(U)> 00269 tuple& CopyFrom(const GTEST_2_TUPLE_(U)& t) { 00270 f0_ = t.f0_; 00271 f1_ = t.f1_; 00272 return *this; 00273 } 00274 00275 T0 f0_; 00276 T1 f1_; 00277 }; 00278 00279 template <GTEST_3_TYPENAMES_(T)> 00280 class GTEST_3_TUPLE_(T) { 00281 public: 00282 template <int k> friend class gtest_internal::Get; 00283 00284 tuple() : f0_(), f1_(), f2_() {} 00285 00286 explicit tuple(GTEST_BY_REF_(T0) f0, GTEST_BY_REF_(T1) f1, 00287 GTEST_BY_REF_(T2) f2) : f0_(f0), f1_(f1), f2_(f2) {} 00288 00289 tuple(const tuple& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_) {} 00290 00291 template <GTEST_3_TYPENAMES_(U)> 00292 tuple(const GTEST_3_TUPLE_(U)& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_) {} 00293 00294 tuple& operator=(const tuple& t) { return CopyFrom(t); } 00295 00296 template <GTEST_3_TYPENAMES_(U)> 00297 tuple& operator=(const GTEST_3_TUPLE_(U)& t) { 00298 return CopyFrom(t); 00299 } 00300 00301 GTEST_DECLARE_TUPLE_AS_FRIEND_ 00302 00303 template <GTEST_3_TYPENAMES_(U)> 00304 tuple& CopyFrom(const GTEST_3_TUPLE_(U)& t) { 00305 f0_ = t.f0_; 00306 f1_ = t.f1_; 00307 f2_ = t.f2_; 00308 return *this; 00309 } 00310 00311 T0 f0_; 00312 T1 f1_; 00313 T2 f2_; 00314 }; 00315 00316 template <GTEST_4_TYPENAMES_(T)> 00317 class GTEST_4_TUPLE_(T) { 00318 public: 00319 template <int k> friend class gtest_internal::Get; 00320 00321 tuple() : f0_(), f1_(), f2_(), f3_() {} 00322 00323 explicit tuple(GTEST_BY_REF_(T0) f0, GTEST_BY_REF_(T1) f1, 00324 GTEST_BY_REF_(T2) f2, GTEST_BY_REF_(T3) f3) : f0_(f0), f1_(f1), f2_(f2), 00325 f3_(f3) {} 00326 00327 tuple(const tuple& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_), f3_(t.f3_) {} 00328 00329 template <GTEST_4_TYPENAMES_(U)> 00330 tuple(const GTEST_4_TUPLE_(U)& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_), 00331 f3_(t.f3_) {} 00332 00333 tuple& operator=(const tuple& t) { return CopyFrom(t); } 00334 00335 template <GTEST_4_TYPENAMES_(U)> 00336 tuple& operator=(const GTEST_4_TUPLE_(U)& t) { 00337 return CopyFrom(t); 00338 } 00339 00340 GTEST_DECLARE_TUPLE_AS_FRIEND_ 00341 00342 template <GTEST_4_TYPENAMES_(U)> 00343 tuple& CopyFrom(const GTEST_4_TUPLE_(U)& t) { 00344 f0_ = t.f0_; 00345 f1_ = t.f1_; 00346 f2_ = t.f2_; 00347 f3_ = t.f3_; 00348 return *this; 00349 } 00350 00351 T0 f0_; 00352 T1 f1_; 00353 T2 f2_; 00354 T3 f3_; 00355 }; 00356 00357 template <GTEST_5_TYPENAMES_(T)> 00358 class GTEST_5_TUPLE_(T) { 00359 public: 00360 template <int k> friend class gtest_internal::Get; 00361 00362 tuple() : f0_(), f1_(), f2_(), f3_(), f4_() {} 00363 00364 explicit tuple(GTEST_BY_REF_(T0) f0, GTEST_BY_REF_(T1) f1, 00365 GTEST_BY_REF_(T2) f2, GTEST_BY_REF_(T3) f3, 00366 GTEST_BY_REF_(T4) f4) : f0_(f0), f1_(f1), f2_(f2), f3_(f3), f4_(f4) {} 00367 00368 tuple(const tuple& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_), f3_(t.f3_), 00369 f4_(t.f4_) {} 00370 00371 template <GTEST_5_TYPENAMES_(U)> 00372 tuple(const GTEST_5_TUPLE_(U)& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_), 00373 f3_(t.f3_), f4_(t.f4_) {} 00374 00375 tuple& operator=(const tuple& t) { return CopyFrom(t); } 00376 00377 template <GTEST_5_TYPENAMES_(U)> 00378 tuple& operator=(const GTEST_5_TUPLE_(U)& t) { 00379 return CopyFrom(t); 00380 } 00381 00382 GTEST_DECLARE_TUPLE_AS_FRIEND_ 00383 00384 template <GTEST_5_TYPENAMES_(U)> 00385 tuple& CopyFrom(const GTEST_5_TUPLE_(U)& t) { 00386 f0_ = t.f0_; 00387 f1_ = t.f1_; 00388 f2_ = t.f2_; 00389 f3_ = t.f3_; 00390 f4_ = t.f4_; 00391 return *this; 00392 } 00393 00394 T0 f0_; 00395 T1 f1_; 00396 T2 f2_; 00397 T3 f3_; 00398 T4 f4_; 00399 }; 00400 00401 template <GTEST_6_TYPENAMES_(T)> 00402 class GTEST_6_TUPLE_(T) { 00403 public: 00404 template <int k> friend class gtest_internal::Get; 00405 00406 tuple() : f0_(), f1_(), f2_(), f3_(), f4_(), f5_() {} 00407 00408 explicit tuple(GTEST_BY_REF_(T0) f0, GTEST_BY_REF_(T1) f1, 00409 GTEST_BY_REF_(T2) f2, GTEST_BY_REF_(T3) f3, GTEST_BY_REF_(T4) f4, 00410 GTEST_BY_REF_(T5) f5) : f0_(f0), f1_(f1), f2_(f2), f3_(f3), f4_(f4), 00411 f5_(f5) {} 00412 00413 tuple(const tuple& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_), f3_(t.f3_), 00414 f4_(t.f4_), f5_(t.f5_) {} 00415 00416 template <GTEST_6_TYPENAMES_(U)> 00417 tuple(const GTEST_6_TUPLE_(U)& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_), 00418 f3_(t.f3_), f4_(t.f4_), f5_(t.f5_) {} 00419 00420 tuple& operator=(const tuple& t) { return CopyFrom(t); } 00421 00422 template <GTEST_6_TYPENAMES_(U)> 00423 tuple& operator=(const GTEST_6_TUPLE_(U)& t) { 00424 return CopyFrom(t); 00425 } 00426 00427 GTEST_DECLARE_TUPLE_AS_FRIEND_ 00428 00429 template <GTEST_6_TYPENAMES_(U)> 00430 tuple& CopyFrom(const GTEST_6_TUPLE_(U)& t) { 00431 f0_ = t.f0_; 00432 f1_ = t.f1_; 00433 f2_ = t.f2_; 00434 f3_ = t.f3_; 00435 f4_ = t.f4_; 00436 f5_ = t.f5_; 00437 return *this; 00438 } 00439 00440 T0 f0_; 00441 T1 f1_; 00442 T2 f2_; 00443 T3 f3_; 00444 T4 f4_; 00445 T5 f5_; 00446 }; 00447 00448 template <GTEST_7_TYPENAMES_(T)> 00449 class GTEST_7_TUPLE_(T) { 00450 public: 00451 template <int k> friend class gtest_internal::Get; 00452 00453 tuple() : f0_(), f1_(), f2_(), f3_(), f4_(), f5_(), f6_() {} 00454 00455 explicit tuple(GTEST_BY_REF_(T0) f0, GTEST_BY_REF_(T1) f1, 00456 GTEST_BY_REF_(T2) f2, GTEST_BY_REF_(T3) f3, GTEST_BY_REF_(T4) f4, 00457 GTEST_BY_REF_(T5) f5, GTEST_BY_REF_(T6) f6) : f0_(f0), f1_(f1), f2_(f2), 00458 f3_(f3), f4_(f4), f5_(f5), f6_(f6) {} 00459 00460 tuple(const tuple& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_), f3_(t.f3_), 00461 f4_(t.f4_), f5_(t.f5_), f6_(t.f6_) {} 00462 00463 template <GTEST_7_TYPENAMES_(U)> 00464 tuple(const GTEST_7_TUPLE_(U)& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_), 00465 f3_(t.f3_), f4_(t.f4_), f5_(t.f5_), f6_(t.f6_) {} 00466 00467 tuple& operator=(const tuple& t) { return CopyFrom(t); } 00468 00469 template <GTEST_7_TYPENAMES_(U)> 00470 tuple& operator=(const GTEST_7_TUPLE_(U)& t) { 00471 return CopyFrom(t); 00472 } 00473 00474 GTEST_DECLARE_TUPLE_AS_FRIEND_ 00475 00476 template <GTEST_7_TYPENAMES_(U)> 00477 tuple& CopyFrom(const GTEST_7_TUPLE_(U)& t) { 00478 f0_ = t.f0_; 00479 f1_ = t.f1_; 00480 f2_ = t.f2_; 00481 f3_ = t.f3_; 00482 f4_ = t.f4_; 00483 f5_ = t.f5_; 00484 f6_ = t.f6_; 00485 return *this; 00486 } 00487 00488 T0 f0_; 00489 T1 f1_; 00490 T2 f2_; 00491 T3 f3_; 00492 T4 f4_; 00493 T5 f5_; 00494 T6 f6_; 00495 }; 00496 00497 template <GTEST_8_TYPENAMES_(T)> 00498 class GTEST_8_TUPLE_(T) { 00499 public: 00500 template <int k> friend class gtest_internal::Get; 00501 00502 tuple() : f0_(), f1_(), f2_(), f3_(), f4_(), f5_(), f6_(), f7_() {} 00503 00504 explicit tuple(GTEST_BY_REF_(T0) f0, GTEST_BY_REF_(T1) f1, 00505 GTEST_BY_REF_(T2) f2, GTEST_BY_REF_(T3) f3, GTEST_BY_REF_(T4) f4, 00506 GTEST_BY_REF_(T5) f5, GTEST_BY_REF_(T6) f6, 00507 GTEST_BY_REF_(T7) f7) : f0_(f0), f1_(f1), f2_(f2), f3_(f3), f4_(f4), 00508 f5_(f5), f6_(f6), f7_(f7) {} 00509 00510 tuple(const tuple& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_), f3_(t.f3_), 00511 f4_(t.f4_), f5_(t.f5_), f6_(t.f6_), f7_(t.f7_) {} 00512 00513 template <GTEST_8_TYPENAMES_(U)> 00514 tuple(const GTEST_8_TUPLE_(U)& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_), 00515 f3_(t.f3_), f4_(t.f4_), f5_(t.f5_), f6_(t.f6_), f7_(t.f7_) {} 00516 00517 tuple& operator=(const tuple& t) { return CopyFrom(t); } 00518 00519 template <GTEST_8_TYPENAMES_(U)> 00520 tuple& operator=(const GTEST_8_TUPLE_(U)& t) { 00521 return CopyFrom(t); 00522 } 00523 00524 GTEST_DECLARE_TUPLE_AS_FRIEND_ 00525 00526 template <GTEST_8_TYPENAMES_(U)> 00527 tuple& CopyFrom(const GTEST_8_TUPLE_(U)& t) { 00528 f0_ = t.f0_; 00529 f1_ = t.f1_; 00530 f2_ = t.f2_; 00531 f3_ = t.f3_; 00532 f4_ = t.f4_; 00533 f5_ = t.f5_; 00534 f6_ = t.f6_; 00535 f7_ = t.f7_; 00536 return *this; 00537 } 00538 00539 T0 f0_; 00540 T1 f1_; 00541 T2 f2_; 00542 T3 f3_; 00543 T4 f4_; 00544 T5 f5_; 00545 T6 f6_; 00546 T7 f7_; 00547 }; 00548 00549 template <GTEST_9_TYPENAMES_(T)> 00550 class GTEST_9_TUPLE_(T) { 00551 public: 00552 template <int k> friend class gtest_internal::Get; 00553 00554 tuple() : f0_(), f1_(), f2_(), f3_(), f4_(), f5_(), f6_(), f7_(), f8_() {} 00555 00556 explicit tuple(GTEST_BY_REF_(T0) f0, GTEST_BY_REF_(T1) f1, 00557 GTEST_BY_REF_(T2) f2, GTEST_BY_REF_(T3) f3, GTEST_BY_REF_(T4) f4, 00558 GTEST_BY_REF_(T5) f5, GTEST_BY_REF_(T6) f6, GTEST_BY_REF_(T7) f7, 00559 GTEST_BY_REF_(T8) f8) : f0_(f0), f1_(f1), f2_(f2), f3_(f3), f4_(f4), 00560 f5_(f5), f6_(f6), f7_(f7), f8_(f8) {} 00561 00562 tuple(const tuple& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_), f3_(t.f3_), 00563 f4_(t.f4_), f5_(t.f5_), f6_(t.f6_), f7_(t.f7_), f8_(t.f8_) {} 00564 00565 template <GTEST_9_TYPENAMES_(U)> 00566 tuple(const GTEST_9_TUPLE_(U)& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_), 00567 f3_(t.f3_), f4_(t.f4_), f5_(t.f5_), f6_(t.f6_), f7_(t.f7_), f8_(t.f8_) {} 00568 00569 tuple& operator=(const tuple& t) { return CopyFrom(t); } 00570 00571 template <GTEST_9_TYPENAMES_(U)> 00572 tuple& operator=(const GTEST_9_TUPLE_(U)& t) { 00573 return CopyFrom(t); 00574 } 00575 00576 GTEST_DECLARE_TUPLE_AS_FRIEND_ 00577 00578 template <GTEST_9_TYPENAMES_(U)> 00579 tuple& CopyFrom(const GTEST_9_TUPLE_(U)& t) { 00580 f0_ = t.f0_; 00581 f1_ = t.f1_; 00582 f2_ = t.f2_; 00583 f3_ = t.f3_; 00584 f4_ = t.f4_; 00585 f5_ = t.f5_; 00586 f6_ = t.f6_; 00587 f7_ = t.f7_; 00588 f8_ = t.f8_; 00589 return *this; 00590 } 00591 00592 T0 f0_; 00593 T1 f1_; 00594 T2 f2_; 00595 T3 f3_; 00596 T4 f4_; 00597 T5 f5_; 00598 T6 f6_; 00599 T7 f7_; 00600 T8 f8_; 00601 }; 00602 00603 template <GTEST_10_TYPENAMES_(T)> 00604 class tuple { 00605 public: 00606 template <int k> friend class gtest_internal::Get; 00607 00608 tuple() : f0_(), f1_(), f2_(), f3_(), f4_(), f5_(), f6_(), f7_(), f8_(), 00609 f9_() {} 00610 00611 explicit tuple(GTEST_BY_REF_(T0) f0, GTEST_BY_REF_(T1) f1, 00612 GTEST_BY_REF_(T2) f2, GTEST_BY_REF_(T3) f3, GTEST_BY_REF_(T4) f4, 00613 GTEST_BY_REF_(T5) f5, GTEST_BY_REF_(T6) f6, GTEST_BY_REF_(T7) f7, 00614 GTEST_BY_REF_(T8) f8, GTEST_BY_REF_(T9) f9) : f0_(f0), f1_(f1), f2_(f2), 00615 f3_(f3), f4_(f4), f5_(f5), f6_(f6), f7_(f7), f8_(f8), f9_(f9) {} 00616 00617 tuple(const tuple& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_), f3_(t.f3_), 00618 f4_(t.f4_), f5_(t.f5_), f6_(t.f6_), f7_(t.f7_), f8_(t.f8_), f9_(t.f9_) {} 00619 00620 template <GTEST_10_TYPENAMES_(U)> 00621 tuple(const GTEST_10_TUPLE_(U)& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_), 00622 f3_(t.f3_), f4_(t.f4_), f5_(t.f5_), f6_(t.f6_), f7_(t.f7_), f8_(t.f8_), 00623 f9_(t.f9_) {} 00624 00625 tuple& operator=(const tuple& t) { return CopyFrom(t); } 00626 00627 template <GTEST_10_TYPENAMES_(U)> 00628 tuple& operator=(const GTEST_10_TUPLE_(U)& t) { 00629 return CopyFrom(t); 00630 } 00631 00632 GTEST_DECLARE_TUPLE_AS_FRIEND_ 00633 00634 template <GTEST_10_TYPENAMES_(U)> 00635 tuple& CopyFrom(const GTEST_10_TUPLE_(U)& t) { 00636 f0_ = t.f0_; 00637 f1_ = t.f1_; 00638 f2_ = t.f2_; 00639 f3_ = t.f3_; 00640 f4_ = t.f4_; 00641 f5_ = t.f5_; 00642 f6_ = t.f6_; 00643 f7_ = t.f7_; 00644 f8_ = t.f8_; 00645 f9_ = t.f9_; 00646 return *this; 00647 } 00648 00649 T0 f0_; 00650 T1 f1_; 00651 T2 f2_; 00652 T3 f3_; 00653 T4 f4_; 00654 T5 f5_; 00655 T6 f6_; 00656 T7 f7_; 00657 T8 f8_; 00658 T9 f9_; 00659 }; 00660 00661 // 6.1.3.2 Tuple creation functions. 00662 00663 // Known limitations: we don't support passing an 00664 // std::tr1::reference_wrapper<T> to make_tuple(). And we don't 00665 // implement tie(). 00666 00667 inline tuple<> make_tuple() { return tuple<>(); } 00668 00669 template <GTEST_1_TYPENAMES_(T)> 00670 inline GTEST_1_TUPLE_(T) make_tuple(const T0& f0) { 00671 return GTEST_1_TUPLE_(T)(f0); 00672 } 00673 00674 template <GTEST_2_TYPENAMES_(T)> 00675 inline GTEST_2_TUPLE_(T) make_tuple(const T0& f0, const T1& f1) { 00676 return GTEST_2_TUPLE_(T)(f0, f1); 00677 } 00678 00679 template <GTEST_3_TYPENAMES_(T)> 00680 inline GTEST_3_TUPLE_(T) make_tuple(const T0& f0, const T1& f1, const T2& f2) { 00681 return GTEST_3_TUPLE_(T)(f0, f1, f2); 00682 } 00683 00684 template <GTEST_4_TYPENAMES_(T)> 00685 inline GTEST_4_TUPLE_(T) make_tuple(const T0& f0, const T1& f1, const T2& f2, 00686 const T3& f3) { 00687 return GTEST_4_TUPLE_(T)(f0, f1, f2, f3); 00688 } 00689 00690 template <GTEST_5_TYPENAMES_(T)> 00691 inline GTEST_5_TUPLE_(T) make_tuple(const T0& f0, const T1& f1, const T2& f2, 00692 const T3& f3, const T4& f4) { 00693 return GTEST_5_TUPLE_(T)(f0, f1, f2, f3, f4); 00694 } 00695 00696 template <GTEST_6_TYPENAMES_(T)> 00697 inline GTEST_6_TUPLE_(T) make_tuple(const T0& f0, const T1& f1, const T2& f2, 00698 const T3& f3, const T4& f4, const T5& f5) { 00699 return GTEST_6_TUPLE_(T)(f0, f1, f2, f3, f4, f5); 00700 } 00701 00702 template <GTEST_7_TYPENAMES_(T)> 00703 inline GTEST_7_TUPLE_(T) make_tuple(const T0& f0, const T1& f1, const T2& f2, 00704 const T3& f3, const T4& f4, const T5& f5, const T6& f6) { 00705 return GTEST_7_TUPLE_(T)(f0, f1, f2, f3, f4, f5, f6); 00706 } 00707 00708 template <GTEST_8_TYPENAMES_(T)> 00709 inline GTEST_8_TUPLE_(T) make_tuple(const T0& f0, const T1& f1, const T2& f2, 00710 const T3& f3, const T4& f4, const T5& f5, const T6& f6, const T7& f7) { 00711 return GTEST_8_TUPLE_(T)(f0, f1, f2, f3, f4, f5, f6, f7); 00712 } 00713 00714 template <GTEST_9_TYPENAMES_(T)> 00715 inline GTEST_9_TUPLE_(T) make_tuple(const T0& f0, const T1& f1, const T2& f2, 00716 const T3& f3, const T4& f4, const T5& f5, const T6& f6, const T7& f7, 00717 const T8& f8) { 00718 return GTEST_9_TUPLE_(T)(f0, f1, f2, f3, f4, f5, f6, f7, f8); 00719 } 00720 00721 template <GTEST_10_TYPENAMES_(T)> 00722 inline GTEST_10_TUPLE_(T) make_tuple(const T0& f0, const T1& f1, const T2& f2, 00723 const T3& f3, const T4& f4, const T5& f5, const T6& f6, const T7& f7, 00724 const T8& f8, const T9& f9) { 00725 return GTEST_10_TUPLE_(T)(f0, f1, f2, f3, f4, f5, f6, f7, f8, f9); 00726 } 00727 00728 // 6.1.3.3 Tuple helper classes. 00729 00730 template <typename Tuple> struct tuple_size; 00731 00732 template <GTEST_0_TYPENAMES_(T)> 00733 struct tuple_size<GTEST_0_TUPLE_(T) > { 00734 static const int value = 0; 00735 }; 00736 00737 template <GTEST_1_TYPENAMES_(T)> 00738 struct tuple_size<GTEST_1_TUPLE_(T) > { 00739 static const int value = 1; 00740 }; 00741 00742 template <GTEST_2_TYPENAMES_(T)> 00743 struct tuple_size<GTEST_2_TUPLE_(T) > { 00744 static const int value = 2; 00745 }; 00746 00747 template <GTEST_3_TYPENAMES_(T)> 00748 struct tuple_size<GTEST_3_TUPLE_(T) > { 00749 static const int value = 3; 00750 }; 00751 00752 template <GTEST_4_TYPENAMES_(T)> 00753 struct tuple_size<GTEST_4_TUPLE_(T) > { 00754 static const int value = 4; 00755 }; 00756 00757 template <GTEST_5_TYPENAMES_(T)> 00758 struct tuple_size<GTEST_5_TUPLE_(T) > { 00759 static const int value = 5; 00760 }; 00761 00762 template <GTEST_6_TYPENAMES_(T)> 00763 struct tuple_size<GTEST_6_TUPLE_(T) > { 00764 static const int value = 6; 00765 }; 00766 00767 template <GTEST_7_TYPENAMES_(T)> 00768 struct tuple_size<GTEST_7_TUPLE_(T) > { 00769 static const int value = 7; 00770 }; 00771 00772 template <GTEST_8_TYPENAMES_(T)> 00773 struct tuple_size<GTEST_8_TUPLE_(T) > { 00774 static const int value = 8; 00775 }; 00776 00777 template <GTEST_9_TYPENAMES_(T)> 00778 struct tuple_size<GTEST_9_TUPLE_(T) > { 00779 static const int value = 9; 00780 }; 00781 00782 template <GTEST_10_TYPENAMES_(T)> 00783 struct tuple_size<GTEST_10_TUPLE_(T) > { 00784 static const int value = 10; 00785 }; 00786 00787 template <int k, class Tuple> 00788 struct tuple_element { 00789 typedef typename gtest_internal::TupleElement< 00790 k < (tuple_size<Tuple>::value), k, Tuple>::type type; 00791 }; 00792 00793 #define GTEST_TUPLE_ELEMENT_(k, Tuple) typename tuple_element<k, Tuple >::type 00794 00795 // 6.1.3.4 Element access. 00796 00797 namespace gtest_internal { 00798 00799 template <> 00800 class Get<0> { 00801 public: 00802 template <class Tuple> 00803 static GTEST_ADD_REF_(GTEST_TUPLE_ELEMENT_(0, Tuple)) 00804 Field(Tuple& t) { return t.f0_; } // NOLINT 00805 00806 template <class Tuple> 00807 static GTEST_BY_REF_(GTEST_TUPLE_ELEMENT_(0, Tuple)) 00808 ConstField(const Tuple& t) { return t.f0_; } 00809 }; 00810 00811 template <> 00812 class Get<1> { 00813 public: 00814 template <class Tuple> 00815 static GTEST_ADD_REF_(GTEST_TUPLE_ELEMENT_(1, Tuple)) 00816 Field(Tuple& t) { return t.f1_; } // NOLINT 00817 00818 template <class Tuple> 00819 static GTEST_BY_REF_(GTEST_TUPLE_ELEMENT_(1, Tuple)) 00820 ConstField(const Tuple& t) { return t.f1_; } 00821 }; 00822 00823 template <> 00824 class Get<2> { 00825 public: 00826 template <class Tuple> 00827 static GTEST_ADD_REF_(GTEST_TUPLE_ELEMENT_(2, Tuple)) 00828 Field(Tuple& t) { return t.f2_; } // NOLINT 00829 00830 template <class Tuple> 00831 static GTEST_BY_REF_(GTEST_TUPLE_ELEMENT_(2, Tuple)) 00832 ConstField(const Tuple& t) { return t.f2_; } 00833 }; 00834 00835 template <> 00836 class Get<3> { 00837 public: 00838 template <class Tuple> 00839 static GTEST_ADD_REF_(GTEST_TUPLE_ELEMENT_(3, Tuple)) 00840 Field(Tuple& t) { return t.f3_; } // NOLINT 00841 00842 template <class Tuple> 00843 static GTEST_BY_REF_(GTEST_TUPLE_ELEMENT_(3, Tuple)) 00844 ConstField(const Tuple& t) { return t.f3_; } 00845 }; 00846 00847 template <> 00848 class Get<4> { 00849 public: 00850 template <class Tuple> 00851 static GTEST_ADD_REF_(GTEST_TUPLE_ELEMENT_(4, Tuple)) 00852 Field(Tuple& t) { return t.f4_; } // NOLINT 00853 00854 template <class Tuple> 00855 static GTEST_BY_REF_(GTEST_TUPLE_ELEMENT_(4, Tuple)) 00856 ConstField(const Tuple& t) { return t.f4_; } 00857 }; 00858 00859 template <> 00860 class Get<5> { 00861 public: 00862 template <class Tuple> 00863 static GTEST_ADD_REF_(GTEST_TUPLE_ELEMENT_(5, Tuple)) 00864 Field(Tuple& t) { return t.f5_; } // NOLINT 00865 00866 template <class Tuple> 00867 static GTEST_BY_REF_(GTEST_TUPLE_ELEMENT_(5, Tuple)) 00868 ConstField(const Tuple& t) { return t.f5_; } 00869 }; 00870 00871 template <> 00872 class Get<6> { 00873 public: 00874 template <class Tuple> 00875 static GTEST_ADD_REF_(GTEST_TUPLE_ELEMENT_(6, Tuple)) 00876 Field(Tuple& t) { return t.f6_; } // NOLINT 00877 00878 template <class Tuple> 00879 static GTEST_BY_REF_(GTEST_TUPLE_ELEMENT_(6, Tuple)) 00880 ConstField(const Tuple& t) { return t.f6_; } 00881 }; 00882 00883 template <> 00884 class Get<7> { 00885 public: 00886 template <class Tuple> 00887 static GTEST_ADD_REF_(GTEST_TUPLE_ELEMENT_(7, Tuple)) 00888 Field(Tuple& t) { return t.f7_; } // NOLINT 00889 00890 template <class Tuple> 00891 static GTEST_BY_REF_(GTEST_TUPLE_ELEMENT_(7, Tuple)) 00892 ConstField(const Tuple& t) { return t.f7_; } 00893 }; 00894 00895 template <> 00896 class Get<8> { 00897 public: 00898 template <class Tuple> 00899 static GTEST_ADD_REF_(GTEST_TUPLE_ELEMENT_(8, Tuple)) 00900 Field(Tuple& t) { return t.f8_; } // NOLINT 00901 00902 template <class Tuple> 00903 static GTEST_BY_REF_(GTEST_TUPLE_ELEMENT_(8, Tuple)) 00904 ConstField(const Tuple& t) { return t.f8_; } 00905 }; 00906 00907 template <> 00908 class Get<9> { 00909 public: 00910 template <class Tuple> 00911 static GTEST_ADD_REF_(GTEST_TUPLE_ELEMENT_(9, Tuple)) 00912 Field(Tuple& t) { return t.f9_; } // NOLINT 00913 00914 template <class Tuple> 00915 static GTEST_BY_REF_(GTEST_TUPLE_ELEMENT_(9, Tuple)) 00916 ConstField(const Tuple& t) { return t.f9_; } 00917 }; 00918 00919 } // namespace gtest_internal 00920 00921 template <int k, GTEST_10_TYPENAMES_(T)> 00922 GTEST_ADD_REF_(GTEST_TUPLE_ELEMENT_(k, GTEST_10_TUPLE_(T))) 00923 get(GTEST_10_TUPLE_(T)& t) { 00924 return gtest_internal::Get<k>::Field(t); 00925 } 00926 00927 template <int k, GTEST_10_TYPENAMES_(T)> 00928 GTEST_BY_REF_(GTEST_TUPLE_ELEMENT_(k, GTEST_10_TUPLE_(T))) 00929 get(const GTEST_10_TUPLE_(T)& t) { 00930 return gtest_internal::Get<k>::ConstField(t); 00931 } 00932 00933 // 6.1.3.5 Relational operators 00934 00935 // We only implement == and !=, as we don't have a need for the rest yet. 00936 00937 namespace gtest_internal { 00938 00939 // SameSizeTuplePrefixComparator<k, k>::Eq(t1, t2) returns true if the 00940 // first k fields of t1 equals the first k fields of t2. 00941 // SameSizeTuplePrefixComparator(k1, k2) would be a compiler error if 00942 // k1 != k2. 00943 template <int kSize1, int kSize2> 00944 struct SameSizeTuplePrefixComparator; 00945 00946 template <> 00947 struct SameSizeTuplePrefixComparator<0, 0> { 00948 template <class Tuple1, class Tuple2> 00949 static bool Eq(const Tuple1& /* t1 */, const Tuple2& /* t2 */) { 00950 return true; 00951 } 00952 }; 00953 00954 template <int k> 00955 struct SameSizeTuplePrefixComparator<k, k> { 00956 template <class Tuple1, class Tuple2> 00957 static bool Eq(const Tuple1& t1, const Tuple2& t2) { 00958 return SameSizeTuplePrefixComparator<k - 1, k - 1>::Eq(t1, t2) && 00959 ::std::tr1::get<k - 1>(t1) == ::std::tr1::get<k - 1>(t2); 00960 } 00961 }; 00962 00963 } // namespace gtest_internal 00964 00965 template <GTEST_10_TYPENAMES_(T), GTEST_10_TYPENAMES_(U)> 00966 inline bool operator==(const GTEST_10_TUPLE_(T)& t, 00967 const GTEST_10_TUPLE_(U)& u) { 00968 return gtest_internal::SameSizeTuplePrefixComparator< 00969 tuple_size<GTEST_10_TUPLE_(T) >::value, 00970 tuple_size<GTEST_10_TUPLE_(U) >::value>::Eq(t, u); 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) { return !(t == u); } 00976 00977 // 6.1.4 Pairs. 00978 // Unimplemented. 00979 00980 } // namespace tr1 00981 } // namespace std 00982 00983 #undef GTEST_0_TUPLE_ 00984 #undef GTEST_1_TUPLE_ 00985 #undef GTEST_2_TUPLE_ 00986 #undef GTEST_3_TUPLE_ 00987 #undef GTEST_4_TUPLE_ 00988 #undef GTEST_5_TUPLE_ 00989 #undef GTEST_6_TUPLE_ 00990 #undef GTEST_7_TUPLE_ 00991 #undef GTEST_8_TUPLE_ 00992 #undef GTEST_9_TUPLE_ 00993 #undef GTEST_10_TUPLE_ 00994 00995 #undef GTEST_0_TYPENAMES_ 00996 #undef GTEST_1_TYPENAMES_ 00997 #undef GTEST_2_TYPENAMES_ 00998 #undef GTEST_3_TYPENAMES_ 00999 #undef GTEST_4_TYPENAMES_ 01000 #undef GTEST_5_TYPENAMES_ 01001 #undef GTEST_6_TYPENAMES_ 01002 #undef GTEST_7_TYPENAMES_ 01003 #undef GTEST_8_TYPENAMES_ 01004 #undef GTEST_9_TYPENAMES_ 01005 #undef GTEST_10_TYPENAMES_ 01006 01007 #undef GTEST_DECLARE_TUPLE_AS_FRIEND_ 01008 #undef GTEST_BY_REF_ 01009 #undef GTEST_ADD_REF_ 01010 #undef GTEST_TUPLE_ELEMENT_ 01011 01012 #endif // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_TUPLE_H_