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


pcl
Author(s): Open Perception
autogenerated on Wed Aug 26 2015 15:24:39