Merge pull request #1263 from abidrahmank:pyCLAHE_24
[profile/ivi/opencv.git] / modules / ts / include / opencv2 / ts / ts_gtest.h
1 // Copyright 2005, Google Inc.
2 // All rights reserved.
3 //
4 // Redistribution and use in source and binary forms, with or without
5 // modification, are permitted provided that the following conditions are
6 // met:
7 //
8 //     * Redistributions of source code must retain the above copyright
9 // notice, this list of conditions and the following disclaimer.
10 //     * Redistributions in binary form must reproduce the above
11 // copyright notice, this list of conditions and the following disclaimer
12 // in the documentation and/or other materials provided with the
13 // distribution.
14 //     * Neither the name of Google Inc. nor the names of its
15 // contributors may be used to endorse or promote products derived from
16 // this software without specific prior written permission.
17 //
18 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 //
30 // Author: wan@google.com (Zhanyong Wan)
31 //
32 // The Google C++ Testing Framework (Google Test)
33 //
34 // This header file defines the public API for Google Test.  It should be
35 // included by any test program that uses Google Test.
36 //
37 // IMPORTANT NOTE: Due to limitation of the C++ language, we have to
38 // leave some internal implementation details in this header file.
39 // They are clearly marked by comments like this:
40 //
41 //   // INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
42 //
43 // Such code is NOT meant to be used by a user directly, and is subject
44 // to CHANGE WITHOUT NOTICE.  Therefore DO NOT DEPEND ON IT in a user
45 // program!
46 //
47 // Acknowledgment: Google Test borrowed the idea of automatic test
48 // registration from Barthelemy Dagenais' (barthelemy@prologique.com)
49 // easyUnit framework.
50
51 #ifndef GTEST_INCLUDE_GTEST_GTEST_H_
52 #define GTEST_INCLUDE_GTEST_GTEST_H_
53
54 #include <limits>
55 #include <ostream>
56 #include <vector>
57
58 // Copyright 2005, Google Inc.
59 // All rights reserved.
60 //
61 // Redistribution and use in source and binary forms, with or without
62 // modification, are permitted provided that the following conditions are
63 // met:
64 //
65 //     * Redistributions of source code must retain the above copyright
66 // notice, this list of conditions and the following disclaimer.
67 //     * Redistributions in binary form must reproduce the above
68 // copyright notice, this list of conditions and the following disclaimer
69 // in the documentation and/or other materials provided with the
70 // distribution.
71 //     * Neither the name of Google Inc. nor the names of its
72 // contributors may be used to endorse or promote products derived from
73 // this software without specific prior written permission.
74 //
75 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
76 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
77 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
78 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
79 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
80 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
81 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
82 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
83 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
84 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
85 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
86 //
87 // Authors: wan@google.com (Zhanyong Wan), eefacm@gmail.com (Sean Mcafee)
88 //
89 // The Google C++ Testing Framework (Google Test)
90 //
91 // This header file declares functions and macros used internally by
92 // Google Test.  They are subject to change without notice.
93
94 #ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_INTERNAL_H_
95 #define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_INTERNAL_H_
96
97 // Copyright 2005, Google Inc.
98 // All rights reserved.
99 //
100 // Redistribution and use in source and binary forms, with or without
101 // modification, are permitted provided that the following conditions are
102 // met:
103 //
104 //     * Redistributions of source code must retain the above copyright
105 // notice, this list of conditions and the following disclaimer.
106 //     * Redistributions in binary form must reproduce the above
107 // copyright notice, this list of conditions and the following disclaimer
108 // in the documentation and/or other materials provided with the
109 // distribution.
110 //     * Neither the name of Google Inc. nor the names of its
111 // contributors may be used to endorse or promote products derived from
112 // this software without specific prior written permission.
113 //
114 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
115 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
116 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
117 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
118 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
119 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
120 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
121 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
122 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
123 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
124 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
125 //
126 // Authors: wan@google.com (Zhanyong Wan)
127 //
128 // Low-level types and utilities for porting Google Test to various
129 // platforms.  They are subject to change without notice.  DO NOT USE
130 // THEM IN USER CODE.
131 //
132 // This file is fundamental to Google Test.  All other Google Test source
133 // files are expected to #include this.  Therefore, it cannot #include
134 // any other Google Test header.
135
136 #ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PORT_H_
137 #define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PORT_H_
138
139 // The user can define the following macros in the build script to
140 // control Google Test's behavior.  If the user doesn't define a macro
141 // in this list, Google Test will define it.
142 //
143 //   GTEST_HAS_CLONE          - Define it to 1/0 to indicate that clone(2)
144 //                              is/isn't available.
145 //   GTEST_HAS_EXCEPTIONS     - Define it to 1/0 to indicate that exceptions
146 //                              are enabled.
147 //   GTEST_HAS_GLOBAL_STRING  - Define it to 1/0 to indicate that ::string
148 //                              is/isn't available (some systems define
149 //                              ::string, which is different to std::string).
150 //   GTEST_HAS_GLOBAL_WSTRING - Define it to 1/0 to indicate that ::string
151 //                              is/isn't available (some systems define
152 //                              ::wstring, which is different to std::wstring).
153 //   GTEST_HAS_POSIX_RE       - Define it to 1/0 to indicate that POSIX regular
154 //                              expressions are/aren't available.
155 //   GTEST_HAS_PTHREAD        - Define it to 1/0 to indicate that <pthread.h>
156 //                              is/isn't available.
157 //   GTEST_HAS_RTTI           - Define it to 1/0 to indicate that RTTI is/isn't
158 //                              enabled.
159 //   GTEST_HAS_STD_WSTRING    - Define it to 1/0 to indicate that
160 //                              std::wstring does/doesn't work (Google Test can
161 //                              be used where std::wstring is unavailable).
162 //   GTEST_HAS_TR1_TUPLE      - Define it to 1/0 to indicate tr1::tuple
163 //                              is/isn't available.
164 //   GTEST_HAS_SEH            - Define it to 1/0 to indicate whether the
165 //                              compiler supports Microsoft's "Structured
166 //                              Exception Handling".
167 //   GTEST_HAS_STREAM_REDIRECTION
168 //                            - Define it to 1/0 to indicate whether the
169 //                              platform supports I/O stream redirection using
170 //                              dup() and dup2().
171 //   GTEST_USE_OWN_TR1_TUPLE  - Define it to 1/0 to indicate whether Google
172 //                              Test's own tr1 tuple implementation should be
173 //                              used.  Unused when the user sets
174 //                              GTEST_HAS_TR1_TUPLE to 0.
175 //   GTEST_LANG_CXX11         - Define it to 1/0 to indicate that Google Test
176 //                              is building in C++11/C++98 mode.
177 //   GTEST_LINKED_AS_SHARED_LIBRARY
178 //                            - Define to 1 when compiling tests that use
179 //                              Google Test as a shared library (known as
180 //                              DLL on Windows).
181 //   GTEST_CREATE_SHARED_LIBRARY
182 //                            - Define to 1 when compiling Google Test itself
183 //                              as a shared library.
184
185 // This header defines the following utilities:
186 //
187 // Macros indicating the current platform (defined to 1 if compiled on
188 // the given platform; otherwise undefined):
189 //   GTEST_OS_AIX      - IBM AIX
190 //   GTEST_OS_CYGWIN   - Cygwin
191 //   GTEST_OS_HPUX     - HP-UX
192 //   GTEST_OS_LINUX    - Linux
193 //     GTEST_OS_LINUX_ANDROID - Google Android
194 //   GTEST_OS_MAC      - Mac OS X
195 //     GTEST_OS_IOS    - iOS
196 //       GTEST_OS_IOS_SIMULATOR - iOS simulator
197 //   GTEST_OS_NACL     - Google Native Client (NaCl)
198 //   GTEST_OS_OPENBSD  - OpenBSD
199 //   GTEST_OS_QNX      - QNX
200 //   GTEST_OS_SOLARIS  - Sun Solaris
201 //   GTEST_OS_SYMBIAN  - Symbian
202 //   GTEST_OS_WINDOWS  - Windows (Desktop, MinGW, or Mobile)
203 //     GTEST_OS_WINDOWS_DESKTOP  - Windows Desktop
204 //     GTEST_OS_WINDOWS_MINGW    - MinGW
205 //     GTEST_OS_WINDOWS_MOBILE   - Windows Mobile
206 //   GTEST_OS_ZOS      - z/OS
207 //
208 // Among the platforms, Cygwin, Linux, Max OS X, and Windows have the
209 // most stable support.  Since core members of the Google Test project
210 // don't have access to other platforms, support for them may be less
211 // stable.  If you notice any problems on your platform, please notify
212 // googletestframework@googlegroups.com (patches for fixing them are
213 // even more welcome!).
214 //
215 // Note that it is possible that none of the GTEST_OS_* macros are defined.
216 //
217 // Macros indicating available Google Test features (defined to 1 if
218 // the corresponding feature is supported; otherwise undefined):
219 //   GTEST_HAS_COMBINE      - the Combine() function (for value-parameterized
220 //                            tests)
221 //   GTEST_HAS_DEATH_TEST   - death tests
222 //   GTEST_HAS_PARAM_TEST   - value-parameterized tests
223 //   GTEST_HAS_TYPED_TEST   - typed tests
224 //   GTEST_HAS_TYPED_TEST_P - type-parameterized tests
225 //   GTEST_USES_POSIX_RE    - enhanced POSIX regex is used. Do not confuse with
226 //                            GTEST_HAS_POSIX_RE (see above) which users can
227 //                            define themselves.
228 //   GTEST_USES_SIMPLE_RE   - our own simple regex is used;
229 //                            the above two are mutually exclusive.
230 //   GTEST_CAN_COMPARE_NULL - accepts untyped NULL in EXPECT_EQ().
231 //
232 // Macros for basic C++ coding:
233 //   GTEST_AMBIGUOUS_ELSE_BLOCKER_ - for disabling a gcc warning.
234 //   GTEST_ATTRIBUTE_UNUSED_  - declares that a class' instances or a
235 //                              variable don't have to be used.
236 //   GTEST_DISALLOW_ASSIGN_   - disables operator=.
237 //   GTEST_DISALLOW_COPY_AND_ASSIGN_ - disables copy ctor and operator=.
238 //   GTEST_MUST_USE_RESULT_   - declares that a function's result must be used.
239 //
240 // Synchronization:
241 //   Mutex, MutexLock, ThreadLocal, GetThreadCount()
242 //                  - synchronization primitives.
243 //   GTEST_IS_THREADSAFE - defined to 1 to indicate that the above
244 //                         synchronization primitives have real implementations
245 //                         and Google Test is thread-safe; or 0 otherwise.
246 //
247 // Template meta programming:
248 //   is_pointer     - as in TR1; needed on Symbian and IBM XL C/C++ only.
249 //   IteratorTraits - partial implementation of std::iterator_traits, which
250 //                    is not available in libCstd when compiled with Sun C++.
251 //
252 // Smart pointers:
253 //   scoped_ptr     - as in TR2.
254 //
255 // Regular expressions:
256 //   RE             - a simple regular expression class using the POSIX
257 //                    Extended Regular Expression syntax on UNIX-like
258 //                    platforms, or a reduced regular exception syntax on
259 //                    other platforms, including Windows.
260 //
261 // Logging:
262 //   GTEST_LOG_()   - logs messages at the specified severity level.
263 //   LogToStderr()  - directs all log messages to stderr.
264 //   FlushInfoLog() - flushes informational log messages.
265 //
266 // Stdout and stderr capturing:
267 //   CaptureStdout()     - starts capturing stdout.
268 //   GetCapturedStdout() - stops capturing stdout and returns the captured
269 //                         string.
270 //   CaptureStderr()     - starts capturing stderr.
271 //   GetCapturedStderr() - stops capturing stderr and returns the captured
272 //                         string.
273 //
274 // Integer types:
275 //   TypeWithSize   - maps an integer to a int type.
276 //   Int32, UInt32, Int64, UInt64, TimeInMillis
277 //                  - integers of known sizes.
278 //   BiggestInt     - the biggest signed integer type.
279 //
280 // Command-line utilities:
281 //   GTEST_FLAG()       - references a flag.
282 //   GTEST_DECLARE_*()  - declares a flag.
283 //   GTEST_DEFINE_*()   - defines a flag.
284 //   GetInjectableArgvs() - returns the command line as a vector of strings.
285 //
286 // Environment variable utilities:
287 //   GetEnv()             - gets the value of an environment variable.
288 //   BoolFromGTestEnv()   - parses a bool environment variable.
289 //   Int32FromGTestEnv()  - parses an Int32 environment variable.
290 //   StringFromGTestEnv() - parses a string environment variable.
291
292 #include <ctype.h>   // for isspace, etc
293 #include <stddef.h>  // for ptrdiff_t
294 #include <stdlib.h>
295 #include <stdio.h>
296 #include <string.h>
297 #ifndef _WIN32_WCE
298 # include <sys/types.h>
299 # include <sys/stat.h>
300 #endif  // !_WIN32_WCE
301
302 #if defined __APPLE__
303 # include <AvailabilityMacros.h>
304 # include <TargetConditionals.h>
305 #endif
306
307 #include <iostream>  // NOLINT
308 #include <sstream>  // NOLINT
309 #include <string>  // NOLINT
310
311 #define GTEST_DEV_EMAIL_ "googletestframework@@googlegroups.com"
312 #define GTEST_FLAG_PREFIX_ "gtest_"
313 #define GTEST_FLAG_PREFIX_DASH_ "gtest-"
314 #define GTEST_FLAG_PREFIX_UPPER_ "GTEST_"
315 #define GTEST_NAME_ "Google Test"
316 #define GTEST_PROJECT_URL_ "http://code.google.com/p/googletest/"
317
318 // Determines the version of gcc that is used to compile this.
319 #ifdef __GNUC__
320 // 40302 means version 4.3.2.
321 # define GTEST_GCC_VER_ \
322     (__GNUC__*10000 + __GNUC_MINOR__*100 + __GNUC_PATCHLEVEL__)
323 #endif  // __GNUC__
324
325 // Determines the platform on which Google Test is compiled.
326 #define GTEST_OS_CYGWIN 0
327 #define GTEST_OS_SYMBIAN 0
328 #define GTEST_OS_WINDOWS 0
329 #define GTEST_OS_WINDOWS_MOBILE 0
330 #define GTEST_OS_WINDOWS_MINGW 0
331 #define GTEST_OS_WINDOWS_DESKTOP 0
332 #define GTEST_OS_MAC 0
333 #define GTEST_OS_LINUX 0
334 #define GTEST_OS_LINUX_ANDROID 0
335 #define GTEST_OS_ZOS 0
336 #define GTEST_OS_SOLARIS 0
337 #define GTEST_OS_AIX 0
338 #define GTEST_OS_HPUX 0
339 #define GTEST_OS_NACL 0
340 #define GTEST_OS_OPENBSD 0
341 #define GTEST_OS_QNX 0
342 #define GTEST_OS_IOS 0
343 #define GTEST_OS_IOS_SIMULATOR 0
344
345 #ifdef __CYGWIN__
346 # undef GTEST_OS_CYGWIN
347 # define GTEST_OS_CYGWIN 1
348 #elif defined __SYMBIAN32__
349 # undef GTEST_OS_SYMBIAN
350 # define GTEST_OS_SYMBIAN 1
351 #elif defined _WIN32
352 # undef GTEST_OS_WINDOWS
353 # define GTEST_OS_WINDOWS 1
354 # ifdef _WIN32_WCE
355 #  undef GTEST_OS_WINDOWS_MOBILE
356 #  define GTEST_OS_WINDOWS_MOBILE 1
357 # elif defined(__MINGW__) || defined(__MINGW32__)
358 #  undef GTEST_OS_WINDOWS_MINGW
359 #  define GTEST_OS_WINDOWS_MINGW 1
360 # else
361 #  undef GTEST_OS_WINDOWS_DESKTOP
362 #  define GTEST_OS_WINDOWS_DESKTOP 1
363 # endif  // _WIN32_WCE
364 #elif defined __APPLE__
365 # undef GTEST_OS_MAC
366 # define GTEST_OS_MAC 1
367 # if TARGET_OS_IPHONE
368 #  undef GTEST_OS_IOS
369 #  define GTEST_OS_IOS 1
370 #  if TARGET_IPHONE_SIMULATOR
371 #   undef GTEST_OS_IOS_SIMULATOR
372 #   define GTEST_OS_IOS_SIMULATOR 1
373 #  endif
374 # endif
375 #elif defined __linux__
376 # undef GTEST_OS_LINUX
377 # define GTEST_OS_LINUX 1
378 # if defined __ANDROID__
379 #  undef GTEST_OS_LINUX_ANDROID
380 #  define GTEST_OS_LINUX_ANDROID 1
381 # endif
382 #elif defined __MVS__
383 # undef GTEST_OS_ZOS
384 # define GTEST_OS_ZOS 1
385 #elif defined(__sun) && defined(__SVR4)
386 # undef GTEST_OS_SOLARIS
387 # define GTEST_OS_SOLARIS 1
388 #elif defined(_AIX)
389 # undef GTEST_OS_AIX
390 # define GTEST_OS_AIX 1
391 #elif defined(__hpux)
392 # undef GTEST_OS_HPUX
393 # define GTEST_OS_HPUX 1
394 #elif defined __native_client__
395 # undef GTEST_OS_NACL
396 # define GTEST_OS_NACL 1
397 #elif defined __OpenBSD__
398 # undef GTEST_OS_OPENBSD
399 # define GTEST_OS_OPENBSD 1
400 #elif defined __QNX__
401 # undef GTEST_OS_QNX
402 # define GTEST_OS_QNX 1
403 #endif  // __CYGWIN__
404
405 #ifndef GTEST_LANG_CXX11
406 // gcc and clang define __GXX_EXPERIMENTAL_CXX0X__ when
407 // -std={c,gnu}++{0x,11} is passed.  The C++11 standard specifies a
408 // value for __cplusplus, and recent versions of clang, gcc, and
409 // probably other compilers set that too in C++11 mode.
410 # if defined __GXX_EXPERIMENTAL_CXX0X__ || __cplusplus >= 201103L
411 // Compiling in at least C++11 mode.
412 #  define GTEST_LANG_CXX11 1
413 # else
414 #  define GTEST_LANG_CXX11 0
415 # endif
416 #endif
417
418 // Brings in definitions for functions used in the testing::internal::posix
419 // namespace (read, write, close, chdir, isatty, stat). We do not currently
420 // use them on Windows Mobile.
421 #if !GTEST_OS_WINDOWS
422 // This assumes that non-Windows OSes provide unistd.h. For OSes where this
423 // is not the case, we need to include headers that provide the functions
424 // mentioned above.
425 # include <unistd.h>
426 # include <strings.h>
427 #elif !GTEST_OS_WINDOWS_MOBILE
428 # include <direct.h>
429 # include <io.h>
430 #endif
431
432 #if GTEST_OS_LINUX_ANDROID
433 // Used to define __ANDROID_API__ matching the target NDK API level.
434 #  include <android/api-level.h>  // NOLINT
435 #endif
436
437 // Defines this to true iff Google Test can use POSIX regular expressions.
438 #ifndef GTEST_HAS_POSIX_RE
439 # if GTEST_OS_LINUX_ANDROID
440 // On Android, <regex.h> is only available starting with Froyo.
441 #  define GTEST_HAS_POSIX_RE (__ANDROID_API__ >= 8)
442 # else
443 # define GTEST_HAS_POSIX_RE (!GTEST_OS_WINDOWS)
444 #endif
445 #endif
446
447 #if GTEST_HAS_POSIX_RE
448
449 // On some platforms, <regex.h> needs someone to define size_t, and
450 // won't compile otherwise.  We can #include it here as we already
451 // included <stdlib.h>, which is guaranteed to define size_t through
452 // <stddef.h>.
453 # include <regex.h>  // NOLINT
454
455 # define GTEST_USES_POSIX_RE 1
456 # define GTEST_USES_SIMPLE_RE 0
457
458 #elif GTEST_OS_WINDOWS
459
460 // <regex.h> is not available on Windows.  Use our own simple regex
461 // implementation instead.
462 # define GTEST_USES_SIMPLE_RE 1
463 # define GTEST_USES_POSIX_RE  0
464
465 #else
466
467 // <regex.h> may not be available on this platform.  Use our own
468 // simple regex implementation instead.
469 # define GTEST_USES_SIMPLE_RE 1
470 # define GTEST_USES_POSIX_RE  0
471
472 #endif  // GTEST_HAS_POSIX_RE
473
474 #ifndef GTEST_HAS_EXCEPTIONS
475 // The user didn't tell us whether exceptions are enabled, so we need
476 // to figure it out.
477 # if defined(_MSC_VER) || defined(__BORLANDC__)
478 // MSVC's and C++Builder's implementations of the STL use the _HAS_EXCEPTIONS
479 // macro to enable exceptions, so we'll do the same.
480 // Assumes that exceptions are enabled by default.
481 #  ifndef _HAS_EXCEPTIONS
482 #   define _HAS_EXCEPTIONS 1
483 #  endif  // _HAS_EXCEPTIONS
484 #  define GTEST_HAS_EXCEPTIONS _HAS_EXCEPTIONS
485 # elif defined(__GNUC__) && __EXCEPTIONS
486 // gcc defines __EXCEPTIONS to 1 iff exceptions are enabled.
487 #  define GTEST_HAS_EXCEPTIONS 1
488 # elif defined(__SUNPRO_CC)
489 // Sun Pro CC supports exceptions.  However, there is no compile-time way of
490 // detecting whether they are enabled or not.  Therefore, we assume that
491 // they are enabled unless the user tells us otherwise.
492 #  define GTEST_HAS_EXCEPTIONS 1
493 # elif defined(__IBMCPP__) && __EXCEPTIONS
494 // xlC defines __EXCEPTIONS to 1 iff exceptions are enabled.
495 #  define GTEST_HAS_EXCEPTIONS 1
496 # elif defined(__HP_aCC)
497 // Exception handling is in effect by default in HP aCC compiler. It has to
498 // be turned of by +noeh compiler option if desired.
499 #  define GTEST_HAS_EXCEPTIONS 1
500 # else
501 // For other compilers, we assume exceptions are disabled to be
502 // conservative.
503 #  define GTEST_HAS_EXCEPTIONS 0
504 # endif  // defined(_MSC_VER) || defined(__BORLANDC__)
505 #endif  // GTEST_HAS_EXCEPTIONS
506
507 #if !defined(GTEST_HAS_STD_STRING)
508 // Even though we don't use this macro any longer, we keep it in case
509 // some clients still depend on it.
510 # define GTEST_HAS_STD_STRING 1
511 #elif !GTEST_HAS_STD_STRING
512 // The user told us that ::std::string isn't available.
513 # error "Google Test cannot be used where ::std::string isn't available."
514 #endif  // !defined(GTEST_HAS_STD_STRING)
515
516 #ifndef GTEST_HAS_GLOBAL_STRING
517 // The user didn't tell us whether ::string is available, so we need
518 // to figure it out.
519
520 # define GTEST_HAS_GLOBAL_STRING 0
521
522 #endif  // GTEST_HAS_GLOBAL_STRING
523
524 #ifndef GTEST_HAS_STD_WSTRING
525 // The user didn't tell us whether ::std::wstring is available, so we need
526 // to figure it out.
527 // TODO(wan@google.com): uses autoconf to detect whether ::std::wstring
528 //   is available.
529
530 // Cygwin 1.7 and below doesn't support ::std::wstring.
531 // Solaris' libc++ doesn't support it either.  Android has
532 // no support for it at least as recent as Froyo (2.2).
533 # define GTEST_HAS_STD_WSTRING \
534     (!(GTEST_OS_LINUX_ANDROID || GTEST_OS_CYGWIN || GTEST_OS_SOLARIS))
535
536 #endif  // GTEST_HAS_STD_WSTRING
537
538 #ifndef GTEST_HAS_GLOBAL_WSTRING
539 // The user didn't tell us whether ::wstring is available, so we need
540 // to figure it out.
541 # define GTEST_HAS_GLOBAL_WSTRING \
542     (GTEST_HAS_STD_WSTRING && GTEST_HAS_GLOBAL_STRING)
543 #endif  // GTEST_HAS_GLOBAL_WSTRING
544
545 // Determines whether RTTI is available.
546 #ifndef GTEST_HAS_RTTI
547 // The user didn't tell us whether RTTI is enabled, so we need to
548 // figure it out.
549
550 # ifdef _MSC_VER
551
552 #  ifdef _CPPRTTI  // MSVC defines this macro iff RTTI is enabled.
553 #   define GTEST_HAS_RTTI 1
554 #  else
555 #   define GTEST_HAS_RTTI 0
556 #  endif
557
558 // Starting with version 4.3.2, gcc defines __GXX_RTTI iff RTTI is enabled.
559 # elif defined(__GNUC__) && (GTEST_GCC_VER_ >= 40302)
560
561 #  ifdef __GXX_RTTI
562 // When building against STLport with the Android NDK and with
563 // -frtti -fno-exceptions, the build fails at link time with undefined
564 // references to __cxa_bad_typeid. Note sure if STL or toolchain bug,
565 // so disable RTTI when detected.
566 #   if GTEST_OS_LINUX_ANDROID && defined(_STLPORT_MAJOR) && \
567        !defined(__EXCEPTIONS)
568 #    define GTEST_HAS_RTTI 0
569 #   else
570 #   define GTEST_HAS_RTTI 1
571 #   endif  // GTEST_OS_LINUX_ANDROID && _STLPORT_MAJOR && !__EXCEPTIONS
572 #  else
573 #   define GTEST_HAS_RTTI 0
574 #  endif  // __GXX_RTTI
575
576 // Clang defines __GXX_RTTI starting with version 3.0, but its manual recommends
577 // using has_feature instead. has_feature(cxx_rtti) is supported since 2.7, the
578 // first version with C++ support.
579 # elif defined(__clang__)
580
581 #  define GTEST_HAS_RTTI __has_feature(cxx_rtti)
582
583 // Starting with version 9.0 IBM Visual Age defines __RTTI_ALL__ to 1 if
584 // both the typeid and dynamic_cast features are present.
585 # elif defined(__IBMCPP__) && (__IBMCPP__ >= 900)
586
587 #  ifdef __RTTI_ALL__
588 #   define GTEST_HAS_RTTI 1
589 #  else
590 #   define GTEST_HAS_RTTI 0
591 #  endif
592
593 # else
594
595 // For all other compilers, we assume RTTI is enabled.
596 #  define GTEST_HAS_RTTI 1
597
598 # endif  // _MSC_VER
599
600 #endif  // GTEST_HAS_RTTI
601
602 // It's this header's responsibility to #include <typeinfo> when RTTI
603 // is enabled.
604 #if GTEST_HAS_RTTI
605 # include <typeinfo>
606 #endif
607
608 // Determines whether Google Test can use the pthreads library.
609 #ifndef GTEST_HAS_PTHREAD
610 // The user didn't tell us explicitly, so we assume pthreads support is
611 // available on Linux and Mac.
612 //
613 // To disable threading support in Google Test, add -DGTEST_HAS_PTHREAD=0
614 // to your compiler flags.
615 # define GTEST_HAS_PTHREAD (GTEST_OS_LINUX || GTEST_OS_MAC || GTEST_OS_HPUX \
616     || GTEST_OS_QNX)
617 #endif  // GTEST_HAS_PTHREAD
618
619 #if GTEST_HAS_PTHREAD
620 // gtest-port.h guarantees to #include <pthread.h> when GTEST_HAS_PTHREAD is
621 // true.
622 # include <pthread.h>  // NOLINT
623
624 // For timespec and nanosleep, used below.
625 # include <time.h>  // NOLINT
626 #endif
627
628 // Determines whether Google Test can use tr1/tuple.  You can define
629 // this macro to 0 to prevent Google Test from using tuple (any
630 // feature depending on tuple with be disabled in this mode).
631 #ifndef GTEST_HAS_TR1_TUPLE
632 # if GTEST_OS_LINUX_ANDROID && defined(_STLPORT_MAJOR)
633 // STLport, provided with the Android NDK, has neither <tr1/tuple> or <tuple>.
634 #  define GTEST_HAS_TR1_TUPLE 0
635 # else
636 // The user didn't tell us not to do it, so we assume it's OK.
637 # define GTEST_HAS_TR1_TUPLE 1
638 # endif
639 #endif  // GTEST_HAS_TR1_TUPLE
640
641 // Determines whether Google Test's own tr1 tuple implementation
642 // should be used.
643 #ifndef GTEST_USE_OWN_TR1_TUPLE
644 // The user didn't tell us, so we need to figure it out.
645
646 // We use our own TR1 tuple if we aren't sure the user has an
647 // implementation of it already.  At this time, libstdc++ 4.0.0+ and
648 // MSVC 2010 are the only mainstream standard libraries that come
649 // with a TR1 tuple implementation.  NVIDIA's CUDA NVCC compiler
650 // pretends to be GCC by defining __GNUC__ and friends, but cannot
651 // compile GCC's tuple implementation.  MSVC 2008 (9.0) provides TR1
652 // tuple in a 323 MB Feature Pack download, which we cannot assume the
653 // user has.  QNX's QCC compiler is a modified GCC but it doesn't
654 // support TR1 tuple.  libc++ only provides std::tuple, in C++11 mode,
655 // and it can be used with some compilers that define __GNUC__.
656 # if (defined(__GNUC__) && !defined(__CUDACC__) && (GTEST_GCC_VER_ >= 40000) \
657       && !GTEST_OS_QNX && !defined(_LIBCPP_VERSION)) && !defined(_STLPORT_MAJOR) \
658       || (defined(_MSC_VER) && _MSC_VER >= 1600)
659 #  define GTEST_ENV_HAS_TR1_TUPLE_ 1
660 # else
661 #  define GTEST_ENV_HAS_TR1_TUPLE_ 0
662 # endif
663
664 // C++11 specifies that <tuple> provides std::tuple. Use that if gtest is used
665 // in C++11 mode and libstdc++ isn't very old (binaries targeting OS X 10.6
666 // can build with clang but need to use gcc4.2's libstdc++).
667 # if GTEST_LANG_CXX11 && (!defined(__GLIBCXX__) || __GLIBCXX__ > 20110325)
668 #  define GTEST_ENV_HAS_STD_TUPLE_ 1
669 # else
670 #  define GTEST_ENV_HAS_STD_TUPLE_ 0
671 # endif
672
673 # if GTEST_ENV_HAS_TR1_TUPLE_ || GTEST_ENV_HAS_STD_TUPLE_
674 #  define GTEST_USE_OWN_TR1_TUPLE 0
675 # else
676 #  define GTEST_USE_OWN_TR1_TUPLE 1
677 #  undef  GTEST_HAS_TR1_TUPLE
678 #  define GTEST_HAS_TR1_TUPLE 1
679 # endif
680
681 #endif  // GTEST_USE_OWN_TR1_TUPLE
682
683 // To avoid conditional compilation everywhere, we make it
684 // gtest-port.h's responsibility to #include the header implementing
685 // tr1/tuple.
686 #if GTEST_HAS_TR1_TUPLE
687
688 # if GTEST_USE_OWN_TR1_TUPLE
689 // This file was GENERATED by command:
690 //     pump.py gtest-tuple.h.pump
691 // DO NOT EDIT BY HAND!!!
692
693 // Copyright 2009 Google Inc.
694 // All Rights Reserved.
695 //
696 // Redistribution and use in source and binary forms, with or without
697 // modification, are permitted provided that the following conditions are
698 // met:
699 //
700 //     * Redistributions of source code must retain the above copyright
701 // notice, this list of conditions and the following disclaimer.
702 //     * Redistributions in binary form must reproduce the above
703 // copyright notice, this list of conditions and the following disclaimer
704 // in the documentation and/or other materials provided with the
705 // distribution.
706 //     * Neither the name of Google Inc. nor the names of its
707 // contributors may be used to endorse or promote products derived from
708 // this software without specific prior written permission.
709 //
710 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
711 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
712 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
713 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
714 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
715 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
716 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
717 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
718 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
719 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
720 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
721 //
722 // Author: wan@google.com (Zhanyong Wan)
723
724 // Implements a subset of TR1 tuple needed by Google Test and Google Mock.
725
726 #ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_TUPLE_H_
727 #define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_TUPLE_H_
728
729 #include <utility>  // For ::std::pair.
730
731 // The compiler used in Symbian has a bug that prevents us from declaring the
732 // tuple template as a friend (it complains that tuple is redefined).  This
733 // hack bypasses the bug by declaring the members that should otherwise be
734 // private as public.
735 // Sun Studio versions < 12 also have the above bug.
736 #if defined(__SYMBIAN32__) || (defined(__SUNPRO_CC) && __SUNPRO_CC < 0x590)
737 # define GTEST_DECLARE_TUPLE_AS_FRIEND_ public:
738 #else
739 # define GTEST_DECLARE_TUPLE_AS_FRIEND_ \
740     template <GTEST_10_TYPENAMES_(U)> friend class tuple; \
741    private:
742 #endif
743
744 // GTEST_n_TUPLE_(T) is the type of an n-tuple.
745 #define GTEST_0_TUPLE_(T) tuple<>
746 #define GTEST_1_TUPLE_(T) tuple<T##0, void, void, void, void, void, void, \
747     void, void, void>
748 #define GTEST_2_TUPLE_(T) tuple<T##0, T##1, void, void, void, void, void, \
749     void, void, void>
750 #define GTEST_3_TUPLE_(T) tuple<T##0, T##1, T##2, void, void, void, void, \
751     void, void, void>
752 #define GTEST_4_TUPLE_(T) tuple<T##0, T##1, T##2, T##3, void, void, void, \
753     void, void, void>
754 #define GTEST_5_TUPLE_(T) tuple<T##0, T##1, T##2, T##3, T##4, void, void, \
755     void, void, void>
756 #define GTEST_6_TUPLE_(T) tuple<T##0, T##1, T##2, T##3, T##4, T##5, void, \
757     void, void, void>
758 #define GTEST_7_TUPLE_(T) tuple<T##0, T##1, T##2, T##3, T##4, T##5, T##6, \
759     void, void, void>
760 #define GTEST_8_TUPLE_(T) tuple<T##0, T##1, T##2, T##3, T##4, T##5, T##6, \
761     T##7, void, void>
762 #define GTEST_9_TUPLE_(T) tuple<T##0, T##1, T##2, T##3, T##4, T##5, T##6, \
763     T##7, T##8, void>
764 #define GTEST_10_TUPLE_(T) tuple<T##0, T##1, T##2, T##3, T##4, T##5, T##6, \
765     T##7, T##8, T##9>
766
767 // GTEST_n_TYPENAMES_(T) declares a list of n typenames.
768 #define GTEST_0_TYPENAMES_(T)
769 #define GTEST_1_TYPENAMES_(T) typename T##0
770 #define GTEST_2_TYPENAMES_(T) typename T##0, typename T##1
771 #define GTEST_3_TYPENAMES_(T) typename T##0, typename T##1, typename T##2
772 #define GTEST_4_TYPENAMES_(T) typename T##0, typename T##1, typename T##2, \
773     typename T##3
774 #define GTEST_5_TYPENAMES_(T) typename T##0, typename T##1, typename T##2, \
775     typename T##3, typename T##4
776 #define GTEST_6_TYPENAMES_(T) typename T##0, typename T##1, typename T##2, \
777     typename T##3, typename T##4, typename T##5
778 #define GTEST_7_TYPENAMES_(T) typename T##0, typename T##1, typename T##2, \
779     typename T##3, typename T##4, typename T##5, typename T##6
780 #define GTEST_8_TYPENAMES_(T) typename T##0, typename T##1, typename T##2, \
781     typename T##3, typename T##4, typename T##5, typename T##6, typename T##7
782 #define GTEST_9_TYPENAMES_(T) typename T##0, typename T##1, typename T##2, \
783     typename T##3, typename T##4, typename T##5, typename T##6, \
784     typename T##7, typename T##8
785 #define GTEST_10_TYPENAMES_(T) typename T##0, typename T##1, typename T##2, \
786     typename T##3, typename T##4, typename T##5, typename T##6, \
787     typename T##7, typename T##8, typename T##9
788
789 // In theory, defining stuff in the ::std namespace is undefined
790 // behavior.  We can do this as we are playing the role of a standard
791 // library vendor.
792 namespace std {
793 namespace tr1 {
794
795 template <typename T0 = void, typename T1 = void, typename T2 = void,
796     typename T3 = void, typename T4 = void, typename T5 = void,
797     typename T6 = void, typename T7 = void, typename T8 = void,
798     typename T9 = void>
799 class tuple;
800
801 // Anything in namespace gtest_internal is Google Test's INTERNAL
802 // IMPLEMENTATION DETAIL and MUST NOT BE USED DIRECTLY in user code.
803 namespace gtest_internal {
804
805 // ByRef<T>::type is T if T is a reference; otherwise it's const T&.
806 template <typename T>
807 struct ByRef { typedef const T& type; };  // NOLINT
808 template <typename T>
809 struct ByRef<T&> { typedef T& type; };  // NOLINT
810
811 // A handy wrapper for ByRef.
812 #define GTEST_BY_REF_(T) typename ::std::tr1::gtest_internal::ByRef<T>::type
813
814 // AddRef<T>::type is T if T is a reference; otherwise it's T&.  This
815 // is the same as tr1::add_reference<T>::type.
816 template <typename T>
817 struct AddRef { typedef T& type; };  // NOLINT
818 template <typename T>
819 struct AddRef<T&> { typedef T& type; };  // NOLINT
820
821 // A handy wrapper for AddRef.
822 #define GTEST_ADD_REF_(T) typename ::std::tr1::gtest_internal::AddRef<T>::type
823
824 // A helper for implementing get<k>().
825 template <int k> class Get;
826
827 // A helper for implementing tuple_element<k, T>.  kIndexValid is true
828 // iff k < the number of fields in tuple type T.
829 template <bool kIndexValid, int kIndex, class Tuple>
830 struct TupleElement;
831
832 template <GTEST_10_TYPENAMES_(T)>
833 struct TupleElement<true, 0, GTEST_10_TUPLE_(T)> {
834   typedef T0 type;
835 };
836
837 template <GTEST_10_TYPENAMES_(T)>
838 struct TupleElement<true, 1, GTEST_10_TUPLE_(T)> {
839   typedef T1 type;
840 };
841
842 template <GTEST_10_TYPENAMES_(T)>
843 struct TupleElement<true, 2, GTEST_10_TUPLE_(T)> {
844   typedef T2 type;
845 };
846
847 template <GTEST_10_TYPENAMES_(T)>
848 struct TupleElement<true, 3, GTEST_10_TUPLE_(T)> {
849   typedef T3 type;
850 };
851
852 template <GTEST_10_TYPENAMES_(T)>
853 struct TupleElement<true, 4, GTEST_10_TUPLE_(T)> {
854   typedef T4 type;
855 };
856
857 template <GTEST_10_TYPENAMES_(T)>
858 struct TupleElement<true, 5, GTEST_10_TUPLE_(T)> {
859   typedef T5 type;
860 };
861
862 template <GTEST_10_TYPENAMES_(T)>
863 struct TupleElement<true, 6, GTEST_10_TUPLE_(T)> {
864   typedef T6 type;
865 };
866
867 template <GTEST_10_TYPENAMES_(T)>
868 struct TupleElement<true, 7, GTEST_10_TUPLE_(T)> {
869   typedef T7 type;
870 };
871
872 template <GTEST_10_TYPENAMES_(T)>
873 struct TupleElement<true, 8, GTEST_10_TUPLE_(T)> {
874   typedef T8 type;
875 };
876
877 template <GTEST_10_TYPENAMES_(T)>
878 struct TupleElement<true, 9, GTEST_10_TUPLE_(T)> {
879   typedef T9 type;
880 };
881
882 }  // namespace gtest_internal
883
884 template <>
885 class tuple<> {
886  public:
887   tuple() {}
888   tuple(const tuple& /* t */)  {}
889   tuple& operator=(const tuple& /* t */) { return *this; }
890 };
891
892 template <GTEST_1_TYPENAMES_(T)>
893 class GTEST_1_TUPLE_(T) {
894  public:
895   template <int k> friend class gtest_internal::Get;
896
897   tuple() : f0_() {}
898
899   explicit tuple(GTEST_BY_REF_(T0) f0) : f0_(f0) {}
900
901   tuple(const tuple& t) : f0_(t.f0_) {}
902
903   template <GTEST_1_TYPENAMES_(U)>
904   tuple(const GTEST_1_TUPLE_(U)& t) : f0_(t.f0_) {}
905
906   tuple& operator=(const tuple& t) { return CopyFrom(t); }
907
908   template <GTEST_1_TYPENAMES_(U)>
909   tuple& operator=(const GTEST_1_TUPLE_(U)& t) {
910     return CopyFrom(t);
911   }
912
913   GTEST_DECLARE_TUPLE_AS_FRIEND_
914
915   template <GTEST_1_TYPENAMES_(U)>
916   tuple& CopyFrom(const GTEST_1_TUPLE_(U)& t) {
917     f0_ = t.f0_;
918     return *this;
919   }
920
921   T0 f0_;
922 };
923
924 template <GTEST_2_TYPENAMES_(T)>
925 class GTEST_2_TUPLE_(T) {
926  public:
927   template <int k> friend class gtest_internal::Get;
928
929   tuple() : f0_(), f1_() {}
930
931   explicit tuple(GTEST_BY_REF_(T0) f0, GTEST_BY_REF_(T1) f1) : f0_(f0),
932       f1_(f1) {}
933
934   tuple(const tuple& t) : f0_(t.f0_), f1_(t.f1_) {}
935
936   template <GTEST_2_TYPENAMES_(U)>
937   tuple(const GTEST_2_TUPLE_(U)& t) : f0_(t.f0_), f1_(t.f1_) {}
938   template <typename U0, typename U1>
939   tuple(const ::std::pair<U0, U1>& p) : f0_(p.first), f1_(p.second) {}
940
941   tuple& operator=(const tuple& t) { return CopyFrom(t); }
942
943   template <GTEST_2_TYPENAMES_(U)>
944   tuple& operator=(const GTEST_2_TUPLE_(U)& t) {
945     return CopyFrom(t);
946   }
947   template <typename U0, typename U1>
948   tuple& operator=(const ::std::pair<U0, U1>& p) {
949     f0_ = p.first;
950     f1_ = p.second;
951     return *this;
952   }
953
954   GTEST_DECLARE_TUPLE_AS_FRIEND_
955
956   template <GTEST_2_TYPENAMES_(U)>
957   tuple& CopyFrom(const GTEST_2_TUPLE_(U)& t) {
958     f0_ = t.f0_;
959     f1_ = t.f1_;
960     return *this;
961   }
962
963   T0 f0_;
964   T1 f1_;
965 };
966
967 template <GTEST_3_TYPENAMES_(T)>
968 class GTEST_3_TUPLE_(T) {
969  public:
970   template <int k> friend class gtest_internal::Get;
971
972   tuple() : f0_(), f1_(), f2_() {}
973
974   explicit tuple(GTEST_BY_REF_(T0) f0, GTEST_BY_REF_(T1) f1,
975       GTEST_BY_REF_(T2) f2) : f0_(f0), f1_(f1), f2_(f2) {}
976
977   tuple(const tuple& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_) {}
978
979   template <GTEST_3_TYPENAMES_(U)>
980   tuple(const GTEST_3_TUPLE_(U)& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_) {}
981
982   tuple& operator=(const tuple& t) { return CopyFrom(t); }
983
984   template <GTEST_3_TYPENAMES_(U)>
985   tuple& operator=(const GTEST_3_TUPLE_(U)& t) {
986     return CopyFrom(t);
987   }
988
989   GTEST_DECLARE_TUPLE_AS_FRIEND_
990
991   template <GTEST_3_TYPENAMES_(U)>
992   tuple& CopyFrom(const GTEST_3_TUPLE_(U)& t) {
993     f0_ = t.f0_;
994     f1_ = t.f1_;
995     f2_ = t.f2_;
996     return *this;
997   }
998
999   T0 f0_;
1000   T1 f1_;
1001   T2 f2_;
1002 };
1003
1004 template <GTEST_4_TYPENAMES_(T)>
1005 class GTEST_4_TUPLE_(T) {
1006  public:
1007   template <int k> friend class gtest_internal::Get;
1008
1009   tuple() : f0_(), f1_(), f2_(), f3_() {}
1010
1011   explicit tuple(GTEST_BY_REF_(T0) f0, GTEST_BY_REF_(T1) f1,
1012       GTEST_BY_REF_(T2) f2, GTEST_BY_REF_(T3) f3) : f0_(f0), f1_(f1), f2_(f2),
1013       f3_(f3) {}
1014
1015   tuple(const tuple& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_), f3_(t.f3_) {}
1016
1017   template <GTEST_4_TYPENAMES_(U)>
1018   tuple(const GTEST_4_TUPLE_(U)& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_),
1019       f3_(t.f3_) {}
1020
1021   tuple& operator=(const tuple& t) { return CopyFrom(t); }
1022
1023   template <GTEST_4_TYPENAMES_(U)>
1024   tuple& operator=(const GTEST_4_TUPLE_(U)& t) {
1025     return CopyFrom(t);
1026   }
1027
1028   GTEST_DECLARE_TUPLE_AS_FRIEND_
1029
1030   template <GTEST_4_TYPENAMES_(U)>
1031   tuple& CopyFrom(const GTEST_4_TUPLE_(U)& t) {
1032     f0_ = t.f0_;
1033     f1_ = t.f1_;
1034     f2_ = t.f2_;
1035     f3_ = t.f3_;
1036     return *this;
1037   }
1038
1039   T0 f0_;
1040   T1 f1_;
1041   T2 f2_;
1042   T3 f3_;
1043 };
1044
1045 template <GTEST_5_TYPENAMES_(T)>
1046 class GTEST_5_TUPLE_(T) {
1047  public:
1048   template <int k> friend class gtest_internal::Get;
1049
1050   tuple() : f0_(), f1_(), f2_(), f3_(), f4_() {}
1051
1052   explicit tuple(GTEST_BY_REF_(T0) f0, GTEST_BY_REF_(T1) f1,
1053       GTEST_BY_REF_(T2) f2, GTEST_BY_REF_(T3) f3,
1054       GTEST_BY_REF_(T4) f4) : f0_(f0), f1_(f1), f2_(f2), f3_(f3), f4_(f4) {}
1055
1056   tuple(const tuple& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_), f3_(t.f3_),
1057       f4_(t.f4_) {}
1058
1059   template <GTEST_5_TYPENAMES_(U)>
1060   tuple(const GTEST_5_TUPLE_(U)& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_),
1061       f3_(t.f3_), f4_(t.f4_) {}
1062
1063   tuple& operator=(const tuple& t) { return CopyFrom(t); }
1064
1065   template <GTEST_5_TYPENAMES_(U)>
1066   tuple& operator=(const GTEST_5_TUPLE_(U)& t) {
1067     return CopyFrom(t);
1068   }
1069
1070   GTEST_DECLARE_TUPLE_AS_FRIEND_
1071
1072   template <GTEST_5_TYPENAMES_(U)>
1073   tuple& CopyFrom(const GTEST_5_TUPLE_(U)& t) {
1074     f0_ = t.f0_;
1075     f1_ = t.f1_;
1076     f2_ = t.f2_;
1077     f3_ = t.f3_;
1078     f4_ = t.f4_;
1079     return *this;
1080   }
1081
1082   T0 f0_;
1083   T1 f1_;
1084   T2 f2_;
1085   T3 f3_;
1086   T4 f4_;
1087 };
1088
1089 template <GTEST_6_TYPENAMES_(T)>
1090 class GTEST_6_TUPLE_(T) {
1091  public:
1092   template <int k> friend class gtest_internal::Get;
1093
1094   tuple() : f0_(), f1_(), f2_(), f3_(), f4_(), f5_() {}
1095
1096   explicit tuple(GTEST_BY_REF_(T0) f0, GTEST_BY_REF_(T1) f1,
1097       GTEST_BY_REF_(T2) f2, GTEST_BY_REF_(T3) f3, GTEST_BY_REF_(T4) f4,
1098       GTEST_BY_REF_(T5) f5) : f0_(f0), f1_(f1), f2_(f2), f3_(f3), f4_(f4),
1099       f5_(f5) {}
1100
1101   tuple(const tuple& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_), f3_(t.f3_),
1102       f4_(t.f4_), f5_(t.f5_) {}
1103
1104   template <GTEST_6_TYPENAMES_(U)>
1105   tuple(const GTEST_6_TUPLE_(U)& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_),
1106       f3_(t.f3_), f4_(t.f4_), f5_(t.f5_) {}
1107
1108   tuple& operator=(const tuple& t) { return CopyFrom(t); }
1109
1110   template <GTEST_6_TYPENAMES_(U)>
1111   tuple& operator=(const GTEST_6_TUPLE_(U)& t) {
1112     return CopyFrom(t);
1113   }
1114
1115   GTEST_DECLARE_TUPLE_AS_FRIEND_
1116
1117   template <GTEST_6_TYPENAMES_(U)>
1118   tuple& CopyFrom(const GTEST_6_TUPLE_(U)& t) {
1119     f0_ = t.f0_;
1120     f1_ = t.f1_;
1121     f2_ = t.f2_;
1122     f3_ = t.f3_;
1123     f4_ = t.f4_;
1124     f5_ = t.f5_;
1125     return *this;
1126   }
1127
1128   T0 f0_;
1129   T1 f1_;
1130   T2 f2_;
1131   T3 f3_;
1132   T4 f4_;
1133   T5 f5_;
1134 };
1135
1136 template <GTEST_7_TYPENAMES_(T)>
1137 class GTEST_7_TUPLE_(T) {
1138  public:
1139   template <int k> friend class gtest_internal::Get;
1140
1141   tuple() : f0_(), f1_(), f2_(), f3_(), f4_(), f5_(), f6_() {}
1142
1143   explicit tuple(GTEST_BY_REF_(T0) f0, GTEST_BY_REF_(T1) f1,
1144       GTEST_BY_REF_(T2) f2, GTEST_BY_REF_(T3) f3, GTEST_BY_REF_(T4) f4,
1145       GTEST_BY_REF_(T5) f5, GTEST_BY_REF_(T6) f6) : f0_(f0), f1_(f1), f2_(f2),
1146       f3_(f3), f4_(f4), f5_(f5), f6_(f6) {}
1147
1148   tuple(const tuple& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_), f3_(t.f3_),
1149       f4_(t.f4_), f5_(t.f5_), f6_(t.f6_) {}
1150
1151   template <GTEST_7_TYPENAMES_(U)>
1152   tuple(const GTEST_7_TUPLE_(U)& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_),
1153       f3_(t.f3_), f4_(t.f4_), f5_(t.f5_), f6_(t.f6_) {}
1154
1155   tuple& operator=(const tuple& t) { return CopyFrom(t); }
1156
1157   template <GTEST_7_TYPENAMES_(U)>
1158   tuple& operator=(const GTEST_7_TUPLE_(U)& t) {
1159     return CopyFrom(t);
1160   }
1161
1162   GTEST_DECLARE_TUPLE_AS_FRIEND_
1163
1164   template <GTEST_7_TYPENAMES_(U)>
1165   tuple& CopyFrom(const GTEST_7_TUPLE_(U)& t) {
1166     f0_ = t.f0_;
1167     f1_ = t.f1_;
1168     f2_ = t.f2_;
1169     f3_ = t.f3_;
1170     f4_ = t.f4_;
1171     f5_ = t.f5_;
1172     f6_ = t.f6_;
1173     return *this;
1174   }
1175
1176   T0 f0_;
1177   T1 f1_;
1178   T2 f2_;
1179   T3 f3_;
1180   T4 f4_;
1181   T5 f5_;
1182   T6 f6_;
1183 };
1184
1185 template <GTEST_8_TYPENAMES_(T)>
1186 class GTEST_8_TUPLE_(T) {
1187  public:
1188   template <int k> friend class gtest_internal::Get;
1189
1190   tuple() : f0_(), f1_(), f2_(), f3_(), f4_(), f5_(), f6_(), f7_() {}
1191
1192   explicit tuple(GTEST_BY_REF_(T0) f0, GTEST_BY_REF_(T1) f1,
1193       GTEST_BY_REF_(T2) f2, GTEST_BY_REF_(T3) f3, GTEST_BY_REF_(T4) f4,
1194       GTEST_BY_REF_(T5) f5, GTEST_BY_REF_(T6) f6,
1195       GTEST_BY_REF_(T7) f7) : f0_(f0), f1_(f1), f2_(f2), f3_(f3), f4_(f4),
1196       f5_(f5), f6_(f6), f7_(f7) {}
1197
1198   tuple(const tuple& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_), f3_(t.f3_),
1199       f4_(t.f4_), f5_(t.f5_), f6_(t.f6_), f7_(t.f7_) {}
1200
1201   template <GTEST_8_TYPENAMES_(U)>
1202   tuple(const GTEST_8_TUPLE_(U)& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_),
1203       f3_(t.f3_), f4_(t.f4_), f5_(t.f5_), f6_(t.f6_), f7_(t.f7_) {}
1204
1205   tuple& operator=(const tuple& t) { return CopyFrom(t); }
1206
1207   template <GTEST_8_TYPENAMES_(U)>
1208   tuple& operator=(const GTEST_8_TUPLE_(U)& t) {
1209     return CopyFrom(t);
1210   }
1211
1212   GTEST_DECLARE_TUPLE_AS_FRIEND_
1213
1214   template <GTEST_8_TYPENAMES_(U)>
1215   tuple& CopyFrom(const GTEST_8_TUPLE_(U)& t) {
1216     f0_ = t.f0_;
1217     f1_ = t.f1_;
1218     f2_ = t.f2_;
1219     f3_ = t.f3_;
1220     f4_ = t.f4_;
1221     f5_ = t.f5_;
1222     f6_ = t.f6_;
1223     f7_ = t.f7_;
1224     return *this;
1225   }
1226
1227   T0 f0_;
1228   T1 f1_;
1229   T2 f2_;
1230   T3 f3_;
1231   T4 f4_;
1232   T5 f5_;
1233   T6 f6_;
1234   T7 f7_;
1235 };
1236
1237 template <GTEST_9_TYPENAMES_(T)>
1238 class GTEST_9_TUPLE_(T) {
1239  public:
1240   template <int k> friend class gtest_internal::Get;
1241
1242   tuple() : f0_(), f1_(), f2_(), f3_(), f4_(), f5_(), f6_(), f7_(), f8_() {}
1243
1244   explicit tuple(GTEST_BY_REF_(T0) f0, GTEST_BY_REF_(T1) f1,
1245       GTEST_BY_REF_(T2) f2, GTEST_BY_REF_(T3) f3, GTEST_BY_REF_(T4) f4,
1246       GTEST_BY_REF_(T5) f5, GTEST_BY_REF_(T6) f6, GTEST_BY_REF_(T7) f7,
1247       GTEST_BY_REF_(T8) f8) : f0_(f0), f1_(f1), f2_(f2), f3_(f3), f4_(f4),
1248       f5_(f5), f6_(f6), f7_(f7), f8_(f8) {}
1249
1250   tuple(const tuple& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_), f3_(t.f3_),
1251       f4_(t.f4_), f5_(t.f5_), f6_(t.f6_), f7_(t.f7_), f8_(t.f8_) {}
1252
1253   template <GTEST_9_TYPENAMES_(U)>
1254   tuple(const GTEST_9_TUPLE_(U)& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_),
1255       f3_(t.f3_), f4_(t.f4_), f5_(t.f5_), f6_(t.f6_), f7_(t.f7_), f8_(t.f8_) {}
1256
1257   tuple& operator=(const tuple& t) { return CopyFrom(t); }
1258
1259   template <GTEST_9_TYPENAMES_(U)>
1260   tuple& operator=(const GTEST_9_TUPLE_(U)& t) {
1261     return CopyFrom(t);
1262   }
1263
1264   GTEST_DECLARE_TUPLE_AS_FRIEND_
1265
1266   template <GTEST_9_TYPENAMES_(U)>
1267   tuple& CopyFrom(const GTEST_9_TUPLE_(U)& t) {
1268     f0_ = t.f0_;
1269     f1_ = t.f1_;
1270     f2_ = t.f2_;
1271     f3_ = t.f3_;
1272     f4_ = t.f4_;
1273     f5_ = t.f5_;
1274     f6_ = t.f6_;
1275     f7_ = t.f7_;
1276     f8_ = t.f8_;
1277     return *this;
1278   }
1279
1280   T0 f0_;
1281   T1 f1_;
1282   T2 f2_;
1283   T3 f3_;
1284   T4 f4_;
1285   T5 f5_;
1286   T6 f6_;
1287   T7 f7_;
1288   T8 f8_;
1289 };
1290
1291 template <GTEST_10_TYPENAMES_(T)>
1292 class tuple {
1293  public:
1294   template <int k> friend class gtest_internal::Get;
1295
1296   tuple() : f0_(), f1_(), f2_(), f3_(), f4_(), f5_(), f6_(), f7_(), f8_(),
1297       f9_() {}
1298
1299   explicit tuple(GTEST_BY_REF_(T0) f0, GTEST_BY_REF_(T1) f1,
1300       GTEST_BY_REF_(T2) f2, GTEST_BY_REF_(T3) f3, GTEST_BY_REF_(T4) f4,
1301       GTEST_BY_REF_(T5) f5, GTEST_BY_REF_(T6) f6, GTEST_BY_REF_(T7) f7,
1302       GTEST_BY_REF_(T8) f8, GTEST_BY_REF_(T9) f9) : f0_(f0), f1_(f1), f2_(f2),
1303       f3_(f3), f4_(f4), f5_(f5), f6_(f6), f7_(f7), f8_(f8), f9_(f9) {}
1304
1305   tuple(const tuple& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_), f3_(t.f3_),
1306       f4_(t.f4_), f5_(t.f5_), f6_(t.f6_), f7_(t.f7_), f8_(t.f8_), f9_(t.f9_) {}
1307
1308   template <GTEST_10_TYPENAMES_(U)>
1309   tuple(const GTEST_10_TUPLE_(U)& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_),
1310       f3_(t.f3_), f4_(t.f4_), f5_(t.f5_), f6_(t.f6_), f7_(t.f7_), f8_(t.f8_),
1311       f9_(t.f9_) {}
1312
1313   tuple& operator=(const tuple& t) { return CopyFrom(t); }
1314
1315   template <GTEST_10_TYPENAMES_(U)>
1316   tuple& operator=(const GTEST_10_TUPLE_(U)& t) {
1317     return CopyFrom(t);
1318   }
1319
1320   GTEST_DECLARE_TUPLE_AS_FRIEND_
1321
1322   template <GTEST_10_TYPENAMES_(U)>
1323   tuple& CopyFrom(const GTEST_10_TUPLE_(U)& t) {
1324     f0_ = t.f0_;
1325     f1_ = t.f1_;
1326     f2_ = t.f2_;
1327     f3_ = t.f3_;
1328     f4_ = t.f4_;
1329     f5_ = t.f5_;
1330     f6_ = t.f6_;
1331     f7_ = t.f7_;
1332     f8_ = t.f8_;
1333     f9_ = t.f9_;
1334     return *this;
1335   }
1336
1337   T0 f0_;
1338   T1 f1_;
1339   T2 f2_;
1340   T3 f3_;
1341   T4 f4_;
1342   T5 f5_;
1343   T6 f6_;
1344   T7 f7_;
1345   T8 f8_;
1346   T9 f9_;
1347 };
1348
1349 // 6.1.3.2 Tuple creation functions.
1350
1351 // Known limitations: we don't support passing an
1352 // std::tr1::reference_wrapper<T> to make_tuple().  And we don't
1353 // implement tie().
1354
1355 inline tuple<> make_tuple() { return tuple<>(); }
1356
1357 template <GTEST_1_TYPENAMES_(T)>
1358 inline GTEST_1_TUPLE_(T) make_tuple(const T0& f0) {
1359   return GTEST_1_TUPLE_(T)(f0);
1360 }
1361
1362 template <GTEST_2_TYPENAMES_(T)>
1363 inline GTEST_2_TUPLE_(T) make_tuple(const T0& f0, const T1& f1) {
1364   return GTEST_2_TUPLE_(T)(f0, f1);
1365 }
1366
1367 template <GTEST_3_TYPENAMES_(T)>
1368 inline GTEST_3_TUPLE_(T) make_tuple(const T0& f0, const T1& f1, const T2& f2) {
1369   return GTEST_3_TUPLE_(T)(f0, f1, f2);
1370 }
1371
1372 template <GTEST_4_TYPENAMES_(T)>
1373 inline GTEST_4_TUPLE_(T) make_tuple(const T0& f0, const T1& f1, const T2& f2,
1374     const T3& f3) {
1375   return GTEST_4_TUPLE_(T)(f0, f1, f2, f3);
1376 }
1377
1378 template <GTEST_5_TYPENAMES_(T)>
1379 inline GTEST_5_TUPLE_(T) make_tuple(const T0& f0, const T1& f1, const T2& f2,
1380     const T3& f3, const T4& f4) {
1381   return GTEST_5_TUPLE_(T)(f0, f1, f2, f3, f4);
1382 }
1383
1384 template <GTEST_6_TYPENAMES_(T)>
1385 inline GTEST_6_TUPLE_(T) make_tuple(const T0& f0, const T1& f1, const T2& f2,
1386     const T3& f3, const T4& f4, const T5& f5) {
1387   return GTEST_6_TUPLE_(T)(f0, f1, f2, f3, f4, f5);
1388 }
1389
1390 template <GTEST_7_TYPENAMES_(T)>
1391 inline GTEST_7_TUPLE_(T) make_tuple(const T0& f0, const T1& f1, const T2& f2,
1392     const T3& f3, const T4& f4, const T5& f5, const T6& f6) {
1393   return GTEST_7_TUPLE_(T)(f0, f1, f2, f3, f4, f5, f6);
1394 }
1395
1396 template <GTEST_8_TYPENAMES_(T)>
1397 inline GTEST_8_TUPLE_(T) make_tuple(const T0& f0, const T1& f1, const T2& f2,
1398     const T3& f3, const T4& f4, const T5& f5, const T6& f6, const T7& f7) {
1399   return GTEST_8_TUPLE_(T)(f0, f1, f2, f3, f4, f5, f6, f7);
1400 }
1401
1402 template <GTEST_9_TYPENAMES_(T)>
1403 inline GTEST_9_TUPLE_(T) make_tuple(const T0& f0, const T1& f1, const T2& f2,
1404     const T3& f3, const T4& f4, const T5& f5, const T6& f6, const T7& f7,
1405     const T8& f8) {
1406   return GTEST_9_TUPLE_(T)(f0, f1, f2, f3, f4, f5, f6, f7, f8);
1407 }
1408
1409 template <GTEST_10_TYPENAMES_(T)>
1410 inline GTEST_10_TUPLE_(T) make_tuple(const T0& f0, const T1& f1, const T2& f2,
1411     const T3& f3, const T4& f4, const T5& f5, const T6& f6, const T7& f7,
1412     const T8& f8, const T9& f9) {
1413   return GTEST_10_TUPLE_(T)(f0, f1, f2, f3, f4, f5, f6, f7, f8, f9);
1414 }
1415
1416 // 6.1.3.3 Tuple helper classes.
1417
1418 template <typename Tuple> struct tuple_size;
1419
1420 template <GTEST_0_TYPENAMES_(T)>
1421 struct tuple_size<GTEST_0_TUPLE_(T)> {
1422   static const int value = 0;
1423 };
1424
1425 template <GTEST_1_TYPENAMES_(T)>
1426 struct tuple_size<GTEST_1_TUPLE_(T)> {
1427   static const int value = 1;
1428 };
1429
1430 template <GTEST_2_TYPENAMES_(T)>
1431 struct tuple_size<GTEST_2_TUPLE_(T)> {
1432   static const int value = 2;
1433 };
1434
1435 template <GTEST_3_TYPENAMES_(T)>
1436 struct tuple_size<GTEST_3_TUPLE_(T)> {
1437   static const int value = 3;
1438 };
1439
1440 template <GTEST_4_TYPENAMES_(T)>
1441 struct tuple_size<GTEST_4_TUPLE_(T)> {
1442   static const int value = 4;
1443 };
1444
1445 template <GTEST_5_TYPENAMES_(T)>
1446 struct tuple_size<GTEST_5_TUPLE_(T)> {
1447   static const int value = 5;
1448 };
1449
1450 template <GTEST_6_TYPENAMES_(T)>
1451 struct tuple_size<GTEST_6_TUPLE_(T)> {
1452   static const int value = 6;
1453 };
1454
1455 template <GTEST_7_TYPENAMES_(T)>
1456 struct tuple_size<GTEST_7_TUPLE_(T)> {
1457   static const int value = 7;
1458 };
1459
1460 template <GTEST_8_TYPENAMES_(T)>
1461 struct tuple_size<GTEST_8_TUPLE_(T)> {
1462   static const int value = 8;
1463 };
1464
1465 template <GTEST_9_TYPENAMES_(T)>
1466 struct tuple_size<GTEST_9_TUPLE_(T)> {
1467   static const int value = 9;
1468 };
1469
1470 template <GTEST_10_TYPENAMES_(T)>
1471 struct tuple_size<GTEST_10_TUPLE_(T)> {
1472   static const int value = 10;
1473 };
1474
1475 template <int k, class Tuple>
1476 struct tuple_element {
1477   typedef typename gtest_internal::TupleElement<
1478       k < (tuple_size<Tuple>::value), k, Tuple>::type type;
1479 };
1480
1481 #define GTEST_TUPLE_ELEMENT_(k, Tuple) typename tuple_element<k, Tuple >::type
1482
1483 // 6.1.3.4 Element access.
1484
1485 namespace gtest_internal {
1486
1487 template <>
1488 class Get<0> {
1489  public:
1490   template <class Tuple>
1491   static GTEST_ADD_REF_(GTEST_TUPLE_ELEMENT_(0, Tuple))
1492   Field(Tuple& t) { return t.f0_; }  // NOLINT
1493
1494   template <class Tuple>
1495   static GTEST_BY_REF_(GTEST_TUPLE_ELEMENT_(0, Tuple))
1496   ConstField(const Tuple& t) { return t.f0_; }
1497 };
1498
1499 template <>
1500 class Get<1> {
1501  public:
1502   template <class Tuple>
1503   static GTEST_ADD_REF_(GTEST_TUPLE_ELEMENT_(1, Tuple))
1504   Field(Tuple& t) { return t.f1_; }  // NOLINT
1505
1506   template <class Tuple>
1507   static GTEST_BY_REF_(GTEST_TUPLE_ELEMENT_(1, Tuple))
1508   ConstField(const Tuple& t) { return t.f1_; }
1509 };
1510
1511 template <>
1512 class Get<2> {
1513  public:
1514   template <class Tuple>
1515   static GTEST_ADD_REF_(GTEST_TUPLE_ELEMENT_(2, Tuple))
1516   Field(Tuple& t) { return t.f2_; }  // NOLINT
1517
1518   template <class Tuple>
1519   static GTEST_BY_REF_(GTEST_TUPLE_ELEMENT_(2, Tuple))
1520   ConstField(const Tuple& t) { return t.f2_; }
1521 };
1522
1523 template <>
1524 class Get<3> {
1525  public:
1526   template <class Tuple>
1527   static GTEST_ADD_REF_(GTEST_TUPLE_ELEMENT_(3, Tuple))
1528   Field(Tuple& t) { return t.f3_; }  // NOLINT
1529
1530   template <class Tuple>
1531   static GTEST_BY_REF_(GTEST_TUPLE_ELEMENT_(3, Tuple))
1532   ConstField(const Tuple& t) { return t.f3_; }
1533 };
1534
1535 template <>
1536 class Get<4> {
1537  public:
1538   template <class Tuple>
1539   static GTEST_ADD_REF_(GTEST_TUPLE_ELEMENT_(4, Tuple))
1540   Field(Tuple& t) { return t.f4_; }  // NOLINT
1541
1542   template <class Tuple>
1543   static GTEST_BY_REF_(GTEST_TUPLE_ELEMENT_(4, Tuple))
1544   ConstField(const Tuple& t) { return t.f4_; }
1545 };
1546
1547 template <>
1548 class Get<5> {
1549  public:
1550   template <class Tuple>
1551   static GTEST_ADD_REF_(GTEST_TUPLE_ELEMENT_(5, Tuple))
1552   Field(Tuple& t) { return t.f5_; }  // NOLINT
1553
1554   template <class Tuple>
1555   static GTEST_BY_REF_(GTEST_TUPLE_ELEMENT_(5, Tuple))
1556   ConstField(const Tuple& t) { return t.f5_; }
1557 };
1558
1559 template <>
1560 class Get<6> {
1561  public:
1562   template <class Tuple>
1563   static GTEST_ADD_REF_(GTEST_TUPLE_ELEMENT_(6, Tuple))
1564   Field(Tuple& t) { return t.f6_; }  // NOLINT
1565
1566   template <class Tuple>
1567   static GTEST_BY_REF_(GTEST_TUPLE_ELEMENT_(6, Tuple))
1568   ConstField(const Tuple& t) { return t.f6_; }
1569 };
1570
1571 template <>
1572 class Get<7> {
1573  public:
1574   template <class Tuple>
1575   static GTEST_ADD_REF_(GTEST_TUPLE_ELEMENT_(7, Tuple))
1576   Field(Tuple& t) { return t.f7_; }  // NOLINT
1577
1578   template <class Tuple>
1579   static GTEST_BY_REF_(GTEST_TUPLE_ELEMENT_(7, Tuple))
1580   ConstField(const Tuple& t) { return t.f7_; }
1581 };
1582
1583 template <>
1584 class Get<8> {
1585  public:
1586   template <class Tuple>
1587   static GTEST_ADD_REF_(GTEST_TUPLE_ELEMENT_(8, Tuple))
1588   Field(Tuple& t) { return t.f8_; }  // NOLINT
1589
1590   template <class Tuple>
1591   static GTEST_BY_REF_(GTEST_TUPLE_ELEMENT_(8, Tuple))
1592   ConstField(const Tuple& t) { return t.f8_; }
1593 };
1594
1595 template <>
1596 class Get<9> {
1597  public:
1598   template <class Tuple>
1599   static GTEST_ADD_REF_(GTEST_TUPLE_ELEMENT_(9, Tuple))
1600   Field(Tuple& t) { return t.f9_; }  // NOLINT
1601
1602   template <class Tuple>
1603   static GTEST_BY_REF_(GTEST_TUPLE_ELEMENT_(9, Tuple))
1604   ConstField(const Tuple& t) { return t.f9_; }
1605 };
1606
1607 }  // namespace gtest_internal
1608
1609 template <int k, GTEST_10_TYPENAMES_(T)>
1610 GTEST_ADD_REF_(GTEST_TUPLE_ELEMENT_(k, GTEST_10_TUPLE_(T)))
1611 get(GTEST_10_TUPLE_(T)& t) {
1612   return gtest_internal::Get<k>::Field(t);
1613 }
1614
1615 template <int k, GTEST_10_TYPENAMES_(T)>
1616 GTEST_BY_REF_(GTEST_TUPLE_ELEMENT_(k,  GTEST_10_TUPLE_(T)))
1617 get(const GTEST_10_TUPLE_(T)& t) {
1618   return gtest_internal::Get<k>::ConstField(t);
1619 }
1620
1621 // 6.1.3.5 Relational operators
1622
1623 // We only implement == and !=, as we don't have a need for the rest yet.
1624
1625 namespace gtest_internal {
1626
1627 // SameSizeTuplePrefixComparator<k, k>::Eq(t1, t2) returns true if the
1628 // first k fields of t1 equals the first k fields of t2.
1629 // SameSizeTuplePrefixComparator(k1, k2) would be a compiler error if
1630 // k1 != k2.
1631 template <int kSize1, int kSize2>
1632 struct SameSizeTuplePrefixComparator;
1633
1634 template <>
1635 struct SameSizeTuplePrefixComparator<0, 0> {
1636   template <class Tuple1, class Tuple2>
1637   static bool Eq(const Tuple1& /* t1 */, const Tuple2& /* t2 */) {
1638     return true;
1639   }
1640 };
1641
1642 template <int k>
1643 struct SameSizeTuplePrefixComparator<k, k> {
1644   template <class Tuple1, class Tuple2>
1645   static bool Eq(const Tuple1& t1, const Tuple2& t2) {
1646     return SameSizeTuplePrefixComparator<k - 1, k - 1>::Eq(t1, t2) &&
1647         ::std::tr1::get<k - 1>(t1) == ::std::tr1::get<k - 1>(t2);
1648   }
1649 };
1650
1651 }  // namespace gtest_internal
1652
1653 template <GTEST_10_TYPENAMES_(T), GTEST_10_TYPENAMES_(U)>
1654 inline bool operator==(const GTEST_10_TUPLE_(T)& t,
1655                        const GTEST_10_TUPLE_(U)& u) {
1656   return gtest_internal::SameSizeTuplePrefixComparator<
1657       tuple_size<GTEST_10_TUPLE_(T)>::value,
1658       tuple_size<GTEST_10_TUPLE_(U)>::value>::Eq(t, u);
1659 }
1660
1661 template <GTEST_10_TYPENAMES_(T), GTEST_10_TYPENAMES_(U)>
1662 inline bool operator!=(const GTEST_10_TUPLE_(T)& t,
1663                        const GTEST_10_TUPLE_(U)& u) { return !(t == u); }
1664
1665 // 6.1.4 Pairs.
1666 // Unimplemented.
1667
1668 }  // namespace tr1
1669 }  // namespace std
1670
1671 #undef GTEST_0_TUPLE_
1672 #undef GTEST_1_TUPLE_
1673 #undef GTEST_2_TUPLE_
1674 #undef GTEST_3_TUPLE_
1675 #undef GTEST_4_TUPLE_
1676 #undef GTEST_5_TUPLE_
1677 #undef GTEST_6_TUPLE_
1678 #undef GTEST_7_TUPLE_
1679 #undef GTEST_8_TUPLE_
1680 #undef GTEST_9_TUPLE_
1681 #undef GTEST_10_TUPLE_
1682
1683 #undef GTEST_0_TYPENAMES_
1684 #undef GTEST_1_TYPENAMES_
1685 #undef GTEST_2_TYPENAMES_
1686 #undef GTEST_3_TYPENAMES_
1687 #undef GTEST_4_TYPENAMES_
1688 #undef GTEST_5_TYPENAMES_
1689 #undef GTEST_6_TYPENAMES_
1690 #undef GTEST_7_TYPENAMES_
1691 #undef GTEST_8_TYPENAMES_
1692 #undef GTEST_9_TYPENAMES_
1693 #undef GTEST_10_TYPENAMES_
1694
1695 #undef GTEST_DECLARE_TUPLE_AS_FRIEND_
1696 #undef GTEST_BY_REF_
1697 #undef GTEST_ADD_REF_
1698 #undef GTEST_TUPLE_ELEMENT_
1699
1700 #endif  // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_TUPLE_H_
1701 # elif GTEST_ENV_HAS_STD_TUPLE_
1702 #  include <tuple>
1703 // C++11 puts its tuple into the ::std namespace rather than
1704 // ::std::tr1.  gtest expects tuple to live in ::std::tr1, so put it there.
1705 // This causes undefined behavior, but supported compilers react in
1706 // the way we intend.
1707 namespace std {
1708 namespace tr1 {
1709 using ::std::get;
1710 using ::std::make_tuple;
1711 using ::std::tuple;
1712 using ::std::tuple_element;
1713 using ::std::tuple_size;
1714 }
1715 }
1716
1717 # elif GTEST_OS_SYMBIAN
1718
1719 // On Symbian, BOOST_HAS_TR1_TUPLE causes Boost's TR1 tuple library to
1720 // use STLport's tuple implementation, which unfortunately doesn't
1721 // work as the copy of STLport distributed with Symbian is incomplete.
1722 // By making sure BOOST_HAS_TR1_TUPLE is undefined, we force Boost to
1723 // use its own tuple implementation.
1724 #  ifdef BOOST_HAS_TR1_TUPLE
1725 #   undef BOOST_HAS_TR1_TUPLE
1726 #  endif  // BOOST_HAS_TR1_TUPLE
1727
1728 // This prevents <boost/tr1/detail/config.hpp>, which defines
1729 // BOOST_HAS_TR1_TUPLE, from being #included by Boost's <tuple>.
1730 #  define BOOST_TR1_DETAIL_CONFIG_HPP_INCLUDED
1731 #  include <tuple>
1732
1733 # elif defined(__GNUC__) && (GTEST_GCC_VER_ >= 40000)
1734 // GCC 4.0+ implements tr1/tuple in the <tr1/tuple> header.  This does
1735 // not conform to the TR1 spec, which requires the header to be <tuple>.
1736
1737 #  if !GTEST_HAS_RTTI && GTEST_GCC_VER_ < 40302
1738 // Until version 4.3.2, gcc has a bug that causes <tr1/functional>,
1739 // which is #included by <tr1/tuple>, to not compile when RTTI is
1740 // disabled.  _TR1_FUNCTIONAL is the header guard for
1741 // <tr1/functional>.  Hence the following #define is a hack to prevent
1742 // <tr1/functional> from being included.
1743 #   define _TR1_FUNCTIONAL 1
1744 #   include <tr1/tuple>
1745 #   undef _TR1_FUNCTIONAL  // Allows the user to #include
1746                         // <tr1/functional> if he chooses to.
1747 #  else
1748 #   include <tr1/tuple>  // NOLINT
1749 #  endif  // !GTEST_HAS_RTTI && GTEST_GCC_VER_ < 40302
1750
1751 # else
1752 // If the compiler is not GCC 4.0+, we assume the user is using a
1753 // spec-conforming TR1 implementation.
1754 #  include <tuple>  // NOLINT
1755 # endif  // GTEST_USE_OWN_TR1_TUPLE
1756
1757 #endif  // GTEST_HAS_TR1_TUPLE
1758
1759 // Determines whether clone(2) is supported.
1760 // Usually it will only be available on Linux, excluding
1761 // Linux on the Itanium architecture.
1762 // Also see http://linux.die.net/man/2/clone.
1763 #ifndef GTEST_HAS_CLONE
1764 // The user didn't tell us, so we need to figure it out.
1765
1766 # if GTEST_OS_LINUX && !defined(__ia64__)
1767 #  if GTEST_OS_LINUX_ANDROID
1768 // On Android, clone() is only available on ARM starting with Gingerbread.
1769 #    if (defined(__arm__) || defined(__mips__)) && __ANDROID_API__ >= 9
1770 #     define GTEST_HAS_CLONE 1
1771 #    else
1772 #     define GTEST_HAS_CLONE 0
1773 #    endif
1774 #  else
1775 #  define GTEST_HAS_CLONE 1
1776 #  endif
1777 # else
1778 #  define GTEST_HAS_CLONE 0
1779 # endif  // GTEST_OS_LINUX && !defined(__ia64__)
1780
1781 #endif  // GTEST_HAS_CLONE
1782
1783 // Determines whether to support stream redirection. This is used to test
1784 // output correctness and to implement death tests.
1785 #ifndef GTEST_HAS_STREAM_REDIRECTION
1786 // By default, we assume that stream redirection is supported on all
1787 // platforms except known mobile ones.
1788 # if GTEST_OS_WINDOWS_MOBILE || GTEST_OS_SYMBIAN
1789 #  define GTEST_HAS_STREAM_REDIRECTION 0
1790 # else
1791 #  define GTEST_HAS_STREAM_REDIRECTION 1
1792 # endif  // !GTEST_OS_WINDOWS_MOBILE && !GTEST_OS_SYMBIAN
1793 #endif  // GTEST_HAS_STREAM_REDIRECTION
1794
1795 // Determines whether to support death tests.
1796 // Google Test does not support death tests for VC 7.1 and earlier as
1797 // abort() in a VC 7.1 application compiled as GUI in debug config
1798 // pops up a dialog window that cannot be suppressed programmatically.
1799 #if (GTEST_OS_LINUX || GTEST_OS_CYGWIN || GTEST_OS_SOLARIS || \
1800      (GTEST_OS_MAC && !GTEST_OS_IOS) || GTEST_OS_IOS_SIMULATOR || \
1801      (GTEST_OS_WINDOWS_DESKTOP && _MSC_VER >= 1400) || \
1802      GTEST_OS_WINDOWS_MINGW || GTEST_OS_AIX || GTEST_OS_HPUX || \
1803      GTEST_OS_OPENBSD || GTEST_OS_QNX)
1804 # define GTEST_HAS_DEATH_TEST 1
1805 # include <vector>  // NOLINT
1806 #else
1807 # define GTEST_HAS_DEATH_TEST 0
1808 #endif
1809
1810 // We don't support MSVC 7.1 with exceptions disabled now.  Therefore
1811 // all the compilers we care about are adequate for supporting
1812 // value-parameterized tests.
1813 #define GTEST_HAS_PARAM_TEST 1
1814
1815 // Determines whether to support type-driven tests.
1816
1817 // Typed tests need <typeinfo> and variadic macros, which GCC, VC++ 8.0,
1818 // Sun Pro CC, IBM Visual Age, and HP aCC support.
1819 #if defined(__GNUC__) || (_MSC_VER >= 1400) || defined(__SUNPRO_CC) || \
1820     defined(__IBMCPP__) || defined(__HP_aCC)
1821 # define GTEST_HAS_TYPED_TEST 1
1822 # define GTEST_HAS_TYPED_TEST_P 1
1823 #endif
1824
1825 // Determines whether to support Combine(). This only makes sense when
1826 // value-parameterized tests are enabled.  The implementation doesn't
1827 // work on Sun Studio since it doesn't understand templated conversion
1828 // operators.
1829 #if GTEST_HAS_PARAM_TEST && GTEST_HAS_TR1_TUPLE && !defined(__SUNPRO_CC)
1830 # define GTEST_HAS_COMBINE 1
1831 #endif
1832
1833 // Determines whether the system compiler uses UTF-16 for encoding wide strings.
1834 #define GTEST_WIDE_STRING_USES_UTF16_ \
1835     (GTEST_OS_WINDOWS || GTEST_OS_CYGWIN || GTEST_OS_SYMBIAN || GTEST_OS_AIX)
1836
1837 // Determines whether test results can be streamed to a socket.
1838 #if GTEST_OS_LINUX
1839 # define GTEST_CAN_STREAM_RESULTS_ 1
1840 #else
1841 # define GTEST_CAN_STREAM_RESULTS_ 0
1842 #endif
1843
1844 // Defines some utility macros.
1845
1846 // The GNU compiler emits a warning if nested "if" statements are followed by
1847 // an "else" statement and braces are not used to explicitly disambiguate the
1848 // "else" binding.  This leads to problems with code like:
1849 //
1850 //   if (gate)
1851 //     ASSERT_*(condition) << "Some message";
1852 //
1853 // The "switch (0) case 0:" idiom is used to suppress this.
1854 #ifdef __INTEL_COMPILER
1855 # define GTEST_AMBIGUOUS_ELSE_BLOCKER_
1856 #else
1857 # define GTEST_AMBIGUOUS_ELSE_BLOCKER_ switch (0) case 0: default:  // NOLINT
1858 #endif
1859
1860 // Use this annotation at the end of a struct/class definition to
1861 // prevent the compiler from optimizing away instances that are never
1862 // used.  This is useful when all interesting logic happens inside the
1863 // c'tor and / or d'tor.  Example:
1864 //
1865 //   struct Foo {
1866 //     Foo() { ... }
1867 //   } GTEST_ATTRIBUTE_UNUSED_;
1868 //
1869 // Also use it after a variable or parameter declaration to tell the
1870 // compiler the variable/parameter does not have to be used.
1871 #if defined(__GNUC__) && !defined(COMPILER_ICC)
1872 # define GTEST_ATTRIBUTE_UNUSED_ __attribute__ ((unused))
1873 #else
1874 # define GTEST_ATTRIBUTE_UNUSED_
1875 #endif
1876
1877 // A macro to disallow operator=
1878 // This should be used in the private: declarations for a class.
1879 #define GTEST_DISALLOW_ASSIGN_(type)\
1880   void operator=(type const &)
1881
1882 // A macro to disallow copy constructor and operator=
1883 // This should be used in the private: declarations for a class.
1884 #define GTEST_DISALLOW_COPY_AND_ASSIGN_(type)\
1885   type(type const &);\
1886   GTEST_DISALLOW_ASSIGN_(type)
1887
1888 // Tell the compiler to warn about unused return values for functions declared
1889 // with this macro.  The macro should be used on function declarations
1890 // following the argument list:
1891 //
1892 //   Sprocket* AllocateSprocket() GTEST_MUST_USE_RESULT_;
1893 #if defined(__GNUC__) && (GTEST_GCC_VER_ >= 30400) && !defined(COMPILER_ICC)
1894 # define GTEST_MUST_USE_RESULT_ __attribute__ ((warn_unused_result))
1895 #else
1896 # define GTEST_MUST_USE_RESULT_
1897 #endif  // __GNUC__ && (GTEST_GCC_VER_ >= 30400) && !COMPILER_ICC
1898
1899 // Determine whether the compiler supports Microsoft's Structured Exception
1900 // Handling.  This is supported by several Windows compilers but generally
1901 // does not exist on any other system.
1902 #ifndef GTEST_HAS_SEH
1903 // The user didn't tell us, so we need to figure it out.
1904
1905 # if defined(_MSC_VER) || defined(__BORLANDC__)
1906 // These two compilers are known to support SEH.
1907 #  define GTEST_HAS_SEH 1
1908 # else
1909 // Assume no SEH.
1910 #  define GTEST_HAS_SEH 0
1911 # endif
1912
1913 #endif  // GTEST_HAS_SEH
1914
1915 #ifdef _MSC_VER
1916
1917 # if GTEST_LINKED_AS_SHARED_LIBRARY
1918 #  define GTEST_API_ __declspec(dllimport)
1919 # elif GTEST_CREATE_SHARED_LIBRARY
1920 #  define GTEST_API_ __declspec(dllexport)
1921 # endif
1922
1923 #endif  // _MSC_VER
1924
1925 #ifndef GTEST_API_
1926 # define GTEST_API_
1927 #endif
1928
1929 #ifdef __GNUC__
1930 // Ask the compiler to never inline a given function.
1931 # define GTEST_NO_INLINE_ __attribute__((noinline))
1932 #else
1933 # define GTEST_NO_INLINE_
1934 #endif
1935
1936 // _LIBCPP_VERSION is defined by the libc++ library from the LLVM project.
1937 #if defined(__GLIBCXX__) || defined(_LIBCPP_VERSION)
1938 # define GTEST_HAS_CXXABI_H_ 1
1939 #else
1940 # define GTEST_HAS_CXXABI_H_ 0
1941 #endif
1942
1943 namespace testing {
1944
1945 class Message;
1946
1947 namespace internal {
1948
1949 // A secret type that Google Test users don't know about.  It has no
1950 // definition on purpose.  Therefore it's impossible to create a
1951 // Secret object, which is what we want.
1952 class Secret;
1953
1954 // The GTEST_COMPILE_ASSERT_ macro can be used to verify that a compile time
1955 // expression is true. For example, you could use it to verify the
1956 // size of a static array:
1957 //
1958 //   GTEST_COMPILE_ASSERT_(ARRAYSIZE(content_type_names) == CONTENT_NUM_TYPES,
1959 //                         content_type_names_incorrect_size);
1960 //
1961 // or to make sure a struct is smaller than a certain size:
1962 //
1963 //   GTEST_COMPILE_ASSERT_(sizeof(foo) < 128, foo_too_large);
1964 //
1965 // The second argument to the macro is the name of the variable. If
1966 // the expression is false, most compilers will issue a warning/error
1967 // containing the name of the variable.
1968
1969 template <bool>
1970 struct CompileAssert {
1971 };
1972
1973 #define GTEST_COMPILE_ASSERT_(expr, msg) \
1974   typedef ::testing::internal::CompileAssert<(static_cast<bool>(expr))> \
1975       msg[static_cast<bool>(expr) ? 1 : -1] GTEST_ATTRIBUTE_UNUSED_
1976
1977 // Implementation details of GTEST_COMPILE_ASSERT_:
1978 //
1979 // - GTEST_COMPILE_ASSERT_ works by defining an array type that has -1
1980 //   elements (and thus is invalid) when the expression is false.
1981 //
1982 // - The simpler definition
1983 //
1984 //    #define GTEST_COMPILE_ASSERT_(expr, msg) typedef char msg[(expr) ? 1 : -1]
1985 //
1986 //   does not work, as gcc supports variable-length arrays whose sizes
1987 //   are determined at run-time (this is gcc's extension and not part
1988 //   of the C++ standard).  As a result, gcc fails to reject the
1989 //   following code with the simple definition:
1990 //
1991 //     int foo;
1992 //     GTEST_COMPILE_ASSERT_(foo, msg); // not supposed to compile as foo is
1993 //                                      // not a compile-time constant.
1994 //
1995 // - By using the type CompileAssert<(bool(expr))>, we ensures that
1996 //   expr is a compile-time constant.  (Template arguments must be
1997 //   determined at compile-time.)
1998 //
1999 // - The outter parentheses in CompileAssert<(bool(expr))> are necessary
2000 //   to work around a bug in gcc 3.4.4 and 4.0.1.  If we had written
2001 //
2002 //     CompileAssert<bool(expr)>
2003 //
2004 //   instead, these compilers will refuse to compile
2005 //
2006 //     GTEST_COMPILE_ASSERT_(5 > 0, some_message);
2007 //
2008 //   (They seem to think the ">" in "5 > 0" marks the end of the
2009 //   template argument list.)
2010 //
2011 // - The array size is (bool(expr) ? 1 : -1), instead of simply
2012 //
2013 //     ((expr) ? 1 : -1).
2014 //
2015 //   This is to avoid running into a bug in MS VC 7.1, which
2016 //   causes ((0.0) ? 1 : -1) to incorrectly evaluate to 1.
2017
2018 // StaticAssertTypeEqHelper is used by StaticAssertTypeEq defined in gtest.h.
2019 //
2020 // This template is declared, but intentionally undefined.
2021 template <typename T1, typename T2>
2022 struct StaticAssertTypeEqHelper;
2023
2024 template <typename T>
2025 struct StaticAssertTypeEqHelper<T, T> {};
2026
2027 #if GTEST_HAS_GLOBAL_STRING
2028 typedef ::string string;
2029 #else
2030 typedef ::std::string string;
2031 #endif  // GTEST_HAS_GLOBAL_STRING
2032
2033 #if GTEST_HAS_GLOBAL_WSTRING
2034 typedef ::wstring wstring;
2035 #elif GTEST_HAS_STD_WSTRING
2036 typedef ::std::wstring wstring;
2037 #endif  // GTEST_HAS_GLOBAL_WSTRING
2038
2039 // A helper for suppressing warnings on constant condition.  It just
2040 // returns 'condition'.
2041 GTEST_API_ bool IsTrue(bool condition);
2042
2043 // Defines scoped_ptr.
2044
2045 // This implementation of scoped_ptr is PARTIAL - it only contains
2046 // enough stuff to satisfy Google Test's need.
2047 template <typename T>
2048 class scoped_ptr {
2049  public:
2050   typedef T element_type;
2051
2052   explicit scoped_ptr(T* p = NULL) : ptr_(p) {}
2053   ~scoped_ptr() { reset(); }
2054
2055   T& operator*() const { return *ptr_; }
2056   T* operator->() const { return ptr_; }
2057   T* get() const { return ptr_; }
2058
2059   T* release() {
2060     T* const ptr = ptr_;
2061     ptr_ = NULL;
2062     return ptr;
2063   }
2064
2065   void reset(T* p = NULL) {
2066     if (p != ptr_) {
2067       if (IsTrue(sizeof(T) > 0)) {  // Makes sure T is a complete type.
2068         delete ptr_;
2069       }
2070       ptr_ = p;
2071     }
2072   }
2073
2074  private:
2075   T* ptr_;
2076
2077   GTEST_DISALLOW_COPY_AND_ASSIGN_(scoped_ptr);
2078 };
2079
2080 // Defines RE.
2081
2082 // A simple C++ wrapper for <regex.h>.  It uses the POSIX Extended
2083 // Regular Expression syntax.
2084 class GTEST_API_ RE {
2085  public:
2086   // A copy constructor is required by the Standard to initialize object
2087   // references from r-values.
2088   RE(const RE& other) { Init(other.pattern()); }
2089
2090   // Constructs an RE from a string.
2091   RE(const ::std::string& regex) { Init(regex.c_str()); }  // NOLINT
2092
2093 #if GTEST_HAS_GLOBAL_STRING
2094
2095   RE(const ::string& regex) { Init(regex.c_str()); }  // NOLINT
2096
2097 #endif  // GTEST_HAS_GLOBAL_STRING
2098
2099   RE(const char* regex) { Init(regex); }  // NOLINT
2100   ~RE();
2101
2102   // Returns the string representation of the regex.
2103   const char* pattern() const { return pattern_; }
2104
2105   // FullMatch(str, re) returns true iff regular expression re matches
2106   // the entire str.
2107   // PartialMatch(str, re) returns true iff regular expression re
2108   // matches a substring of str (including str itself).
2109   //
2110   // TODO(wan@google.com): make FullMatch() and PartialMatch() work
2111   // when str contains NUL characters.
2112   static bool FullMatch(const ::std::string& str, const RE& re) {
2113     return FullMatch(str.c_str(), re);
2114   }
2115   static bool PartialMatch(const ::std::string& str, const RE& re) {
2116     return PartialMatch(str.c_str(), re);
2117   }
2118
2119 #if GTEST_HAS_GLOBAL_STRING
2120
2121   static bool FullMatch(const ::string& str, const RE& re) {
2122     return FullMatch(str.c_str(), re);
2123   }
2124   static bool PartialMatch(const ::string& str, const RE& re) {
2125     return PartialMatch(str.c_str(), re);
2126   }
2127
2128 #endif  // GTEST_HAS_GLOBAL_STRING
2129
2130   static bool FullMatch(const char* str, const RE& re);
2131   static bool PartialMatch(const char* str, const RE& re);
2132
2133  private:
2134   void Init(const char* regex);
2135
2136   // We use a const char* instead of an std::string, as Google Test used to be
2137   // used where std::string is not available.  TODO(wan@google.com): change to
2138   // std::string.
2139   const char* pattern_;
2140   bool is_valid_;
2141
2142 #if GTEST_USES_POSIX_RE
2143
2144   regex_t full_regex_;     // For FullMatch().
2145   regex_t partial_regex_;  // For PartialMatch().
2146
2147 #else  // GTEST_USES_SIMPLE_RE
2148
2149   const char* full_pattern_;  // For FullMatch();
2150
2151 #endif
2152
2153   GTEST_DISALLOW_ASSIGN_(RE);
2154 };
2155
2156 // Formats a source file path and a line number as they would appear
2157 // in an error message from the compiler used to compile this code.
2158 GTEST_API_ ::std::string FormatFileLocation(const char* file, int line);
2159
2160 // Formats a file location for compiler-independent XML output.
2161 // Although this function is not platform dependent, we put it next to
2162 // FormatFileLocation in order to contrast the two functions.
2163 GTEST_API_ ::std::string FormatCompilerIndependentFileLocation(const char* file,
2164                                                                int line);
2165
2166 // Defines logging utilities:
2167 //   GTEST_LOG_(severity) - logs messages at the specified severity level. The
2168 //                          message itself is streamed into the macro.
2169 //   LogToStderr()  - directs all log messages to stderr.
2170 //   FlushInfoLog() - flushes informational log messages.
2171
2172 enum GTestLogSeverity {
2173   GTEST_INFO,
2174   GTEST_WARNING,
2175   GTEST_ERROR,
2176   GTEST_FATAL
2177 };
2178
2179 // Formats log entry severity, provides a stream object for streaming the
2180 // log message, and terminates the message with a newline when going out of
2181 // scope.
2182 class GTEST_API_ GTestLog {
2183  public:
2184   GTestLog(GTestLogSeverity severity, const char* file, int line);
2185
2186   // Flushes the buffers and, if severity is GTEST_FATAL, aborts the program.
2187   ~GTestLog();
2188
2189   ::std::ostream& GetStream() { return ::std::cerr; }
2190
2191  private:
2192   const GTestLogSeverity severity_;
2193
2194   GTEST_DISALLOW_COPY_AND_ASSIGN_(GTestLog);
2195 };
2196
2197 #define GTEST_LOG_(severity) \
2198     ::testing::internal::GTestLog(::testing::internal::GTEST_##severity, \
2199                                   __FILE__, __LINE__).GetStream()
2200
2201 inline void LogToStderr() {}
2202 inline void FlushInfoLog() { fflush(NULL); }
2203
2204 // INTERNAL IMPLEMENTATION - DO NOT USE.
2205 //
2206 // GTEST_CHECK_ is an all-mode assert. It aborts the program if the condition
2207 // is not satisfied.
2208 //  Synopsys:
2209 //    GTEST_CHECK_(boolean_condition);
2210 //     or
2211 //    GTEST_CHECK_(boolean_condition) << "Additional message";
2212 //
2213 //    This checks the condition and if the condition is not satisfied
2214 //    it prints message about the condition violation, including the
2215 //    condition itself, plus additional message streamed into it, if any,
2216 //    and then it aborts the program. It aborts the program irrespective of
2217 //    whether it is built in the debug mode or not.
2218 #define GTEST_CHECK_(condition) \
2219     GTEST_AMBIGUOUS_ELSE_BLOCKER_ \
2220     if (::testing::internal::IsTrue(condition)) \
2221       ; \
2222     else \
2223       GTEST_LOG_(FATAL) << "Condition " #condition " failed. "
2224
2225 // An all-mode assert to verify that the given POSIX-style function
2226 // call returns 0 (indicating success).  Known limitation: this
2227 // doesn't expand to a balanced 'if' statement, so enclose the macro
2228 // in {} if you need to use it as the only statement in an 'if'
2229 // branch.
2230 #define GTEST_CHECK_POSIX_SUCCESS_(posix_call) \
2231   if (const int gtest_error = (posix_call)) \
2232     GTEST_LOG_(FATAL) << #posix_call << "failed with error " \
2233                       << gtest_error
2234
2235 // INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.
2236 //
2237 // Use ImplicitCast_ as a safe version of static_cast for upcasting in
2238 // the type hierarchy (e.g. casting a Foo* to a SuperclassOfFoo* or a
2239 // const Foo*).  When you use ImplicitCast_, the compiler checks that
2240 // the cast is safe.  Such explicit ImplicitCast_s are necessary in
2241 // surprisingly many situations where C++ demands an exact type match
2242 // instead of an argument type convertable to a target type.
2243 //
2244 // The syntax for using ImplicitCast_ is the same as for static_cast:
2245 //
2246 //   ImplicitCast_<ToType>(expr)
2247 //
2248 // ImplicitCast_ would have been part of the C++ standard library,
2249 // but the proposal was submitted too late.  It will probably make
2250 // its way into the language in the future.
2251 //
2252 // This relatively ugly name is intentional. It prevents clashes with
2253 // similar functions users may have (e.g., implicit_cast). The internal
2254 // namespace alone is not enough because the function can be found by ADL.
2255 template<typename To>
2256 inline To ImplicitCast_(To x) { return x; }
2257
2258 // When you upcast (that is, cast a pointer from type Foo to type
2259 // SuperclassOfFoo), it's fine to use ImplicitCast_<>, since upcasts
2260 // always succeed.  When you downcast (that is, cast a pointer from
2261 // type Foo to type SubclassOfFoo), static_cast<> isn't safe, because
2262 // how do you know the pointer is really of type SubclassOfFoo?  It
2263 // could be a bare Foo, or of type DifferentSubclassOfFoo.  Thus,
2264 // when you downcast, you should use this macro.  In debug mode, we
2265 // use dynamic_cast<> to double-check the downcast is legal (we die
2266 // if it's not).  In normal mode, we do the efficient static_cast<>
2267 // instead.  Thus, it's important to test in debug mode to make sure
2268 // the cast is legal!
2269 //    This is the only place in the code we should use dynamic_cast<>.
2270 // In particular, you SHOULDN'T be using dynamic_cast<> in order to
2271 // do RTTI (eg code like this:
2272 //    if (dynamic_cast<Subclass1>(foo)) HandleASubclass1Object(foo);
2273 //    if (dynamic_cast<Subclass2>(foo)) HandleASubclass2Object(foo);
2274 // You should design the code some other way not to need this.
2275 //
2276 // This relatively ugly name is intentional. It prevents clashes with
2277 // similar functions users may have (e.g., down_cast). The internal
2278 // namespace alone is not enough because the function can be found by ADL.
2279 template<typename To, typename From>  // use like this: DownCast_<T*>(foo);
2280 inline To DownCast_(From* f) {  // so we only accept pointers
2281   // Ensures that To is a sub-type of From *.  This test is here only
2282   // for compile-time type checking, and has no overhead in an
2283   // optimized build at run-time, as it will be optimized away
2284   // completely.
2285   if (false) {
2286     const To to = NULL;
2287     ::testing::internal::ImplicitCast_<From*>(to);
2288   }
2289
2290 #if GTEST_HAS_RTTI
2291   // RTTI: debug mode only!
2292   GTEST_CHECK_(f == NULL || dynamic_cast<To>(f) != NULL);
2293 #endif
2294   return static_cast<To>(f);
2295 }
2296
2297 // Downcasts the pointer of type Base to Derived.
2298 // Derived must be a subclass of Base. The parameter MUST
2299 // point to a class of type Derived, not any subclass of it.
2300 // When RTTI is available, the function performs a runtime
2301 // check to enforce this.
2302 template <class Derived, class Base>
2303 Derived* CheckedDowncastToActualType(Base* base) {
2304 #if GTEST_HAS_RTTI
2305   GTEST_CHECK_(typeid(*base) == typeid(Derived));
2306   return dynamic_cast<Derived*>(base);  // NOLINT
2307 #else
2308   return static_cast<Derived*>(base);  // Poor man's downcast.
2309 #endif
2310 }
2311
2312 #if GTEST_HAS_STREAM_REDIRECTION
2313
2314 // Defines the stderr capturer:
2315 //   CaptureStdout     - starts capturing stdout.
2316 //   GetCapturedStdout - stops capturing stdout and returns the captured string.
2317 //   CaptureStderr     - starts capturing stderr.
2318 //   GetCapturedStderr - stops capturing stderr and returns the captured string.
2319 //
2320 GTEST_API_ void CaptureStdout();
2321 GTEST_API_ std::string GetCapturedStdout();
2322 GTEST_API_ void CaptureStderr();
2323 GTEST_API_ std::string GetCapturedStderr();
2324
2325 #endif  // GTEST_HAS_STREAM_REDIRECTION
2326
2327
2328 #if GTEST_HAS_DEATH_TEST
2329
2330 const ::std::vector<testing::internal::string>& GetInjectableArgvs();
2331 void SetInjectableArgvs(const ::std::vector<testing::internal::string>*
2332                              new_argvs);
2333
2334 // A copy of all command line arguments.  Set by InitGoogleTest().
2335 extern ::std::vector<testing::internal::string> g_argvs;
2336
2337 #endif  // GTEST_HAS_DEATH_TEST
2338
2339 // Defines synchronization primitives.
2340
2341 #if GTEST_HAS_PTHREAD
2342
2343 // Sleeps for (roughly) n milli-seconds.  This function is only for
2344 // testing Google Test's own constructs.  Don't use it in user tests,
2345 // either directly or indirectly.
2346 inline void SleepMilliseconds(int n) {
2347   const timespec time = {
2348     0,                  // 0 seconds.
2349     n * 1000L * 1000L,  // And n ms.
2350   };
2351   nanosleep(&time, NULL);
2352 }
2353
2354 // Allows a controller thread to pause execution of newly created
2355 // threads until notified.  Instances of this class must be created
2356 // and destroyed in the controller thread.
2357 //
2358 // This class is only for testing Google Test's own constructs. Do not
2359 // use it in user tests, either directly or indirectly.
2360 class Notification {
2361  public:
2362   Notification() : notified_(false) {
2363     GTEST_CHECK_POSIX_SUCCESS_(pthread_mutex_init(&mutex_, NULL));
2364   }
2365   ~Notification() {
2366     pthread_mutex_destroy(&mutex_);
2367   }
2368
2369   // Notifies all threads created with this notification to start. Must
2370   // be called from the controller thread.
2371   void Notify() {
2372     pthread_mutex_lock(&mutex_);
2373     notified_ = true;
2374     pthread_mutex_unlock(&mutex_);
2375   }
2376
2377   // Blocks until the controller thread notifies. Must be called from a test
2378   // thread.
2379   void WaitForNotification() {
2380     for (;;) {
2381       pthread_mutex_lock(&mutex_);
2382       const bool notified = notified_;
2383       pthread_mutex_unlock(&mutex_);
2384       if (notified)
2385         break;
2386       SleepMilliseconds(10);
2387     }
2388   }
2389
2390  private:
2391   pthread_mutex_t mutex_;
2392   bool notified_;
2393
2394   GTEST_DISALLOW_COPY_AND_ASSIGN_(Notification);
2395 };
2396
2397 // As a C-function, ThreadFuncWithCLinkage cannot be templated itself.
2398 // Consequently, it cannot select a correct instantiation of ThreadWithParam
2399 // in order to call its Run(). Introducing ThreadWithParamBase as a
2400 // non-templated base class for ThreadWithParam allows us to bypass this
2401 // problem.
2402 class ThreadWithParamBase {
2403  public:
2404   virtual ~ThreadWithParamBase() {}
2405   virtual void Run() = 0;
2406 };
2407
2408 // pthread_create() accepts a pointer to a function type with the C linkage.
2409 // According to the Standard (7.5/1), function types with different linkages
2410 // are different even if they are otherwise identical.  Some compilers (for
2411 // example, SunStudio) treat them as different types.  Since class methods
2412 // cannot be defined with C-linkage we need to define a free C-function to
2413 // pass into pthread_create().
2414 extern "C" inline void* ThreadFuncWithCLinkage(void* thread) {
2415   static_cast<ThreadWithParamBase*>(thread)->Run();
2416   return NULL;
2417 }
2418
2419 // Helper class for testing Google Test's multi-threading constructs.
2420 // To use it, write:
2421 //
2422 //   void ThreadFunc(int param) { /* Do things with param */ }
2423 //   Notification thread_can_start;
2424 //   ...
2425 //   // The thread_can_start parameter is optional; you can supply NULL.
2426 //   ThreadWithParam<int> thread(&ThreadFunc, 5, &thread_can_start);
2427 //   thread_can_start.Notify();
2428 //
2429 // These classes are only for testing Google Test's own constructs. Do
2430 // not use them in user tests, either directly or indirectly.
2431 template <typename T>
2432 class ThreadWithParam : public ThreadWithParamBase {
2433  public:
2434   typedef void (*UserThreadFunc)(T);
2435
2436   ThreadWithParam(
2437       UserThreadFunc func, T param, Notification* thread_can_start)
2438       : func_(func),
2439         param_(param),
2440         thread_can_start_(thread_can_start),
2441         finished_(false) {
2442     ThreadWithParamBase* const base = this;
2443     // The thread can be created only after all fields except thread_
2444     // have been initialized.
2445     GTEST_CHECK_POSIX_SUCCESS_(
2446         pthread_create(&thread_, 0, &ThreadFuncWithCLinkage, base));
2447   }
2448   ~ThreadWithParam() { Join(); }
2449
2450   void Join() {
2451     if (!finished_) {
2452       GTEST_CHECK_POSIX_SUCCESS_(pthread_join(thread_, 0));
2453       finished_ = true;
2454     }
2455   }
2456
2457   virtual void Run() {
2458     if (thread_can_start_ != NULL)
2459       thread_can_start_->WaitForNotification();
2460     func_(param_);
2461   }
2462
2463  private:
2464   const UserThreadFunc func_;  // User-supplied thread function.
2465   const T param_;  // User-supplied parameter to the thread function.
2466   // When non-NULL, used to block execution until the controller thread
2467   // notifies.
2468   Notification* const thread_can_start_;
2469   bool finished_;  // true iff we know that the thread function has finished.
2470   pthread_t thread_;  // The native thread object.
2471
2472   GTEST_DISALLOW_COPY_AND_ASSIGN_(ThreadWithParam);
2473 };
2474
2475 // MutexBase and Mutex implement mutex on pthreads-based platforms. They
2476 // are used in conjunction with class MutexLock:
2477 //
2478 //   Mutex mutex;
2479 //   ...
2480 //   MutexLock lock(&mutex);  // Acquires the mutex and releases it at the end
2481 //                            // of the current scope.
2482 //
2483 // MutexBase implements behavior for both statically and dynamically
2484 // allocated mutexes.  Do not use MutexBase directly.  Instead, write
2485 // the following to define a static mutex:
2486 //
2487 //   GTEST_DEFINE_STATIC_MUTEX_(g_some_mutex);
2488 //
2489 // You can forward declare a static mutex like this:
2490 //
2491 //   GTEST_DECLARE_STATIC_MUTEX_(g_some_mutex);
2492 //
2493 // To create a dynamic mutex, just define an object of type Mutex.
2494 class MutexBase {
2495  public:
2496   // Acquires this mutex.
2497   void Lock() {
2498     GTEST_CHECK_POSIX_SUCCESS_(pthread_mutex_lock(&mutex_));
2499     owner_ = pthread_self();
2500     has_owner_ = true;
2501   }
2502
2503   // Releases this mutex.
2504   void Unlock() {
2505     // Since the lock is being released the owner_ field should no longer be
2506     // considered valid. We don't protect writing to has_owner_ here, as it's
2507     // the caller's responsibility to ensure that the current thread holds the
2508     // mutex when this is called.
2509     has_owner_ = false;
2510     GTEST_CHECK_POSIX_SUCCESS_(pthread_mutex_unlock(&mutex_));
2511   }
2512
2513   // Does nothing if the current thread holds the mutex. Otherwise, crashes
2514   // with high probability.
2515   void AssertHeld() const {
2516     GTEST_CHECK_(has_owner_ && pthread_equal(owner_, pthread_self()))
2517         << "The current thread is not holding the mutex @" << this;
2518   }
2519
2520   // A static mutex may be used before main() is entered.  It may even
2521   // be used before the dynamic initialization stage.  Therefore we
2522   // must be able to initialize a static mutex object at link time.
2523   // This means MutexBase has to be a POD and its member variables
2524   // have to be public.
2525  public:
2526   pthread_mutex_t mutex_;  // The underlying pthread mutex.
2527   // has_owner_ indicates whether the owner_ field below contains a valid thread
2528   // ID and is therefore safe to inspect (e.g., to use in pthread_equal()). All
2529   // accesses to the owner_ field should be protected by a check of this field.
2530   // An alternative might be to memset() owner_ to all zeros, but there's no
2531   // guarantee that a zero'd pthread_t is necessarily invalid or even different
2532   // from pthread_self().
2533   bool has_owner_;
2534   pthread_t owner_;  // The thread holding the mutex.
2535 };
2536
2537 // Forward-declares a static mutex.
2538 # define GTEST_DECLARE_STATIC_MUTEX_(mutex) \
2539     extern ::testing::internal::MutexBase mutex
2540
2541 // Defines and statically (i.e. at link time) initializes a static mutex.
2542 // The initialization list here does not explicitly initialize each field,
2543 // instead relying on default initialization for the unspecified fields. In
2544 // particular, the owner_ field (a pthread_t) is not explicitly initialized.
2545 // This allows initialization to work whether pthread_t is a scalar or struct.
2546 // The flag -Wmissing-field-initializers must not be specified for this to work.
2547 # define GTEST_DEFINE_STATIC_MUTEX_(mutex) \
2548     ::testing::internal::MutexBase mutex = { PTHREAD_MUTEX_INITIALIZER, false }
2549
2550 // The Mutex class can only be used for mutexes created at runtime. It
2551 // shares its API with MutexBase otherwise.
2552 class Mutex : public MutexBase {
2553  public:
2554   Mutex() {
2555     GTEST_CHECK_POSIX_SUCCESS_(pthread_mutex_init(&mutex_, NULL));
2556     has_owner_ = false;
2557   }
2558   ~Mutex() {
2559     GTEST_CHECK_POSIX_SUCCESS_(pthread_mutex_destroy(&mutex_));
2560   }
2561
2562  private:
2563   GTEST_DISALLOW_COPY_AND_ASSIGN_(Mutex);
2564 };
2565
2566 // We cannot name this class MutexLock as the ctor declaration would
2567 // conflict with a macro named MutexLock, which is defined on some
2568 // platforms.  Hence the typedef trick below.
2569 class GTestMutexLock {
2570  public:
2571   explicit GTestMutexLock(MutexBase* mutex)
2572       : mutex_(mutex) { mutex_->Lock(); }
2573
2574   ~GTestMutexLock() { mutex_->Unlock(); }
2575
2576  private:
2577   MutexBase* const mutex_;
2578
2579   GTEST_DISALLOW_COPY_AND_ASSIGN_(GTestMutexLock);
2580 };
2581
2582 typedef GTestMutexLock MutexLock;
2583
2584 // Helpers for ThreadLocal.
2585
2586 // pthread_key_create() requires DeleteThreadLocalValue() to have
2587 // C-linkage.  Therefore it cannot be templatized to access
2588 // ThreadLocal<T>.  Hence the need for class
2589 // ThreadLocalValueHolderBase.
2590 class ThreadLocalValueHolderBase {
2591  public:
2592   virtual ~ThreadLocalValueHolderBase() {}
2593 };
2594
2595 // Called by pthread to delete thread-local data stored by
2596 // pthread_setspecific().
2597 extern "C" inline void DeleteThreadLocalValue(void* value_holder) {
2598   delete static_cast<ThreadLocalValueHolderBase*>(value_holder);
2599 }
2600
2601 // Implements thread-local storage on pthreads-based systems.
2602 //
2603 //   // Thread 1
2604 //   ThreadLocal<int> tl(100);  // 100 is the default value for each thread.
2605 //
2606 //   // Thread 2
2607 //   tl.set(150);  // Changes the value for thread 2 only.
2608 //   EXPECT_EQ(150, tl.get());
2609 //
2610 //   // Thread 1
2611 //   EXPECT_EQ(100, tl.get());  // In thread 1, tl has the original value.
2612 //   tl.set(200);
2613 //   EXPECT_EQ(200, tl.get());
2614 //
2615 // The template type argument T must have a public copy constructor.
2616 // In addition, the default ThreadLocal constructor requires T to have
2617 // a public default constructor.
2618 //
2619 // An object managed for a thread by a ThreadLocal instance is deleted
2620 // when the thread exits.  Or, if the ThreadLocal instance dies in
2621 // that thread, when the ThreadLocal dies.  It's the user's
2622 // responsibility to ensure that all other threads using a ThreadLocal
2623 // have exited when it dies, or the per-thread objects for those
2624 // threads will not be deleted.
2625 //
2626 // Google Test only uses global ThreadLocal objects.  That means they
2627 // will die after main() has returned.  Therefore, no per-thread
2628 // object managed by Google Test will be leaked as long as all threads
2629 // using Google Test have exited when main() returns.
2630 template <typename T>
2631 class ThreadLocal {
2632  public:
2633   ThreadLocal() : key_(CreateKey()),
2634                   default_() {}
2635   explicit ThreadLocal(const T& value) : key_(CreateKey()),
2636                                          default_(value) {}
2637
2638   ~ThreadLocal() {
2639     // Destroys the managed object for the current thread, if any.
2640     DeleteThreadLocalValue(pthread_getspecific(key_));
2641
2642     // Releases resources associated with the key.  This will *not*
2643     // delete managed objects for other threads.
2644     GTEST_CHECK_POSIX_SUCCESS_(pthread_key_delete(key_));
2645   }
2646
2647   T* pointer() { return GetOrCreateValue(); }
2648   const T* pointer() const { return GetOrCreateValue(); }
2649   const T& get() const { return *pointer(); }
2650   void set(const T& value) { *pointer() = value; }
2651
2652  private:
2653   // Holds a value of type T.
2654   class ValueHolder : public ThreadLocalValueHolderBase {
2655    public:
2656     explicit ValueHolder(const T& value) : value_(value) {}
2657
2658     T* pointer() { return &value_; }
2659
2660    private:
2661     T value_;
2662     GTEST_DISALLOW_COPY_AND_ASSIGN_(ValueHolder);
2663   };
2664
2665   static pthread_key_t CreateKey() {
2666     pthread_key_t key;
2667     // When a thread exits, DeleteThreadLocalValue() will be called on
2668     // the object managed for that thread.
2669     GTEST_CHECK_POSIX_SUCCESS_(
2670         pthread_key_create(&key, &DeleteThreadLocalValue));
2671     return key;
2672   }
2673
2674   T* GetOrCreateValue() const {
2675     ThreadLocalValueHolderBase* const holder =
2676         static_cast<ThreadLocalValueHolderBase*>(pthread_getspecific(key_));
2677     if (holder != NULL) {
2678       return CheckedDowncastToActualType<ValueHolder>(holder)->pointer();
2679     }
2680
2681     ValueHolder* const new_holder = new ValueHolder(default_);
2682     ThreadLocalValueHolderBase* const holder_base = new_holder;
2683     GTEST_CHECK_POSIX_SUCCESS_(pthread_setspecific(key_, holder_base));
2684     return new_holder->pointer();
2685   }
2686
2687   // A key pthreads uses for looking up per-thread values.
2688   const pthread_key_t key_;
2689   const T default_;  // The default value for each thread.
2690
2691   GTEST_DISALLOW_COPY_AND_ASSIGN_(ThreadLocal);
2692 };
2693
2694 # define GTEST_IS_THREADSAFE 1
2695
2696 #else  // GTEST_HAS_PTHREAD
2697
2698 // A dummy implementation of synchronization primitives (mutex, lock,
2699 // and thread-local variable).  Necessary for compiling Google Test where
2700 // mutex is not supported - using Google Test in multiple threads is not
2701 // supported on such platforms.
2702
2703 class Mutex {
2704  public:
2705   Mutex() {}
2706   void Lock() {}
2707   void Unlock() {}
2708   void AssertHeld() const {}
2709 };
2710
2711 # define GTEST_DECLARE_STATIC_MUTEX_(mutex) \
2712   extern ::testing::internal::Mutex mutex
2713
2714 # define GTEST_DEFINE_STATIC_MUTEX_(mutex) ::testing::internal::Mutex mutex
2715
2716 class GTestMutexLock {
2717  public:
2718   explicit GTestMutexLock(Mutex*) {}  // NOLINT
2719 };
2720
2721 typedef GTestMutexLock MutexLock;
2722
2723 template <typename T>
2724 class ThreadLocal {
2725  public:
2726   ThreadLocal() : value_() {}
2727   explicit ThreadLocal(const T& value) : value_(value) {}
2728   T* pointer() { return &value_; }
2729   const T* pointer() const { return &value_; }
2730   const T& get() const { return value_; }
2731   void set(const T& value) { value_ = value; }
2732  private:
2733   T value_;
2734 };
2735
2736 // The above synchronization primitives have dummy implementations.
2737 // Therefore Google Test is not thread-safe.
2738 # define GTEST_IS_THREADSAFE 0
2739
2740 #endif  // GTEST_HAS_PTHREAD
2741
2742 // Returns the number of threads running in the process, or 0 to indicate that
2743 // we cannot detect it.
2744 GTEST_API_ size_t GetThreadCount();
2745
2746 // Passing non-POD classes through ellipsis (...) crashes the ARM
2747 // compiler and generates a warning in Sun Studio.  The Nokia Symbian
2748 // and the IBM XL C/C++ compiler try to instantiate a copy constructor
2749 // for objects passed through ellipsis (...), failing for uncopyable
2750 // objects.  We define this to ensure that only POD is passed through
2751 // ellipsis on these systems.
2752 #if defined(__SYMBIAN32__) || defined(__IBMCPP__) || defined(__SUNPRO_CC)
2753 // We lose support for NULL detection where the compiler doesn't like
2754 // passing non-POD classes through ellipsis (...).
2755 # define GTEST_ELLIPSIS_NEEDS_POD_ 1
2756 #else
2757 # define GTEST_CAN_COMPARE_NULL 1
2758 #endif
2759
2760 // The Nokia Symbian and IBM XL C/C++ compilers cannot decide between
2761 // const T& and const T* in a function template.  These compilers
2762 // _can_ decide between class template specializations for T and T*,
2763 // so a tr1::type_traits-like is_pointer works.
2764 #if defined(__SYMBIAN32__) || defined(__IBMCPP__)
2765 # define GTEST_NEEDS_IS_POINTER_ 1
2766 #endif
2767
2768 template <bool bool_value>
2769 struct bool_constant {
2770   typedef bool_constant<bool_value> type;
2771   static const bool value = bool_value;
2772 };
2773 template <bool bool_value> const bool bool_constant<bool_value>::value;
2774
2775 typedef bool_constant<false> false_type;
2776 typedef bool_constant<true> true_type;
2777
2778 template <typename T>
2779 struct is_pointer : public false_type {};
2780
2781 template <typename T>
2782 struct is_pointer<T*> : public true_type {};
2783
2784 template <typename Iterator>
2785 struct IteratorTraits {
2786   typedef typename Iterator::value_type value_type;
2787 };
2788
2789 template <typename T>
2790 struct IteratorTraits<T*> {
2791   typedef T value_type;
2792 };
2793
2794 template <typename T>
2795 struct IteratorTraits<const T*> {
2796   typedef T value_type;
2797 };
2798
2799 #if GTEST_OS_WINDOWS
2800 # define GTEST_PATH_SEP_ "\\"
2801 # define GTEST_HAS_ALT_PATH_SEP_ 1
2802 // The biggest signed integer type the compiler supports.
2803 typedef __int64 BiggestInt;
2804 #else
2805 # define GTEST_PATH_SEP_ "/"
2806 # define GTEST_HAS_ALT_PATH_SEP_ 0
2807 typedef long long BiggestInt;  // NOLINT
2808 #endif  // GTEST_OS_WINDOWS
2809
2810 // Utilities for char.
2811
2812 // isspace(int ch) and friends accept an unsigned char or EOF.  char
2813 // may be signed, depending on the compiler (or compiler flags).
2814 // Therefore we need to cast a char to unsigned char before calling
2815 // isspace(), etc.
2816
2817 inline bool IsAlpha(char ch) {
2818   return isalpha(static_cast<unsigned char>(ch)) != 0;
2819 }
2820 inline bool IsAlNum(char ch) {
2821   return isalnum(static_cast<unsigned char>(ch)) != 0;
2822 }
2823 inline bool IsDigit(char ch) {
2824   return isdigit(static_cast<unsigned char>(ch)) != 0;
2825 }
2826 inline bool IsLower(char ch) {
2827   return islower(static_cast<unsigned char>(ch)) != 0;
2828 }
2829 inline bool IsSpace(char ch) {
2830   return isspace(static_cast<unsigned char>(ch)) != 0;
2831 }
2832 inline bool IsUpper(char ch) {
2833   return isupper(static_cast<unsigned char>(ch)) != 0;
2834 }
2835 inline bool IsXDigit(char ch) {
2836   return isxdigit(static_cast<unsigned char>(ch)) != 0;
2837 }
2838 inline bool IsXDigit(wchar_t ch) {
2839   const unsigned char low_byte = static_cast<unsigned char>(ch);
2840   return ch == low_byte && isxdigit(low_byte) != 0;
2841 }
2842
2843 inline char ToLower(char ch) {
2844   return static_cast<char>(tolower(static_cast<unsigned char>(ch)));
2845 }
2846 inline char ToUpper(char ch) {
2847   return static_cast<char>(toupper(static_cast<unsigned char>(ch)));
2848 }
2849
2850 // The testing::internal::posix namespace holds wrappers for common
2851 // POSIX functions.  These wrappers hide the differences between
2852 // Windows/MSVC and POSIX systems.  Since some compilers define these
2853 // standard functions as macros, the wrapper cannot have the same name
2854 // as the wrapped function.
2855
2856 namespace posix {
2857
2858 // Functions with a different name on Windows.
2859
2860 #if GTEST_OS_WINDOWS
2861
2862 typedef struct _stat StatStruct;
2863
2864 # ifdef __BORLANDC__
2865 inline int IsATTY(int fd) { return isatty(fd); }
2866 inline int StrCaseCmp(const char* s1, const char* s2) {
2867   return stricmp(s1, s2);
2868 }
2869 inline char* StrDup(const char* src) { return strdup(src); }
2870 # else  // !__BORLANDC__
2871 #  if GTEST_OS_WINDOWS_MOBILE
2872 inline int IsATTY(int /* fd */) { return 0; }
2873 #  else
2874 inline int IsATTY(int fd) { return _isatty(fd); }
2875 #  endif  // GTEST_OS_WINDOWS_MOBILE
2876 inline int StrCaseCmp(const char* s1, const char* s2) {
2877   return _stricmp(s1, s2);
2878 }
2879 inline char* StrDup(const char* src) { return _strdup(src); }
2880 # endif  // __BORLANDC__
2881
2882 # if GTEST_OS_WINDOWS_MOBILE
2883 inline int FileNo(FILE* file) { return reinterpret_cast<int>(_fileno(file)); }
2884 // Stat(), RmDir(), and IsDir() are not needed on Windows CE at this
2885 // time and thus not defined there.
2886 # else
2887 inline int FileNo(FILE* file) { return _fileno(file); }
2888 inline int Stat(const char* path, StatStruct* buf) { return _stat(path, buf); }
2889 inline int RmDir(const char* dir) { return _rmdir(dir); }
2890 inline bool IsDir(const StatStruct& st) {
2891   return (_S_IFDIR & st.st_mode) != 0;
2892 }
2893 # endif  // GTEST_OS_WINDOWS_MOBILE
2894
2895 #else
2896
2897 typedef struct stat StatStruct;
2898
2899 inline int FileNo(FILE* file) { return fileno(file); }
2900 inline int IsATTY(int fd) { return isatty(fd); }
2901 inline int Stat(const char* path, StatStruct* buf) { return stat(path, buf); }
2902 inline int StrCaseCmp(const char* s1, const char* s2) {
2903   return strcasecmp(s1, s2);
2904 }
2905 inline char* StrDup(const char* src) { return strdup(src); }
2906 inline int RmDir(const char* dir) { return rmdir(dir); }
2907 inline bool IsDir(const StatStruct& st) { return S_ISDIR(st.st_mode); }
2908
2909 #endif  // GTEST_OS_WINDOWS
2910
2911 // Functions deprecated by MSVC 8.0.
2912
2913 #ifdef _MSC_VER
2914 // Temporarily disable warning 4996 (deprecated function).
2915 # pragma warning(push)
2916 # pragma warning(disable:4996)
2917 #endif
2918
2919 inline const char* StrNCpy(char* dest, const char* src, size_t n) {
2920   return strncpy(dest, src, n);
2921 }
2922
2923 // ChDir(), FReopen(), FDOpen(), Read(), Write(), Close(), and
2924 // StrError() aren't needed on Windows CE at this time and thus not
2925 // defined there.
2926
2927 #if !GTEST_OS_WINDOWS_MOBILE
2928 inline int ChDir(const char* dir) { return chdir(dir); }
2929 #endif
2930 inline FILE* FOpen(const char* path, const char* mode) {
2931   return fopen(path, mode);
2932 }
2933 #if !GTEST_OS_WINDOWS_MOBILE
2934 inline FILE *FReopen(const char* path, const char* mode, FILE* stream) {
2935   return freopen(path, mode, stream);
2936 }
2937 inline FILE* FDOpen(int fd, const char* mode) { return fdopen(fd, mode); }
2938 #endif
2939 inline int FClose(FILE* fp) { return fclose(fp); }
2940 #if !GTEST_OS_WINDOWS_MOBILE
2941 inline int Read(int fd, void* buf, unsigned int count) {
2942   return static_cast<int>(read(fd, buf, count));
2943 }
2944 inline int Write(int fd, const void* buf, unsigned int count) {
2945   return static_cast<int>(write(fd, buf, count));
2946 }
2947 inline int Close(int fd) { return close(fd); }
2948 inline const char* StrError(int errnum) { return strerror(errnum); }
2949 #endif
2950 inline const char* GetEnv(const char* name) {
2951 #if GTEST_OS_WINDOWS_MOBILE
2952   // We are on Windows CE, which has no environment variables.
2953   return NULL;
2954 #elif defined(__BORLANDC__) || defined(__SunOS_5_8) || defined(__SunOS_5_9)
2955   // Environment variables which we programmatically clear will be set to the
2956   // empty string rather than unset (NULL).  Handle that case.
2957   const char* const env = getenv(name);
2958   return (env != NULL && env[0] != '\0') ? env : NULL;
2959 #else
2960   return getenv(name);
2961 #endif
2962 }
2963
2964 #ifdef _MSC_VER
2965 # pragma warning(pop)  // Restores the warning state.
2966 #endif
2967
2968 #if GTEST_OS_WINDOWS_MOBILE
2969 // Windows CE has no C library. The abort() function is used in
2970 // several places in Google Test. This implementation provides a reasonable
2971 // imitation of standard behaviour.
2972 void Abort();
2973 #else
2974 inline void Abort() { abort(); }
2975 #endif  // GTEST_OS_WINDOWS_MOBILE
2976
2977 }  // namespace posix
2978
2979 // MSVC "deprecates" snprintf and issues warnings wherever it is used.  In
2980 // order to avoid these warnings, we need to use _snprintf or _snprintf_s on
2981 // MSVC-based platforms.  We map the GTEST_SNPRINTF_ macro to the appropriate
2982 // function in order to achieve that.  We use macro definition here because
2983 // snprintf is a variadic function.
2984 #if defined(_MSC_VER) && _MSC_VER >= 1400 && !GTEST_OS_WINDOWS_MOBILE
2985 // MSVC 2005 and above support variadic macros.
2986 # define GTEST_SNPRINTF_(buffer, size, format, ...) \
2987      _snprintf_s(buffer, size, size, format, __VA_ARGS__)
2988 #elif defined(_MSC_VER)
2989 // Windows CE does not define _snprintf_s and MSVC prior to 2005 doesn't
2990 // complain about _snprintf.
2991 # define GTEST_SNPRINTF_ _snprintf
2992 #else
2993 # define GTEST_SNPRINTF_ snprintf
2994 #endif
2995
2996 // The maximum number a BiggestInt can represent.  This definition
2997 // works no matter BiggestInt is represented in one's complement or
2998 // two's complement.
2999 //
3000 // We cannot rely on numeric_limits in STL, as __int64 and long long
3001 // are not part of standard C++ and numeric_limits doesn't need to be
3002 // defined for them.
3003 const BiggestInt kMaxBiggestInt =
3004     ~(static_cast<BiggestInt>(1) << (8*sizeof(BiggestInt) - 1));
3005
3006 // This template class serves as a compile-time function from size to
3007 // type.  It maps a size in bytes to a primitive type with that
3008 // size. e.g.
3009 //
3010 //   TypeWithSize<4>::UInt
3011 //
3012 // is typedef-ed to be unsigned int (unsigned integer made up of 4
3013 // bytes).
3014 //
3015 // Such functionality should belong to STL, but I cannot find it
3016 // there.
3017 //
3018 // Google Test uses this class in the implementation of floating-point
3019 // comparison.
3020 //
3021 // For now it only handles UInt (unsigned int) as that's all Google Test
3022 // needs.  Other types can be easily added in the future if need
3023 // arises.
3024 template <size_t size>
3025 class TypeWithSize {
3026  public:
3027   // This prevents the user from using TypeWithSize<N> with incorrect
3028   // values of N.
3029   typedef void UInt;
3030 };
3031
3032 // The specialization for size 4.
3033 template <>
3034 class TypeWithSize<4> {
3035  public:
3036   // unsigned int has size 4 in both gcc and MSVC.
3037   //
3038   // As base/basictypes.h doesn't compile on Windows, we cannot use
3039   // uint32, uint64, and etc here.
3040   typedef int Int;
3041   typedef unsigned int UInt;
3042 };
3043
3044 // The specialization for size 8.
3045 template <>
3046 class TypeWithSize<8> {
3047  public:
3048 #if GTEST_OS_WINDOWS
3049   typedef __int64 Int;
3050   typedef unsigned __int64 UInt;
3051 #else
3052   typedef long long Int;  // NOLINT
3053   typedef unsigned long long UInt;  // NOLINT
3054 #endif  // GTEST_OS_WINDOWS
3055 };
3056
3057 // Integer types of known sizes.
3058 typedef TypeWithSize<4>::Int Int32;
3059 typedef TypeWithSize<4>::UInt UInt32;
3060 typedef TypeWithSize<8>::Int Int64;
3061 typedef TypeWithSize<8>::UInt UInt64;
3062 typedef TypeWithSize<8>::Int TimeInMillis;  // Represents time in milliseconds.
3063
3064 // Utilities for command line flags and environment variables.
3065
3066 // Macro for referencing flags.
3067 #define GTEST_FLAG(name) FLAGS_gtest_##name
3068
3069 // Macros for declaring flags.
3070 #define GTEST_DECLARE_bool_(name) GTEST_API_ extern bool GTEST_FLAG(name)
3071 #define GTEST_DECLARE_int32_(name) \
3072     GTEST_API_ extern ::testing::internal::Int32 GTEST_FLAG(name)
3073 #define GTEST_DECLARE_string_(name) \
3074     GTEST_API_ extern ::std::string GTEST_FLAG(name)
3075
3076 // Macros for defining flags.
3077 #define GTEST_DEFINE_bool_(name, default_val, doc) \
3078     GTEST_API_ bool GTEST_FLAG(name) = (default_val)
3079 #define GTEST_DEFINE_int32_(name, default_val, doc) \
3080     GTEST_API_ ::testing::internal::Int32 GTEST_FLAG(name) = (default_val)
3081 #define GTEST_DEFINE_string_(name, default_val, doc) \
3082     GTEST_API_ ::std::string GTEST_FLAG(name) = (default_val)
3083
3084 // Thread annotations
3085 #define GTEST_EXCLUSIVE_LOCK_REQUIRED_(locks)
3086 #define GTEST_LOCK_EXCLUDED_(locks)
3087
3088 // Parses 'str' for a 32-bit signed integer.  If successful, writes the result
3089 // to *value and returns true; otherwise leaves *value unchanged and returns
3090 // false.
3091 // TODO(chandlerc): Find a better way to refactor flag and environment parsing
3092 // out of both gtest-port.cc and gtest.cc to avoid exporting this utility
3093 // function.
3094 bool ParseInt32(const Message& src_text, const char* str, Int32* value);
3095
3096 // Parses a bool/Int32/string from the environment variable
3097 // corresponding to the given Google Test flag.
3098 bool BoolFromGTestEnv(const char* flag, bool default_val);
3099 GTEST_API_ Int32 Int32FromGTestEnv(const char* flag, Int32 default_val);
3100 const char* StringFromGTestEnv(const char* flag, const char* default_val);
3101
3102 }  // namespace internal
3103 }  // namespace testing
3104
3105 #endif  // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PORT_H_
3106
3107 #if GTEST_OS_LINUX
3108 # include <stdlib.h>
3109 # include <sys/types.h>
3110 # include <sys/wait.h>
3111 # include <unistd.h>
3112 #endif  // GTEST_OS_LINUX
3113
3114 #if GTEST_HAS_EXCEPTIONS
3115 # include <stdexcept>
3116 #endif
3117
3118 #include <ctype.h>
3119 #include <string.h>
3120 #include <iomanip>
3121 #include <limits>
3122 #include <set>
3123
3124 // Copyright 2005, Google Inc.
3125 // All rights reserved.
3126 //
3127 // Redistribution and use in source and binary forms, with or without
3128 // modification, are permitted provided that the following conditions are
3129 // met:
3130 //
3131 //     * Redistributions of source code must retain the above copyright
3132 // notice, this list of conditions and the following disclaimer.
3133 //     * Redistributions in binary form must reproduce the above
3134 // copyright notice, this list of conditions and the following disclaimer
3135 // in the documentation and/or other materials provided with the
3136 // distribution.
3137 //     * Neither the name of Google Inc. nor the names of its
3138 // contributors may be used to endorse or promote products derived from
3139 // this software without specific prior written permission.
3140 //
3141 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
3142 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
3143 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
3144 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
3145 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
3146 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
3147 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
3148 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
3149 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
3150 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
3151 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
3152 //
3153 // Author: wan@google.com (Zhanyong Wan)
3154 //
3155 // The Google C++ Testing Framework (Google Test)
3156 //
3157 // This header file defines the Message class.
3158 //
3159 // IMPORTANT NOTE: Due to limitation of the C++ language, we have to
3160 // leave some internal implementation details in this header file.
3161 // They are clearly marked by comments like this:
3162 //
3163 //   // INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
3164 //
3165 // Such code is NOT meant to be used by a user directly, and is subject
3166 // to CHANGE WITHOUT NOTICE.  Therefore DO NOT DEPEND ON IT in a user
3167 // program!
3168
3169 #ifndef GTEST_INCLUDE_GTEST_GTEST_MESSAGE_H_
3170 #define GTEST_INCLUDE_GTEST_GTEST_MESSAGE_H_
3171
3172 #include <limits>
3173
3174
3175 // Ensures that there is at least one operator<< in the global namespace.
3176 // See Message& operator<<(...) below for why.
3177 void operator<<(const testing::internal::Secret&, int);
3178
3179 namespace testing {
3180
3181 // The Message class works like an ostream repeater.
3182 //
3183 // Typical usage:
3184 //
3185 //   1. You stream a bunch of values to a Message object.
3186 //      It will remember the text in a stringstream.
3187 //   2. Then you stream the Message object to an ostream.
3188 //      This causes the text in the Message to be streamed
3189 //      to the ostream.
3190 //
3191 // For example;
3192 //
3193 //   testing::Message foo;
3194 //   foo << 1 << " != " << 2;
3195 //   std::cout << foo;
3196 //
3197 // will print "1 != 2".
3198 //
3199 // Message is not intended to be inherited from.  In particular, its
3200 // destructor is not virtual.
3201 //
3202 // Note that stringstream behaves differently in gcc and in MSVC.  You
3203 // can stream a NULL char pointer to it in the former, but not in the
3204 // latter (it causes an access violation if you do).  The Message
3205 // class hides this difference by treating a NULL char pointer as
3206 // "(null)".
3207 class GTEST_API_ Message {
3208  private:
3209   // The type of basic IO manipulators (endl, ends, and flush) for
3210   // narrow streams.
3211   typedef std::ostream& (*BasicNarrowIoManip)(std::ostream&);
3212
3213  public:
3214   // Constructs an empty Message.
3215   Message();
3216
3217   // Copy constructor.
3218   Message(const Message& msg) : ss_(new ::std::stringstream) {  // NOLINT
3219     *ss_ << msg.GetString();
3220   }
3221
3222   // Constructs a Message from a C-string.
3223   explicit Message(const char* str) : ss_(new ::std::stringstream) {
3224     *ss_ << str;
3225   }
3226
3227 #if GTEST_OS_SYMBIAN
3228   // Streams a value (either a pointer or not) to this object.
3229   template <typename T>
3230   inline Message& operator <<(const T& value) {
3231     StreamHelper(typename internal::is_pointer<T>::type(), value);
3232     return *this;
3233   }
3234 #else
3235   // Streams a non-pointer value to this object.
3236   template <typename T>
3237   inline Message& operator <<(const T& val) {
3238     // Some libraries overload << for STL containers.  These
3239     // overloads are defined in the global namespace instead of ::std.
3240     //
3241     // C++'s symbol lookup rule (i.e. Koenig lookup) says that these
3242     // overloads are visible in either the std namespace or the global
3243     // namespace, but not other namespaces, including the testing
3244     // namespace which Google Test's Message class is in.
3245     //
3246     // To allow STL containers (and other types that has a << operator
3247     // defined in the global namespace) to be used in Google Test
3248     // assertions, testing::Message must access the custom << operator
3249     // from the global namespace.  With this using declaration,
3250     // overloads of << defined in the global namespace and those
3251     // visible via Koenig lookup are both exposed in this function.
3252     using ::operator <<;
3253     *ss_ << val;
3254     return *this;
3255   }
3256
3257   // Streams a pointer value to this object.
3258   //
3259   // This function is an overload of the previous one.  When you
3260   // stream a pointer to a Message, this definition will be used as it
3261   // is more specialized.  (The C++ Standard, section
3262   // [temp.func.order].)  If you stream a non-pointer, then the
3263   // previous definition will be used.
3264   //
3265   // The reason for this overload is that streaming a NULL pointer to
3266   // ostream is undefined behavior.  Depending on the compiler, you
3267   // may get "0", "(nil)", "(null)", or an access violation.  To
3268   // ensure consistent result across compilers, we always treat NULL
3269   // as "(null)".
3270   template <typename T>
3271   inline Message& operator <<(T* const& pointer) {  // NOLINT
3272     if (pointer == NULL) {
3273       *ss_ << "(null)";
3274     } else {
3275       *ss_ << pointer;
3276     }
3277     return *this;
3278   }
3279 #endif  // GTEST_OS_SYMBIAN
3280
3281   // Since the basic IO manipulators are overloaded for both narrow
3282   // and wide streams, we have to provide this specialized definition
3283   // of operator <<, even though its body is the same as the
3284   // templatized version above.  Without this definition, streaming
3285   // endl or other basic IO manipulators to Message will confuse the
3286   // compiler.
3287   Message& operator <<(BasicNarrowIoManip val) {
3288     *ss_ << val;
3289     return *this;
3290   }
3291
3292   // Instead of 1/0, we want to see true/false for bool values.
3293   Message& operator <<(bool b) {
3294     return *this << (b ? "true" : "false");
3295   }
3296
3297   // These two overloads allow streaming a wide C string to a Message
3298   // using the UTF-8 encoding.
3299   Message& operator <<(const wchar_t* wide_c_str);
3300   Message& operator <<(wchar_t* wide_c_str);
3301
3302 #if GTEST_HAS_STD_WSTRING
3303   // Converts the given wide string to a narrow string using the UTF-8
3304   // encoding, and streams the result to this Message object.
3305   Message& operator <<(const ::std::wstring& wstr);
3306 #endif  // GTEST_HAS_STD_WSTRING
3307
3308 #if GTEST_HAS_GLOBAL_WSTRING
3309   // Converts the given wide string to a narrow string using the UTF-8
3310   // encoding, and streams the result to this Message object.
3311   Message& operator <<(const ::wstring& wstr);
3312 #endif  // GTEST_HAS_GLOBAL_WSTRING
3313
3314   // Gets the text streamed to this object so far as an std::string.
3315   // Each '\0' character in the buffer is replaced with "\\0".
3316   //
3317   // INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
3318   std::string GetString() const;
3319
3320  private:
3321
3322 #if GTEST_OS_SYMBIAN
3323   // These are needed as the Nokia Symbian Compiler cannot decide between
3324   // const T& and const T* in a function template. The Nokia compiler _can_
3325   // decide between class template specializations for T and T*, so a
3326   // tr1::type_traits-like is_pointer works, and we can overload on that.
3327   template <typename T>
3328   inline void StreamHelper(internal::true_type /*is_pointer*/, T* pointer) {
3329     if (pointer == NULL) {
3330       *ss_ << "(null)";
3331     } else {
3332       *ss_ << pointer;
3333     }
3334   }
3335   template <typename T>
3336   inline void StreamHelper(internal::false_type /*is_pointer*/,
3337                            const T& value) {
3338     // See the comments in Message& operator <<(const T&) above for why
3339     // we need this using statement.
3340     using ::operator <<;
3341     *ss_ << value;
3342   }
3343 #endif  // GTEST_OS_SYMBIAN
3344
3345   // We'll hold the text streamed to this object here.
3346   const internal::scoped_ptr< ::std::stringstream> ss_;
3347
3348   // We declare (but don't implement) this to prevent the compiler
3349   // from implementing the assignment operator.
3350   void operator=(const Message&);
3351 };
3352
3353 // Streams a Message to an ostream.
3354 inline std::ostream& operator <<(std::ostream& os, const Message& sb) {
3355   return os << sb.GetString();
3356 }
3357
3358 namespace internal {
3359
3360 // Converts a streamable value to an std::string.  A NULL pointer is
3361 // converted to "(null)".  When the input value is a ::string,
3362 // ::std::string, ::wstring, or ::std::wstring object, each NUL
3363 // character in it is replaced with "\\0".
3364 template <typename T>
3365 std::string StreamableToString(const T& streamable) {
3366   return (Message() << streamable).GetString();
3367 }
3368
3369 }  // namespace internal
3370 }  // namespace testing
3371
3372 #endif  // GTEST_INCLUDE_GTEST_GTEST_MESSAGE_H_
3373 // Copyright 2005, Google Inc.
3374 // All rights reserved.
3375 //
3376 // Redistribution and use in source and binary forms, with or without
3377 // modification, are permitted provided that the following conditions are
3378 // met:
3379 //
3380 //     * Redistributions of source code must retain the above copyright
3381 // notice, this list of conditions and the following disclaimer.
3382 //     * Redistributions in binary form must reproduce the above
3383 // copyright notice, this list of conditions and the following disclaimer
3384 // in the documentation and/or other materials provided with the
3385 // distribution.
3386 //     * Neither the name of Google Inc. nor the names of its
3387 // contributors may be used to endorse or promote products derived from
3388 // this software without specific prior written permission.
3389 //
3390 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
3391 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
3392 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
3393 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
3394 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
3395 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
3396 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
3397 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
3398 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
3399 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
3400 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
3401 //
3402 // Authors: wan@google.com (Zhanyong Wan), eefacm@gmail.com (Sean Mcafee)
3403 //
3404 // The Google C++ Testing Framework (Google Test)
3405 //
3406 // This header file declares the String class and functions used internally by
3407 // Google Test.  They are subject to change without notice. They should not used
3408 // by code external to Google Test.
3409 //
3410 // This header file is #included by <gtest/internal/gtest-internal.h>.
3411 // It should not be #included by other files.
3412
3413 #ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_STRING_H_
3414 #define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_STRING_H_
3415
3416 #ifdef __BORLANDC__
3417 // string.h is not guaranteed to provide strcpy on C++ Builder.
3418 # include <mem.h>
3419 #endif
3420
3421 #include <string.h>
3422 #include <string>
3423
3424
3425 namespace testing {
3426 namespace internal {
3427
3428 // String - an abstract class holding static string utilities.
3429 class GTEST_API_ String {
3430  public:
3431   // Static utility methods
3432
3433   // Clones a 0-terminated C string, allocating memory using new.  The
3434   // caller is responsible for deleting the return value using
3435   // delete[].  Returns the cloned string, or NULL if the input is
3436   // NULL.
3437   //
3438   // This is different from strdup() in string.h, which allocates
3439   // memory using malloc().
3440   static const char* CloneCString(const char* c_str);
3441
3442 #if GTEST_OS_WINDOWS_MOBILE
3443   // Windows CE does not have the 'ANSI' versions of Win32 APIs. To be
3444   // able to pass strings to Win32 APIs on CE we need to convert them
3445   // to 'Unicode', UTF-16.
3446
3447   // Creates a UTF-16 wide string from the given ANSI string, allocating
3448   // memory using new. The caller is responsible for deleting the return
3449   // value using delete[]. Returns the wide string, or NULL if the
3450   // input is NULL.
3451   //
3452   // The wide string is created using the ANSI codepage (CP_ACP) to
3453   // match the behaviour of the ANSI versions of Win32 calls and the
3454   // C runtime.
3455   static LPCWSTR AnsiToUtf16(const char* c_str);
3456
3457   // Creates an ANSI string from the given wide string, allocating
3458   // memory using new. The caller is responsible for deleting the return
3459   // value using delete[]. Returns the ANSI string, or NULL if the
3460   // input is NULL.
3461   //
3462   // The returned string is created using the ANSI codepage (CP_ACP) to
3463   // match the behaviour of the ANSI versions of Win32 calls and the
3464   // C runtime.
3465   static const char* Utf16ToAnsi(LPCWSTR utf16_str);
3466 #endif
3467
3468   // Compares two C strings.  Returns true iff they have the same content.
3469   //
3470   // Unlike strcmp(), this function can handle NULL argument(s).  A
3471   // NULL C string is considered different to any non-NULL C string,
3472   // including the empty string.
3473   static bool CStringEquals(const char* lhs, const char* rhs);
3474
3475   // Converts a wide C string to a String using the UTF-8 encoding.
3476   // NULL will be converted to "(null)".  If an error occurred during
3477   // the conversion, "(failed to convert from wide string)" is
3478   // returned.
3479   static std::string ShowWideCString(const wchar_t* wide_c_str);
3480
3481   // Compares two wide C strings.  Returns true iff they have the same
3482   // content.
3483   //
3484   // Unlike wcscmp(), this function can handle NULL argument(s).  A
3485   // NULL C string is considered different to any non-NULL C string,
3486   // including the empty string.
3487   static bool WideCStringEquals(const wchar_t* lhs, const wchar_t* rhs);
3488
3489   // Compares two C strings, ignoring case.  Returns true iff they
3490   // have the same content.
3491   //
3492   // Unlike strcasecmp(), this function can handle NULL argument(s).
3493   // A NULL C string is considered different to any non-NULL C string,
3494   // including the empty string.
3495   static bool CaseInsensitiveCStringEquals(const char* lhs,
3496                                            const char* rhs);
3497
3498   // Compares two wide C strings, ignoring case.  Returns true iff they
3499   // have the same content.
3500   //
3501   // Unlike wcscasecmp(), this function can handle NULL argument(s).
3502   // A NULL C string is considered different to any non-NULL wide C string,
3503   // including the empty string.
3504   // NB: The implementations on different platforms slightly differ.
3505   // On windows, this method uses _wcsicmp which compares according to LC_CTYPE
3506   // environment variable. On GNU platform this method uses wcscasecmp
3507   // which compares according to LC_CTYPE category of the current locale.
3508   // On MacOS X, it uses towlower, which also uses LC_CTYPE category of the
3509   // current locale.
3510   static bool CaseInsensitiveWideCStringEquals(const wchar_t* lhs,
3511                                                const wchar_t* rhs);
3512
3513   // Returns true iff the given string ends with the given suffix, ignoring
3514   // case. Any string is considered to end with an empty suffix.
3515   static bool EndsWithCaseInsensitive(
3516       const std::string& str, const std::string& suffix);
3517
3518   // Formats an int value as "%02d".
3519   static std::string FormatIntWidth2(int value);  // "%02d" for width == 2
3520
3521   // Formats an int value as "%X".
3522   static std::string FormatHexInt(int value);
3523
3524   // Formats a byte as "%02X".
3525   static std::string FormatByte(unsigned char value);
3526
3527  private:
3528   String();  // Not meant to be instantiated.
3529 };  // class String
3530
3531 // Gets the content of the stringstream's buffer as an std::string.  Each '\0'
3532 // character in the buffer is replaced with "\\0".
3533 GTEST_API_ std::string StringStreamToString(::std::stringstream* stream);
3534
3535 }  // namespace internal
3536 }  // namespace testing
3537
3538 #endif  // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_STRING_H_
3539 // Copyright 2008, Google Inc.
3540 // All rights reserved.
3541 //
3542 // Redistribution and use in source and binary forms, with or without
3543 // modification, are permitted provided that the following conditions are
3544 // met:
3545 //
3546 //     * Redistributions of source code must retain the above copyright
3547 // notice, this list of conditions and the following disclaimer.
3548 //     * Redistributions in binary form must reproduce the above
3549 // copyright notice, this list of conditions and the following disclaimer
3550 // in the documentation and/or other materials provided with the
3551 // distribution.
3552 //     * Neither the name of Google Inc. nor the names of its
3553 // contributors may be used to endorse or promote products derived from
3554 // this software without specific prior written permission.
3555 //
3556 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
3557 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
3558 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
3559 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
3560 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
3561 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
3562 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
3563 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
3564 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
3565 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
3566 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
3567 //
3568 // Author: keith.ray@gmail.com (Keith Ray)
3569 //
3570 // Google Test filepath utilities
3571 //
3572 // This header file declares classes and functions used internally by
3573 // Google Test.  They are subject to change without notice.
3574 //
3575 // This file is #included in <gtest/internal/gtest-internal.h>.
3576 // Do not include this header file separately!
3577
3578 #ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_FILEPATH_H_
3579 #define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_FILEPATH_H_
3580
3581
3582 namespace testing {
3583 namespace internal {
3584
3585 // FilePath - a class for file and directory pathname manipulation which
3586 // handles platform-specific conventions (like the pathname separator).
3587 // Used for helper functions for naming files in a directory for xml output.
3588 // Except for Set methods, all methods are const or static, which provides an
3589 // "immutable value object" -- useful for peace of mind.
3590 // A FilePath with a value ending in a path separator ("like/this/") represents
3591 // a directory, otherwise it is assumed to represent a file. In either case,
3592 // it may or may not represent an actual file or directory in the file system.
3593 // Names are NOT checked for syntax correctness -- no checking for illegal
3594 // characters, malformed paths, etc.
3595
3596 class GTEST_API_ FilePath {
3597  public:
3598   FilePath() : pathname_("") { }
3599   FilePath(const FilePath& rhs) : pathname_(rhs.pathname_) { }
3600
3601   explicit FilePath(const std::string& pathname) : pathname_(pathname) {
3602     Normalize();
3603   }
3604
3605   FilePath& operator=(const FilePath& rhs) {
3606     Set(rhs);
3607     return *this;
3608   }
3609
3610   void Set(const FilePath& rhs) {
3611     pathname_ = rhs.pathname_;
3612   }
3613
3614   const std::string& string() const { return pathname_; }
3615   const char* c_str() const { return pathname_.c_str(); }
3616
3617   // Returns the current working directory, or "" if unsuccessful.
3618   static FilePath GetCurrentDir();
3619
3620   // Given directory = "dir", base_name = "test", number = 0,
3621   // extension = "xml", returns "dir/test.xml". If number is greater
3622   // than zero (e.g., 12), returns "dir/test_12.xml".
3623   // On Windows platform, uses \ as the separator rather than /.
3624   static FilePath MakeFileName(const FilePath& directory,
3625                                const FilePath& base_name,
3626                                int number,
3627                                const char* extension);
3628
3629   // Given directory = "dir", relative_path = "test.xml",
3630   // returns "dir/test.xml".
3631   // On Windows, uses \ as the separator rather than /.
3632   static FilePath ConcatPaths(const FilePath& directory,
3633                               const FilePath& relative_path);
3634
3635   // Returns a pathname for a file that does not currently exist. The pathname
3636   // will be directory/base_name.extension or
3637   // directory/base_name_<number>.extension if directory/base_name.extension
3638   // already exists. The number will be incremented until a pathname is found
3639   // that does not already exist.
3640   // Examples: 'dir/foo_test.xml' or 'dir/foo_test_1.xml'.
3641   // There could be a race condition if two or more processes are calling this
3642   // function at the same time -- they could both pick the same filename.
3643   static FilePath GenerateUniqueFileName(const FilePath& directory,
3644                                          const FilePath& base_name,
3645                                          const char* extension);
3646
3647   // Returns true iff the path is "".
3648   bool IsEmpty() const { return pathname_.empty(); }
3649
3650   // If input name has a trailing separator character, removes it and returns
3651   // the name, otherwise return the name string unmodified.
3652   // On Windows platform, uses \ as the separator, other platforms use /.
3653   FilePath RemoveTrailingPathSeparator() const;
3654
3655   // Returns a copy of the FilePath with the directory part removed.
3656   // Example: FilePath("path/to/file").RemoveDirectoryName() returns
3657   // FilePath("file"). If there is no directory part ("just_a_file"), it returns
3658   // the FilePath unmodified. If there is no file part ("just_a_dir/") it
3659   // returns an empty FilePath ("").
3660   // On Windows platform, '\' is the path separator, otherwise it is '/'.
3661   FilePath RemoveDirectoryName() const;
3662
3663   // RemoveFileName returns the directory path with the filename removed.
3664   // Example: FilePath("path/to/file").RemoveFileName() returns "path/to/".
3665   // If the FilePath is "a_file" or "/a_file", RemoveFileName returns
3666   // FilePath("./") or, on Windows, FilePath(".\\"). If the filepath does
3667   // not have a file, like "just/a/dir/", it returns the FilePath unmodified.
3668   // On Windows platform, '\' is the path separator, otherwise it is '/'.
3669   FilePath RemoveFileName() const;
3670
3671   // Returns a copy of the FilePath with the case-insensitive extension removed.
3672   // Example: FilePath("dir/file.exe").RemoveExtension("EXE") returns
3673   // FilePath("dir/file"). If a case-insensitive extension is not
3674   // found, returns a copy of the original FilePath.
3675   FilePath RemoveExtension(const char* extension) const;
3676
3677   // Creates directories so that path exists. Returns true if successful or if
3678   // the directories already exist; returns false if unable to create
3679   // directories for any reason. Will also return false if the FilePath does
3680   // not represent a directory (that is, it doesn't end with a path separator).
3681   bool CreateDirectoriesRecursively() const;
3682
3683   // Create the directory so that path exists. Returns true if successful or
3684   // if the directory already exists; returns false if unable to create the
3685   // directory for any reason, including if the parent directory does not
3686   // exist. Not named "CreateDirectory" because that's a macro on Windows.
3687   bool CreateFolder() const;
3688
3689   // Returns true if FilePath describes something in the file-system,
3690   // either a file, directory, or whatever, and that something exists.
3691   bool FileOrDirectoryExists() const;
3692
3693   // Returns true if pathname describes a directory in the file-system
3694   // that exists.
3695   bool DirectoryExists() const;
3696
3697   // Returns true if FilePath ends with a path separator, which indicates that
3698   // it is intended to represent a directory. Returns false otherwise.
3699   // This does NOT check that a directory (or file) actually exists.
3700   bool IsDirectory() const;
3701
3702   // Returns true if pathname describes a root directory. (Windows has one
3703   // root directory per disk drive.)
3704   bool IsRootDirectory() const;
3705
3706   // Returns true if pathname describes an absolute path.
3707   bool IsAbsolutePath() const;
3708
3709  private:
3710   // Replaces multiple consecutive separators with a single separator.
3711   // For example, "bar///foo" becomes "bar/foo". Does not eliminate other
3712   // redundancies that might be in a pathname involving "." or "..".
3713   //
3714   // A pathname with multiple consecutive separators may occur either through
3715   // user error or as a result of some scripts or APIs that generate a pathname
3716   // with a trailing separator. On other platforms the same API or script
3717   // may NOT generate a pathname with a trailing "/". Then elsewhere that
3718   // pathname may have another "/" and pathname components added to it,
3719   // without checking for the separator already being there.
3720   // The script language and operating system may allow paths like "foo//bar"
3721   // but some of the functions in FilePath will not handle that correctly. In
3722   // particular, RemoveTrailingPathSeparator() only removes one separator, and
3723   // it is called in CreateDirectoriesRecursively() assuming that it will change
3724   // a pathname from directory syntax (trailing separator) to filename syntax.
3725   //
3726   // On Windows this method also replaces the alternate path separator '/' with
3727   // the primary path separator '\\', so that for example "bar\\/\\foo" becomes
3728   // "bar\\foo".
3729
3730   void Normalize();
3731
3732   // Returns a pointer to the last occurence of a valid path separator in
3733   // the FilePath. On Windows, for example, both '/' and '\' are valid path
3734   // separators. Returns NULL if no path separator was found.
3735   const char* FindLastPathSeparator() const;
3736
3737   std::string pathname_;
3738 };  // class FilePath
3739
3740 }  // namespace internal
3741 }  // namespace testing
3742
3743 #endif  // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_FILEPATH_H_
3744 // This file was GENERATED by command:
3745 //     pump.py gtest-type-util.h.pump
3746 // DO NOT EDIT BY HAND!!!
3747
3748 // Copyright 2008 Google Inc.
3749 // All Rights Reserved.
3750 //
3751 // Redistribution and use in source and binary forms, with or without
3752 // modification, are permitted provided that the following conditions are
3753 // met:
3754 //
3755 //     * Redistributions of source code must retain the above copyright
3756 // notice, this list of conditions and the following disclaimer.
3757 //     * Redistributions in binary form must reproduce the above
3758 // copyright notice, this list of conditions and the following disclaimer
3759 // in the documentation and/or other materials provided with the
3760 // distribution.
3761 //     * Neither the name of Google Inc. nor the names of its
3762 // contributors may be used to endorse or promote products derived from
3763 // this software without specific prior written permission.
3764 //
3765 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
3766 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
3767 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
3768 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
3769 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
3770 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
3771 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
3772 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
3773 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
3774 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
3775 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
3776 //
3777 // Author: wan@google.com (Zhanyong Wan)
3778
3779 // Type utilities needed for implementing typed and type-parameterized
3780 // tests.  This file is generated by a SCRIPT.  DO NOT EDIT BY HAND!
3781 //
3782 // Currently we support at most 50 types in a list, and at most 50
3783 // type-parameterized tests in one type-parameterized test case.
3784 // Please contact googletestframework@googlegroups.com if you need
3785 // more.
3786
3787 #ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_TYPE_UTIL_H_
3788 #define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_TYPE_UTIL_H_
3789
3790
3791 // #ifdef __GNUC__ is too general here.  It is possible to use gcc without using
3792 // libstdc++ (which is where cxxabi.h comes from).
3793 # if GTEST_HAS_CXXABI_H_
3794 #  include <cxxabi.h>
3795 # elif defined(__HP_aCC)
3796 #  include <acxx_demangle.h>
3797 # endif  // GTEST_HASH_CXXABI_H_
3798
3799 namespace testing {
3800 namespace internal {
3801
3802 // GetTypeName<T>() returns a human-readable name of type T.
3803 // NB: This function is also used in Google Mock, so don't move it inside of
3804 // the typed-test-only section below.
3805 template <typename T>
3806 std::string GetTypeName() {
3807 # if GTEST_HAS_RTTI
3808
3809   const char* const name = typeid(T).name();
3810 #  if GTEST_HAS_CXXABI_H_ || defined(__HP_aCC)
3811   int status = 0;
3812   // gcc's implementation of typeid(T).name() mangles the type name,
3813   // so we have to demangle it.
3814 #   if GTEST_HAS_CXXABI_H_
3815   using abi::__cxa_demangle;
3816 #   endif  // GTEST_HAS_CXXABI_H_
3817   char* const readable_name = __cxa_demangle(name, 0, 0, &status);
3818   const std::string name_str(status == 0 ? readable_name : name);
3819   free(readable_name);
3820   return name_str;
3821 #  else
3822   return name;
3823 #  endif  // GTEST_HAS_CXXABI_H_ || __HP_aCC
3824
3825 # else
3826
3827   return "<type>";
3828
3829 # endif  // GTEST_HAS_RTTI
3830 }
3831
3832 #if GTEST_HAS_TYPED_TEST || GTEST_HAS_TYPED_TEST_P
3833
3834 // AssertyTypeEq<T1, T2>::type is defined iff T1 and T2 are the same
3835 // type.  This can be used as a compile-time assertion to ensure that
3836 // two types are equal.
3837
3838 template <typename T1, typename T2>
3839 struct AssertTypeEq;
3840
3841 template <typename T>
3842 struct AssertTypeEq<T, T> {
3843   typedef bool type;
3844 };
3845
3846 // A unique type used as the default value for the arguments of class
3847 // template Types.  This allows us to simulate variadic templates
3848 // (e.g. Types<int>, Type<int, double>, and etc), which C++ doesn't
3849 // support directly.
3850 struct None {};
3851
3852 // The following family of struct and struct templates are used to
3853 // represent type lists.  In particular, TypesN<T1, T2, ..., TN>
3854 // represents a type list with N types (T1, T2, ..., and TN) in it.
3855 // Except for Types0, every struct in the family has two member types:
3856 // Head for the first type in the list, and Tail for the rest of the
3857 // list.
3858
3859 // The empty type list.
3860 struct Types0 {};
3861
3862 // Type lists of length 1, 2, 3, and so on.
3863
3864 template <typename T1>
3865 struct Types1 {
3866   typedef T1 Head;
3867   typedef Types0 Tail;
3868 };
3869 template <typename T1, typename T2>
3870 struct Types2 {
3871   typedef T1 Head;
3872   typedef Types1<T2> Tail;
3873 };
3874
3875 template <typename T1, typename T2, typename T3>
3876 struct Types3 {
3877   typedef T1 Head;
3878   typedef Types2<T2, T3> Tail;
3879 };
3880
3881 template <typename T1, typename T2, typename T3, typename T4>
3882 struct Types4 {
3883   typedef T1 Head;
3884   typedef Types3<T2, T3, T4> Tail;
3885 };
3886
3887 template <typename T1, typename T2, typename T3, typename T4, typename T5>
3888 struct Types5 {
3889   typedef T1 Head;
3890   typedef Types4<T2, T3, T4, T5> Tail;
3891 };
3892
3893 template <typename T1, typename T2, typename T3, typename T4, typename T5,
3894     typename T6>
3895 struct Types6 {
3896   typedef T1 Head;
3897   typedef Types5<T2, T3, T4, T5, T6> Tail;
3898 };
3899
3900 template <typename T1, typename T2, typename T3, typename T4, typename T5,
3901     typename T6, typename T7>
3902 struct Types7 {
3903   typedef T1 Head;
3904   typedef Types6<T2, T3, T4, T5, T6, T7> Tail;
3905 };
3906
3907 template <typename T1, typename T2, typename T3, typename T4, typename T5,
3908     typename T6, typename T7, typename T8>
3909 struct Types8 {
3910   typedef T1 Head;
3911   typedef Types7<T2, T3, T4, T5, T6, T7, T8> Tail;
3912 };
3913
3914 template <typename T1, typename T2, typename T3, typename T4, typename T5,
3915     typename T6, typename T7, typename T8, typename T9>
3916 struct Types9 {
3917   typedef T1 Head;
3918   typedef Types8<T2, T3, T4, T5, T6, T7, T8, T9> Tail;
3919 };
3920
3921 template <typename T1, typename T2, typename T3, typename T4, typename T5,
3922     typename T6, typename T7, typename T8, typename T9, typename T10>
3923 struct Types10 {
3924   typedef T1 Head;
3925   typedef Types9<T2, T3, T4, T5, T6, T7, T8, T9, T10> Tail;
3926 };
3927
3928 template <typename T1, typename T2, typename T3, typename T4, typename T5,
3929     typename T6, typename T7, typename T8, typename T9, typename T10,
3930     typename T11>
3931 struct Types11 {
3932   typedef T1 Head;
3933   typedef Types10<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11> Tail;
3934 };
3935
3936 template <typename T1, typename T2, typename T3, typename T4, typename T5,
3937     typename T6, typename T7, typename T8, typename T9, typename T10,
3938     typename T11, typename T12>
3939 struct Types12 {
3940   typedef T1 Head;
3941   typedef Types11<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12> Tail;
3942 };
3943
3944 template <typename T1, typename T2, typename T3, typename T4, typename T5,
3945     typename T6, typename T7, typename T8, typename T9, typename T10,
3946     typename T11, typename T12, typename T13>
3947 struct Types13 {
3948   typedef T1 Head;
3949   typedef Types12<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13> Tail;
3950 };
3951
3952 template <typename T1, typename T2, typename T3, typename T4, typename T5,
3953     typename T6, typename T7, typename T8, typename T9, typename T10,
3954     typename T11, typename T12, typename T13, typename T14>
3955 struct Types14 {
3956   typedef T1 Head;
3957   typedef Types13<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14> Tail;
3958 };
3959
3960 template <typename T1, typename T2, typename T3, typename T4, typename T5,
3961     typename T6, typename T7, typename T8, typename T9, typename T10,
3962     typename T11, typename T12, typename T13, typename T14, typename T15>
3963 struct Types15 {
3964   typedef T1 Head;
3965   typedef Types14<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
3966       T15> Tail;
3967 };
3968
3969 template <typename T1, typename T2, typename T3, typename T4, typename T5,
3970     typename T6, typename T7, typename T8, typename T9, typename T10,
3971     typename T11, typename T12, typename T13, typename T14, typename T15,
3972     typename T16>
3973 struct Types16 {
3974   typedef T1 Head;
3975   typedef Types15<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
3976       T16> Tail;
3977 };
3978
3979 template <typename T1, typename T2, typename T3, typename T4, typename T5,
3980     typename T6, typename T7, typename T8, typename T9, typename T10,
3981     typename T11, typename T12, typename T13, typename T14, typename T15,
3982     typename T16, typename T17>
3983 struct Types17 {
3984   typedef T1 Head;
3985   typedef Types16<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
3986       T16, T17> Tail;
3987 };
3988
3989 template <typename T1, typename T2, typename T3, typename T4, typename T5,
3990     typename T6, typename T7, typename T8, typename T9, typename T10,
3991     typename T11, typename T12, typename T13, typename T14, typename T15,
3992     typename T16, typename T17, typename T18>
3993 struct Types18 {
3994   typedef T1 Head;
3995   typedef Types17<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
3996       T16, T17, T18> Tail;
3997 };
3998
3999 template <typename T1, typename T2, typename T3, typename T4, typename T5,
4000     typename T6, typename T7, typename T8, typename T9, typename T10,
4001     typename T11, typename T12, typename T13, typename T14, typename T15,
4002     typename T16, typename T17, typename T18, typename T19>
4003 struct Types19 {
4004   typedef T1 Head;
4005   typedef Types18<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
4006       T16, T17, T18, T19> Tail;
4007 };
4008
4009 template <typename T1, typename T2, typename T3, typename T4, typename T5,
4010     typename T6, typename T7, typename T8, typename T9, typename T10,
4011     typename T11, typename T12, typename T13, typename T14, typename T15,
4012     typename T16, typename T17, typename T18, typename T19, typename T20>
4013 struct Types20 {
4014   typedef T1 Head;
4015   typedef Types19<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
4016       T16, T17, T18, T19, T20> Tail;
4017 };
4018
4019 template <typename T1, typename T2, typename T3, typename T4, typename T5,
4020     typename T6, typename T7, typename T8, typename T9, typename T10,
4021     typename T11, typename T12, typename T13, typename T14, typename T15,
4022     typename T16, typename T17, typename T18, typename T19, typename T20,
4023     typename T21>
4024 struct Types21 {
4025   typedef T1 Head;
4026   typedef Types20<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
4027       T16, T17, T18, T19, T20, T21> Tail;
4028 };
4029
4030 template <typename T1, typename T2, typename T3, typename T4, typename T5,
4031     typename T6, typename T7, typename T8, typename T9, typename T10,
4032     typename T11, typename T12, typename T13, typename T14, typename T15,
4033     typename T16, typename T17, typename T18, typename T19, typename T20,
4034     typename T21, typename T22>
4035 struct Types22 {
4036   typedef T1 Head;
4037   typedef Types21<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
4038       T16, T17, T18, T19, T20, T21, T22> Tail;
4039 };
4040
4041 template <typename T1, typename T2, typename T3, typename T4, typename T5,
4042     typename T6, typename T7, typename T8, typename T9, typename T10,
4043     typename T11, typename T12, typename T13, typename T14, typename T15,
4044     typename T16, typename T17, typename T18, typename T19, typename T20,
4045     typename T21, typename T22, typename T23>
4046 struct Types23 {
4047   typedef T1 Head;
4048   typedef Types22<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
4049       T16, T17, T18, T19, T20, T21, T22, T23> Tail;
4050 };
4051
4052 template <typename T1, typename T2, typename T3, typename T4, typename T5,
4053     typename T6, typename T7, typename T8, typename T9, typename T10,
4054     typename T11, typename T12, typename T13, typename T14, typename T15,
4055     typename T16, typename T17, typename T18, typename T19, typename T20,
4056     typename T21, typename T22, typename T23, typename T24>
4057 struct Types24 {
4058   typedef T1 Head;
4059   typedef Types23<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
4060       T16, T17, T18, T19, T20, T21, T22, T23, T24> Tail;
4061 };
4062
4063 template <typename T1, typename T2, typename T3, typename T4, typename T5,
4064     typename T6, typename T7, typename T8, typename T9, typename T10,
4065     typename T11, typename T12, typename T13, typename T14, typename T15,
4066     typename T16, typename T17, typename T18, typename T19, typename T20,
4067     typename T21, typename T22, typename T23, typename T24, typename T25>
4068 struct Types25 {
4069   typedef T1 Head;
4070   typedef Types24<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
4071       T16, T17, T18, T19, T20, T21, T22, T23, T24, T25> Tail;
4072 };
4073
4074 template <typename T1, typename T2, typename T3, typename T4, typename T5,
4075     typename T6, typename T7, typename T8, typename T9, typename T10,
4076     typename T11, typename T12, typename T13, typename T14, typename T15,
4077     typename T16, typename T17, typename T18, typename T19, typename T20,
4078     typename T21, typename T22, typename T23, typename T24, typename T25,
4079     typename T26>
4080 struct Types26 {
4081   typedef T1 Head;
4082   typedef Types25<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
4083       T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26> Tail;
4084 };
4085
4086 template <typename T1, typename T2, typename T3, typename T4, typename T5,
4087     typename T6, typename T7, typename T8, typename T9, typename T10,
4088     typename T11, typename T12, typename T13, typename T14, typename T15,
4089     typename T16, typename T17, typename T18, typename T19, typename T20,
4090     typename T21, typename T22, typename T23, typename T24, typename T25,
4091     typename T26, typename T27>
4092 struct Types27 {
4093   typedef T1 Head;
4094   typedef Types26<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
4095       T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27> Tail;
4096 };
4097
4098 template <typename T1, typename T2, typename T3, typename T4, typename T5,
4099     typename T6, typename T7, typename T8, typename T9, typename T10,
4100     typename T11, typename T12, typename T13, typename T14, typename T15,
4101     typename T16, typename T17, typename T18, typename T19, typename T20,
4102     typename T21, typename T22, typename T23, typename T24, typename T25,
4103     typename T26, typename T27, typename T28>
4104 struct Types28 {
4105   typedef T1 Head;
4106   typedef Types27<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
4107       T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28> Tail;
4108 };
4109
4110 template <typename T1, typename T2, typename T3, typename T4, typename T5,
4111     typename T6, typename T7, typename T8, typename T9, typename T10,
4112     typename T11, typename T12, typename T13, typename T14, typename T15,
4113     typename T16, typename T17, typename T18, typename T19, typename T20,
4114     typename T21, typename T22, typename T23, typename T24, typename T25,
4115     typename T26, typename T27, typename T28, typename T29>
4116 struct Types29 {
4117   typedef T1 Head;
4118   typedef Types28<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
4119       T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
4120       T29> Tail;
4121 };
4122
4123 template <typename T1, typename T2, typename T3, typename T4, typename T5,
4124     typename T6, typename T7, typename T8, typename T9, typename T10,
4125     typename T11, typename T12, typename T13, typename T14, typename T15,
4126     typename T16, typename T17, typename T18, typename T19, typename T20,
4127     typename T21, typename T22, typename T23, typename T24, typename T25,
4128     typename T26, typename T27, typename T28, typename T29, typename T30>
4129 struct Types30 {
4130   typedef T1 Head;
4131   typedef Types29<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
4132       T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
4133       T30> Tail;
4134 };
4135
4136 template <typename T1, typename T2, typename T3, typename T4, typename T5,
4137     typename T6, typename T7, typename T8, typename T9, typename T10,
4138     typename T11, typename T12, typename T13, typename T14, typename T15,
4139     typename T16, typename T17, typename T18, typename T19, typename T20,
4140     typename T21, typename T22, typename T23, typename T24, typename T25,
4141     typename T26, typename T27, typename T28, typename T29, typename T30,
4142     typename T31>
4143 struct Types31 {
4144   typedef T1 Head;
4145   typedef Types30<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
4146       T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
4147       T30, T31> Tail;
4148 };
4149
4150 template <typename T1, typename T2, typename T3, typename T4, typename T5,
4151     typename T6, typename T7, typename T8, typename T9, typename T10,
4152     typename T11, typename T12, typename T13, typename T14, typename T15,
4153     typename T16, typename T17, typename T18, typename T19, typename T20,
4154     typename T21, typename T22, typename T23, typename T24, typename T25,
4155     typename T26, typename T27, typename T28, typename T29, typename T30,
4156     typename T31, typename T32>
4157 struct Types32 {
4158   typedef T1 Head;
4159   typedef Types31<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
4160       T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
4161       T30, T31, T32> Tail;
4162 };
4163
4164 template <typename T1, typename T2, typename T3, typename T4, typename T5,
4165     typename T6, typename T7, typename T8, typename T9, typename T10,
4166     typename T11, typename T12, typename T13, typename T14, typename T15,
4167     typename T16, typename T17, typename T18, typename T19, typename T20,
4168     typename T21, typename T22, typename T23, typename T24, typename T25,
4169     typename T26, typename T27, typename T28, typename T29, typename T30,
4170     typename T31, typename T32, typename T33>
4171 struct Types33 {
4172   typedef T1 Head;
4173   typedef Types32<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
4174       T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
4175       T30, T31, T32, T33> Tail;
4176 };
4177
4178 template <typename T1, typename T2, typename T3, typename T4, typename T5,
4179     typename T6, typename T7, typename T8, typename T9, typename T10,
4180     typename T11, typename T12, typename T13, typename T14, typename T15,
4181     typename T16, typename T17, typename T18, typename T19, typename T20,
4182     typename T21, typename T22, typename T23, typename T24, typename T25,
4183     typename T26, typename T27, typename T28, typename T29, typename T30,
4184     typename T31, typename T32, typename T33, typename T34>
4185 struct Types34 {
4186   typedef T1 Head;
4187   typedef Types33<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
4188       T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
4189       T30, T31, T32, T33, T34> Tail;
4190 };
4191
4192 template <typename T1, typename T2, typename T3, typename T4, typename T5,
4193     typename T6, typename T7, typename T8, typename T9, typename T10,
4194     typename T11, typename T12, typename T13, typename T14, typename T15,
4195     typename T16, typename T17, typename T18, typename T19, typename T20,
4196     typename T21, typename T22, typename T23, typename T24, typename T25,
4197     typename T26, typename T27, typename T28, typename T29, typename T30,
4198     typename T31, typename T32, typename T33, typename T34, typename T35>
4199 struct Types35 {
4200   typedef T1 Head;
4201   typedef Types34<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
4202       T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
4203       T30, T31, T32, T33, T34, T35> Tail;
4204 };
4205
4206 template <typename T1, typename T2, typename T3, typename T4, typename T5,
4207     typename T6, typename T7, typename T8, typename T9, typename T10,
4208     typename T11, typename T12, typename T13, typename T14, typename T15,
4209     typename T16, typename T17, typename T18, typename T19, typename T20,
4210     typename T21, typename T22, typename T23, typename T24, typename T25,
4211     typename T26, typename T27, typename T28, typename T29, typename T30,
4212     typename T31, typename T32, typename T33, typename T34, typename T35,
4213     typename T36>
4214 struct Types36 {
4215   typedef T1 Head;
4216   typedef Types35<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
4217       T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
4218       T30, T31, T32, T33, T34, T35, T36> Tail;
4219 };
4220
4221 template <typename T1, typename T2, typename T3, typename T4, typename T5,
4222     typename T6, typename T7, typename T8, typename T9, typename T10,
4223     typename T11, typename T12, typename T13, typename T14, typename T15,
4224     typename T16, typename T17, typename T18, typename T19, typename T20,
4225     typename T21, typename T22, typename T23, typename T24, typename T25,
4226     typename T26, typename T27, typename T28, typename T29, typename T30,
4227     typename T31, typename T32, typename T33, typename T34, typename T35,
4228     typename T36, typename T37>
4229 struct Types37 {
4230   typedef T1 Head;
4231   typedef Types36<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
4232       T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
4233       T30, T31, T32, T33, T34, T35, T36, T37> Tail;
4234 };
4235
4236 template <typename T1, typename T2, typename T3, typename T4, typename T5,
4237     typename T6, typename T7, typename T8, typename T9, typename T10,
4238     typename T11, typename T12, typename T13, typename T14, typename T15,
4239     typename T16, typename T17, typename T18, typename T19, typename T20,
4240     typename T21, typename T22, typename T23, typename T24, typename T25,
4241     typename T26, typename T27, typename T28, typename T29, typename T30,
4242     typename T31, typename T32, typename T33, typename T34, typename T35,
4243     typename T36, typename T37, typename T38>
4244 struct Types38 {
4245   typedef T1 Head;
4246   typedef Types37<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
4247       T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
4248       T30, T31, T32, T33, T34, T35, T36, T37, T38> Tail;
4249 };
4250
4251 template <typename T1, typename T2, typename T3, typename T4, typename T5,
4252     typename T6, typename T7, typename T8, typename T9, typename T10,
4253     typename T11, typename T12, typename T13, typename T14, typename T15,
4254     typename T16, typename T17, typename T18, typename T19, typename T20,
4255     typename T21, typename T22, typename T23, typename T24, typename T25,
4256     typename T26, typename T27, typename T28, typename T29, typename T30,
4257     typename T31, typename T32, typename T33, typename T34, typename T35,
4258     typename T36, typename T37, typename T38, typename T39>
4259 struct Types39 {
4260   typedef T1 Head;
4261   typedef Types38<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
4262       T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
4263       T30, T31, T32, T33, T34, T35, T36, T37, T38, T39> Tail;
4264 };
4265
4266 template <typename T1, typename T2, typename T3, typename T4, typename T5,
4267     typename T6, typename T7, typename T8, typename T9, typename T10,
4268     typename T11, typename T12, typename T13, typename T14, typename T15,
4269     typename T16, typename T17, typename T18, typename T19, typename T20,
4270     typename T21, typename T22, typename T23, typename T24, typename T25,
4271     typename T26, typename T27, typename T28, typename T29, typename T30,
4272     typename T31, typename T32, typename T33, typename T34, typename T35,
4273     typename T36, typename T37, typename T38, typename T39, typename T40>
4274 struct Types40 {
4275   typedef T1 Head;
4276   typedef Types39<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
4277       T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
4278       T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40> Tail;
4279 };
4280
4281 template <typename T1, typename T2, typename T3, typename T4, typename T5,
4282     typename T6, typename T7, typename T8, typename T9, typename T10,
4283     typename T11, typename T12, typename T13, typename T14, typename T15,
4284     typename T16, typename T17, typename T18, typename T19, typename T20,
4285     typename T21, typename T22, typename T23, typename T24, typename T25,
4286     typename T26, typename T27, typename T28, typename T29, typename T30,
4287     typename T31, typename T32, typename T33, typename T34, typename T35,
4288     typename T36, typename T37, typename T38, typename T39, typename T40,
4289     typename T41>
4290 struct Types41 {
4291   typedef T1 Head;
4292   typedef Types40<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
4293       T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
4294       T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41> Tail;
4295 };
4296
4297 template <typename T1, typename T2, typename T3, typename T4, typename T5,
4298     typename T6, typename T7, typename T8, typename T9, typename T10,
4299     typename T11, typename T12, typename T13, typename T14, typename T15,
4300     typename T16, typename T17, typename T18, typename T19, typename T20,
4301     typename T21, typename T22, typename T23, typename T24, typename T25,
4302     typename T26, typename T27, typename T28, typename T29, typename T30,
4303     typename T31, typename T32, typename T33, typename T34, typename T35,
4304     typename T36, typename T37, typename T38, typename T39, typename T40,
4305     typename T41, typename T42>
4306 struct Types42 {
4307   typedef T1 Head;
4308   typedef Types41<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
4309       T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
4310       T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42> Tail;
4311 };
4312
4313 template <typename T1, typename T2, typename T3, typename T4, typename T5,
4314     typename T6, typename T7, typename T8, typename T9, typename T10,
4315     typename T11, typename T12, typename T13, typename T14, typename T15,
4316     typename T16, typename T17, typename T18, typename T19, typename T20,
4317     typename T21, typename T22, typename T23, typename T24, typename T25,
4318     typename T26, typename T27, typename T28, typename T29, typename T30,
4319     typename T31, typename T32, typename T33, typename T34, typename T35,
4320     typename T36, typename T37, typename T38, typename T39, typename T40,
4321     typename T41, typename T42, typename T43>
4322 struct Types43 {
4323   typedef T1 Head;
4324   typedef Types42<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
4325       T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
4326       T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42,
4327       T43> Tail;
4328 };
4329
4330 template <typename T1, typename T2, typename T3, typename T4, typename T5,
4331     typename T6, typename T7, typename T8, typename T9, typename T10,
4332     typename T11, typename T12, typename T13, typename T14, typename T15,
4333     typename T16, typename T17, typename T18, typename T19, typename T20,
4334     typename T21, typename T22, typename T23, typename T24, typename T25,
4335     typename T26, typename T27, typename T28, typename T29, typename T30,
4336     typename T31, typename T32, typename T33, typename T34, typename T35,
4337     typename T36, typename T37, typename T38, typename T39, typename T40,
4338     typename T41, typename T42, typename T43, typename T44>
4339 struct Types44 {
4340   typedef T1 Head;
4341   typedef Types43<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
4342       T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
4343       T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43,
4344       T44> Tail;
4345 };
4346
4347 template <typename T1, typename T2, typename T3, typename T4, typename T5,
4348     typename T6, typename T7, typename T8, typename T9, typename T10,
4349     typename T11, typename T12, typename T13, typename T14, typename T15,
4350     typename T16, typename T17, typename T18, typename T19, typename T20,
4351     typename T21, typename T22, typename T23, typename T24, typename T25,
4352     typename T26, typename T27, typename T28, typename T29, typename T30,
4353     typename T31, typename T32, typename T33, typename T34, typename T35,
4354     typename T36, typename T37, typename T38, typename T39, typename T40,
4355     typename T41, typename T42, typename T43, typename T44, typename T45>
4356 struct Types45 {
4357   typedef T1 Head;
4358   typedef Types44<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
4359       T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
4360       T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43,
4361       T44, T45> Tail;
4362 };
4363
4364 template <typename T1, typename T2, typename T3, typename T4, typename T5,
4365     typename T6, typename T7, typename T8, typename T9, typename T10,
4366     typename T11, typename T12, typename T13, typename T14, typename T15,
4367     typename T16, typename T17, typename T18, typename T19, typename T20,
4368     typename T21, typename T22, typename T23, typename T24, typename T25,
4369     typename T26, typename T27, typename T28, typename T29, typename T30,
4370     typename T31, typename T32, typename T33, typename T34, typename T35,
4371     typename T36, typename T37, typename T38, typename T39, typename T40,
4372     typename T41, typename T42, typename T43, typename T44, typename T45,
4373     typename T46>
4374 struct Types46 {
4375   typedef T1 Head;
4376   typedef Types45<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
4377       T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
4378       T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43,
4379       T44, T45, T46> Tail;
4380 };
4381
4382 template <typename T1, typename T2, typename T3, typename T4, typename T5,
4383     typename T6, typename T7, typename T8, typename T9, typename T10,
4384     typename T11, typename T12, typename T13, typename T14, typename T15,
4385     typename T16, typename T17, typename T18, typename T19, typename T20,
4386     typename T21, typename T22, typename T23, typename T24, typename T25,
4387     typename T26, typename T27, typename T28, typename T29, typename T30,
4388     typename T31, typename T32, typename T33, typename T34, typename T35,
4389     typename T36, typename T37, typename T38, typename T39, typename T40,
4390     typename T41, typename T42, typename T43, typename T44, typename T45,
4391     typename T46, typename T47>
4392 struct Types47 {
4393   typedef T1 Head;
4394   typedef Types46<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
4395       T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
4396       T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43,
4397       T44, T45, T46, T47> Tail;
4398 };
4399
4400 template <typename T1, typename T2, typename T3, typename T4, typename T5,
4401     typename T6, typename T7, typename T8, typename T9, typename T10,
4402     typename T11, typename T12, typename T13, typename T14, typename T15,
4403     typename T16, typename T17, typename T18, typename T19, typename T20,
4404     typename T21, typename T22, typename T23, typename T24, typename T25,
4405     typename T26, typename T27, typename T28, typename T29, typename T30,
4406     typename T31, typename T32, typename T33, typename T34, typename T35,
4407     typename T36, typename T37, typename T38, typename T39, typename T40,
4408     typename T41, typename T42, typename T43, typename T44, typename T45,
4409     typename T46, typename T47, typename T48>
4410 struct Types48 {
4411   typedef T1 Head;
4412   typedef Types47<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
4413       T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
4414       T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43,
4415       T44, T45, T46, T47, T48> Tail;
4416 };
4417
4418 template <typename T1, typename T2, typename T3, typename T4, typename T5,
4419     typename T6, typename T7, typename T8, typename T9, typename T10,
4420     typename T11, typename T12, typename T13, typename T14, typename T15,
4421     typename T16, typename T17, typename T18, typename T19, typename T20,
4422     typename T21, typename T22, typename T23, typename T24, typename T25,
4423     typename T26, typename T27, typename T28, typename T29, typename T30,
4424     typename T31, typename T32, typename T33, typename T34, typename T35,
4425     typename T36, typename T37, typename T38, typename T39, typename T40,
4426     typename T41, typename T42, typename T43, typename T44, typename T45,
4427     typename T46, typename T47, typename T48, typename T49>
4428 struct Types49 {
4429   typedef T1 Head;
4430   typedef Types48<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
4431       T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
4432       T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43,
4433       T44, T45, T46, T47, T48, T49> Tail;
4434 };
4435
4436 template <typename T1, typename T2, typename T3, typename T4, typename T5,
4437     typename T6, typename T7, typename T8, typename T9, typename T10,
4438     typename T11, typename T12, typename T13, typename T14, typename T15,
4439     typename T16, typename T17, typename T18, typename T19, typename T20,
4440     typename T21, typename T22, typename T23, typename T24, typename T25,
4441     typename T26, typename T27, typename T28, typename T29, typename T30,
4442     typename T31, typename T32, typename T33, typename T34, typename T35,
4443     typename T36, typename T37, typename T38, typename T39, typename T40,
4444     typename T41, typename T42, typename T43, typename T44, typename T45,
4445     typename T46, typename T47, typename T48, typename T49, typename T50>
4446 struct Types50 {
4447   typedef T1 Head;
4448   typedef Types49<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
4449       T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
4450       T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43,
4451       T44, T45, T46, T47, T48, T49, T50> Tail;
4452 };
4453
4454
4455 }  // namespace internal
4456
4457 // We don't want to require the users to write TypesN<...> directly,
4458 // as that would require them to count the length.  Types<...> is much
4459 // easier to write, but generates horrible messages when there is a
4460 // compiler error, as gcc insists on printing out each template
4461 // argument, even if it has the default value (this means Types<int>
4462 // will appear as Types<int, None, None, ..., None> in the compiler
4463 // errors).
4464 //
4465 // Our solution is to combine the best part of the two approaches: a
4466 // user would write Types<T1, ..., TN>, and Google Test will translate
4467 // that to TypesN<T1, ..., TN> internally to make error messages
4468 // readable.  The translation is done by the 'type' member of the
4469 // Types template.
4470 template <typename T1 = internal::None, typename T2 = internal::None,
4471     typename T3 = internal::None, typename T4 = internal::None,
4472     typename T5 = internal::None, typename T6 = internal::None,
4473     typename T7 = internal::None, typename T8 = internal::None,
4474     typename T9 = internal::None, typename T10 = internal::None,
4475     typename T11 = internal::None, typename T12 = internal::None,
4476     typename T13 = internal::None, typename T14 = internal::None,
4477     typename T15 = internal::None, typename T16 = internal::None,
4478     typename T17 = internal::None, typename T18 = internal::None,
4479     typename T19 = internal::None, typename T20 = internal::None,
4480     typename T21 = internal::None, typename T22 = internal::None,
4481     typename T23 = internal::None, typename T24 = internal::None,
4482     typename T25 = internal::None, typename T26 = internal::None,
4483     typename T27 = internal::None, typename T28 = internal::None,
4484     typename T29 = internal::None, typename T30 = internal::None,
4485     typename T31 = internal::None, typename T32 = internal::None,
4486     typename T33 = internal::None, typename T34 = internal::None,
4487     typename T35 = internal::None, typename T36 = internal::None,
4488     typename T37 = internal::None, typename T38 = internal::None,
4489     typename T39 = internal::None, typename T40 = internal::None,
4490     typename T41 = internal::None, typename T42 = internal::None,
4491     typename T43 = internal::None, typename T44 = internal::None,
4492     typename T45 = internal::None, typename T46 = internal::None,
4493     typename T47 = internal::None, typename T48 = internal::None,
4494     typename T49 = internal::None, typename T50 = internal::None>
4495 struct Types {
4496   typedef internal::Types50<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
4497       T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
4498       T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40,
4499       T41, T42, T43, T44, T45, T46, T47, T48, T49, T50> type;
4500 };
4501
4502 template <>
4503 struct Types<internal::None, internal::None, internal::None, internal::None,
4504     internal::None, internal::None, internal::None, internal::None,
4505     internal::None, internal::None, internal::None, internal::None,
4506     internal::None, internal::None, internal::None, internal::None,
4507     internal::None, internal::None, internal::None, internal::None,
4508     internal::None, internal::None, internal::None, internal::None,
4509     internal::None, internal::None, internal::None, internal::None,
4510     internal::None, internal::None, internal::None, internal::None,
4511     internal::None, internal::None, internal::None, internal::None,
4512     internal::None, internal::None, internal::None, internal::None,
4513     internal::None, internal::None, internal::None, internal::None,
4514     internal::None, internal::None, internal::None, internal::None,
4515     internal::None, internal::None> {
4516   typedef internal::Types0 type;
4517 };
4518 template <typename T1>
4519 struct Types<T1, internal::None, internal::None, internal::None,
4520     internal::None, internal::None, internal::None, internal::None,
4521     internal::None, internal::None, internal::None, internal::None,
4522     internal::None, internal::None, internal::None, internal::None,
4523     internal::None, internal::None, internal::None, internal::None,
4524     internal::None, internal::None, internal::None, internal::None,
4525     internal::None, internal::None, internal::None, internal::None,
4526     internal::None, internal::None, internal::None, internal::None,
4527     internal::None, internal::None, internal::None, internal::None,
4528     internal::None, internal::None, internal::None, internal::None,
4529     internal::None, internal::None, internal::None, internal::None,
4530     internal::None, internal::None, internal::None, internal::None,
4531     internal::None, internal::None> {
4532   typedef internal::Types1<T1> type;
4533 };
4534 template <typename T1, typename T2>
4535 struct Types<T1, T2, internal::None, internal::None, internal::None,
4536     internal::None, internal::None, internal::None, internal::None,
4537     internal::None, internal::None, internal::None, internal::None,
4538     internal::None, internal::None, internal::None, internal::None,
4539     internal::None, internal::None, internal::None, internal::None,
4540     internal::None, internal::None, internal::None, internal::None,
4541     internal::None, internal::None, internal::None, internal::None,
4542     internal::None, internal::None, internal::None, internal::None,
4543     internal::None, internal::None, internal::None, internal::None,
4544     internal::None, internal::None, internal::None, internal::None,
4545     internal::None, internal::None, internal::None, internal::None,
4546     internal::None, internal::None, internal::None, internal::None,
4547     internal::None> {
4548   typedef internal::Types2<T1, T2> type;
4549 };
4550 template <typename T1, typename T2, typename T3>
4551 struct Types<T1, T2, T3, internal::None, internal::None, internal::None,
4552     internal::None, internal::None, internal::None, internal::None,
4553     internal::None, internal::None, internal::None, internal::None,
4554     internal::None, internal::None, internal::None, internal::None,
4555     internal::None, internal::None, internal::None, internal::None,
4556     internal::None, internal::None, internal::None, internal::None,
4557     internal::None, internal::None, internal::None, internal::None,
4558     internal::None, internal::None, internal::None, internal::None,
4559     internal::None, internal::None, internal::None, internal::None,
4560     internal::None, internal::None, internal::None, internal::None,
4561     internal::None, internal::None, internal::None, internal::None,
4562     internal::None, internal::None, internal::None, internal::None> {
4563   typedef internal::Types3<T1, T2, T3> type;
4564 };
4565 template <typename T1, typename T2, typename T3, typename T4>
4566 struct Types<T1, T2, T3, T4, internal::None, internal::None, internal::None,
4567     internal::None, internal::None, internal::None, internal::None,
4568     internal::None, internal::None, internal::None, internal::None,
4569     internal::None, internal::None, internal::None, internal::None,
4570     internal::None, internal::None, internal::None, internal::None,
4571     internal::None, internal::None, internal::None, internal::None,
4572     internal::None, internal::None, internal::None, internal::None,
4573     internal::None, internal::None, internal::None, internal::None,
4574     internal::None, internal::None, internal::None, internal::None,
4575     internal::None, internal::None, internal::None, internal::None,
4576     internal::None, internal::None, internal::None, internal::None,
4577     internal::None, internal::None, internal::None> {
4578   typedef internal::Types4<T1, T2, T3, T4> type;
4579 };
4580 template <typename T1, typename T2, typename T3, typename T4, typename T5>
4581 struct Types<T1, T2, T3, T4, T5, internal::None, internal::None,
4582     internal::None, internal::None, internal::None, internal::None,
4583     internal::None, internal::None, internal::None, internal::None,
4584     internal::None, internal::None, internal::None, internal::None,
4585     internal::None, internal::None, internal::None, internal::None,
4586     internal::None, internal::None, internal::None, internal::None,
4587     internal::None, internal::None, internal::None, internal::None,
4588     internal::None, internal::None, internal::None, internal::None,
4589     internal::None, internal::None, internal::None, internal::None,
4590     internal::None, internal::None, internal::None, internal::None,
4591     internal::None, internal::None, internal::None, internal::None,
4592     internal::None, internal::None, internal::None> {
4593   typedef internal::Types5<T1, T2, T3, T4, T5> type;
4594 };
4595 template <typename T1, typename T2, typename T3, typename T4, typename T5,
4596     typename T6>
4597 struct Types<T1, T2, T3, T4, T5, T6, internal::None, internal::None,
4598     internal::None, internal::None, internal::None, internal::None,
4599     internal::None, internal::None, internal::None, internal::None,
4600     internal::None, internal::None, internal::None, internal::None,
4601     internal::None, internal::None, internal::None, internal::None,
4602     internal::None, internal::None, internal::None, internal::None,
4603     internal::None, internal::None, internal::None, internal::None,
4604     internal::None, internal::None, internal::None, internal::None,
4605     internal::None, internal::None, internal::None, internal::None,
4606     internal::None, internal::None, internal::None, internal::None,
4607     internal::None, internal::None, internal::None, internal::None,
4608     internal::None, internal::None> {
4609   typedef internal::Types6<T1, T2, T3, T4, T5, T6> type;
4610 };
4611 template <typename T1, typename T2, typename T3, typename T4, typename T5,
4612     typename T6, typename T7>
4613 struct Types<T1, T2, T3, T4, T5, T6, T7, internal::None, internal::None,
4614     internal::None, internal::None, internal::None, internal::None,
4615     internal::None, internal::None, internal::None, internal::None,
4616     internal::None, internal::None, internal::None, internal::None,
4617     internal::None, internal::None, internal::None, internal::None,
4618     internal::None, internal::None, internal::None, internal::None,
4619     internal::None, internal::None, internal::None, internal::None,
4620     internal::None, internal::None, internal::None, internal::None,
4621     internal::None, internal::None, internal::None, internal::None,
4622     internal::None, internal::None, internal::None, internal::None,
4623     internal::None, internal::None, internal::None, internal::None,
4624     internal::None> {
4625   typedef internal::Types7<T1, T2, T3, T4, T5, T6, T7> type;
4626 };
4627 template <typename T1, typename T2, typename T3, typename T4, typename T5,
4628     typename T6, typename T7, typename T8>
4629 struct Types<T1, T2, T3, T4, T5, T6, T7, T8, internal::None, internal::None,
4630     internal::None, internal::None, internal::None, internal::None,
4631     internal::None, internal::None, internal::None, internal::None,
4632     internal::None, internal::None, internal::None, internal::None,
4633     internal::None, internal::None, internal::None, internal::None,
4634     internal::None, internal::None, internal::None, internal::None,
4635     internal::None, internal::None, internal::None, internal::None,
4636     internal::None, internal::None, internal::None, internal::None,
4637     internal::None, internal::None, internal::None, internal::None,
4638     internal::None, internal::None, internal::None, internal::None,
4639     internal::None, internal::None, internal::None, internal::None> {
4640   typedef internal::Types8<T1, T2, T3, T4, T5, T6, T7, T8> type;
4641 };
4642 template <typename T1, typename T2, typename T3, typename T4, typename T5,
4643     typename T6, typename T7, typename T8, typename T9>
4644 struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, internal::None,
4645     internal::None, internal::None, internal::None, internal::None,
4646     internal::None, internal::None, internal::None, internal::None,
4647     internal::None, internal::None, internal::None, internal::None,
4648     internal::None, internal::None, internal::None, internal::None,
4649     internal::None, internal::None, internal::None, internal::None,
4650     internal::None, internal::None, internal::None, internal::None,
4651     internal::None, internal::None, internal::None, internal::None,
4652     internal::None, internal::None, internal::None, internal::None,
4653     internal::None, internal::None, internal::None, internal::None,
4654     internal::None, internal::None, internal::None, internal::None> {
4655   typedef internal::Types9<T1, T2, T3, T4, T5, T6, T7, T8, T9> type;
4656 };
4657 template <typename T1, typename T2, typename T3, typename T4, typename T5,
4658     typename T6, typename T7, typename T8, typename T9, typename T10>
4659 struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, internal::None,
4660     internal::None, internal::None, internal::None, internal::None,
4661     internal::None, internal::None, internal::None, internal::None,
4662     internal::None, internal::None, internal::None, internal::None,
4663     internal::None, internal::None, internal::None, internal::None,
4664     internal::None, internal::None, internal::None, internal::None,
4665     internal::None, internal::None, internal::None, internal::None,
4666     internal::None, internal::None, internal::None, internal::None,
4667     internal::None, internal::None, internal::None, internal::None,
4668     internal::None, internal::None, internal::None, internal::None,
4669     internal::None, internal::None, internal::None> {
4670   typedef internal::Types10<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> type;
4671 };
4672 template <typename T1, typename T2, typename T3, typename T4, typename T5,
4673     typename T6, typename T7, typename T8, typename T9, typename T10,
4674     typename T11>
4675 struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, internal::None,
4676     internal::None, internal::None, internal::None, internal::None,
4677     internal::None, internal::None, internal::None, internal::None,
4678     internal::None, internal::None, internal::None, internal::None,
4679     internal::None, internal::None, internal::None, internal::None,
4680     internal::None, internal::None, internal::None, internal::None,
4681     internal::None, internal::None, internal::None, internal::None,
4682     internal::None, internal::None, internal::None, internal::None,
4683     internal::None, internal::None, internal::None, internal::None,
4684     internal::None, internal::None, internal::None, internal::None,
4685     internal::None, internal::None> {
4686   typedef internal::Types11<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11> type;
4687 };
4688 template <typename T1, typename T2, typename T3, typename T4, typename T5,
4689     typename T6, typename T7, typename T8, typename T9, typename T10,
4690     typename T11, typename T12>
4691 struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, internal::None,
4692     internal::None, internal::None, internal::None, internal::None,
4693     internal::None, internal::None, internal::None, internal::None,
4694     internal::None, internal::None, internal::None, internal::None,
4695     internal::None, internal::None, internal::None, internal::None,
4696     internal::None, internal::None, internal::None, internal::None,
4697     internal::None, internal::None, internal::None, internal::None,
4698     internal::None, internal::None, internal::None, internal::None,
4699     internal::None, internal::None, internal::None, internal::None,
4700     internal::None, internal::None, internal::None, internal::None,
4701     internal::None> {
4702   typedef internal::Types12<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
4703       T12> type;
4704 };
4705 template <typename T1, typename T2, typename T3, typename T4, typename T5,
4706     typename T6, typename T7, typename T8, typename T9, typename T10,
4707     typename T11, typename T12, typename T13>
4708 struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
4709     internal::None, internal::None, internal::None, internal::None,
4710     internal::None, internal::None, internal::None, internal::None,
4711     internal::None, internal::None, internal::None, internal::None,
4712     internal::None, internal::None, internal::None, internal::None,
4713     internal::None, internal::None, internal::None, internal::None,
4714     internal::None, internal::None, internal::None, internal::None,
4715     internal::None, internal::None, internal::None, internal::None,
4716     internal::None, internal::None, internal::None, internal::None,
4717     internal::None, internal::None, internal::None, internal::None,
4718     internal::None> {
4719   typedef internal::Types13<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
4720       T13> type;
4721 };
4722 template <typename T1, typename T2, typename T3, typename T4, typename T5,
4723     typename T6, typename T7, typename T8, typename T9, typename T10,
4724     typename T11, typename T12, typename T13, typename T14>
4725 struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
4726     internal::None, internal::None, internal::None, internal::None,
4727     internal::None, internal::None, internal::None, internal::None,
4728     internal::None, internal::None, internal::None, internal::None,
4729     internal::None, internal::None, internal::None, internal::None,
4730     internal::None, internal::None, internal::None, internal::None,
4731     internal::None, internal::None, internal::None, internal::None,
4732     internal::None, internal::None, internal::None, internal::None,
4733     internal::None, internal::None, internal::None, internal::None,
4734     internal::None, internal::None, internal::None, internal::None> {
4735   typedef internal::Types14<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
4736       T13, T14> type;
4737 };
4738 template <typename T1, typename T2, typename T3, typename T4, typename T5,
4739     typename T6, typename T7, typename T8, typename T9, typename T10,
4740     typename T11, typename T12, typename T13, typename T14, typename T15>
4741 struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
4742     internal::None, internal::None, internal::None, internal::None,
4743     internal::None, internal::None, internal::None, internal::None,
4744     internal::None, internal::None, internal::None, internal::None,
4745     internal::None, internal::None, internal::None, internal::None,
4746     internal::None, internal::None, internal::None, internal::None,
4747     internal::None, internal::None, internal::None, internal::None,
4748     internal::None, internal::None, internal::None, internal::None,
4749     internal::None, internal::None, internal::None, internal::None,
4750     internal::None, internal::None, internal::None> {
4751   typedef internal::Types15<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
4752       T13, T14, T15> type;
4753 };
4754 template <typename T1, typename T2, typename T3, typename T4, typename T5,
4755     typename T6, typename T7, typename T8, typename T9, typename T10,
4756     typename T11, typename T12, typename T13, typename T14, typename T15,
4757     typename T16>
4758 struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
4759     T16, internal::None, internal::None, internal::None, internal::None,
4760     internal::None, internal::None, internal::None, internal::None,
4761     internal::None, internal::None, internal::None, internal::None,
4762     internal::None, internal::None, internal::None, internal::None,
4763     internal::None, internal::None, internal::None, internal::None,
4764     internal::None, internal::None, internal::None, internal::None,
4765     internal::None, internal::None, internal::None, internal::None,
4766     internal::None, internal::None, internal::None, internal::None,
4767     internal::None, internal::None> {
4768   typedef internal::Types16<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
4769       T13, T14, T15, T16> type;
4770 };
4771 template <typename T1, typename T2, typename T3, typename T4, typename T5,
4772     typename T6, typename T7, typename T8, typename T9, typename T10,
4773     typename T11, typename T12, typename T13, typename T14, typename T15,
4774     typename T16, typename T17>
4775 struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
4776     T16, T17, internal::None, internal::None, internal::None, internal::None,
4777     internal::None, internal::None, internal::None, internal::None,
4778     internal::None, internal::None, internal::None, internal::None,
4779     internal::None, internal::None, internal::None, internal::None,
4780     internal::None, internal::None, internal::None, internal::None,
4781     internal::None, internal::None, internal::None, internal::None,
4782     internal::None, internal::None, internal::None, internal::None,
4783     internal::None, internal::None, internal::None, internal::None,
4784     internal::None> {
4785   typedef internal::Types17<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
4786       T13, T14, T15, T16, T17> type;
4787 };
4788 template <typename T1, typename T2, typename T3, typename T4, typename T5,
4789     typename T6, typename T7, typename T8, typename T9, typename T10,
4790     typename T11, typename T12, typename T13, typename T14, typename T15,
4791     typename T16, typename T17, typename T18>
4792 struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
4793     T16, T17, T18, internal::None, internal::None, internal::None,
4794     internal::None, internal::None, internal::None, internal::None,
4795     internal::None, internal::None, internal::None, internal::None,
4796     internal::None, internal::None, internal::None, internal::None,
4797     internal::None, internal::None, internal::None, internal::None,
4798     internal::None, internal::None, internal::None, internal::None,
4799     internal::None, internal::None, internal::None, internal::None,
4800     internal::None, internal::None, internal::None, internal::None,
4801     internal::None> {
4802   typedef internal::Types18<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
4803       T13, T14, T15, T16, T17, T18> type;
4804 };
4805 template <typename T1, typename T2, typename T3, typename T4, typename T5,
4806     typename T6, typename T7, typename T8, typename T9, typename T10,
4807     typename T11, typename T12, typename T13, typename T14, typename T15,
4808     typename T16, typename T17, typename T18, typename T19>
4809 struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
4810     T16, T17, T18, T19, internal::None, internal::None, internal::None,
4811     internal::None, internal::None, internal::None, internal::None,
4812     internal::None, internal::None, internal::None, internal::None,
4813     internal::None, internal::None, internal::None, internal::None,
4814     internal::None, internal::None, internal::None, internal::None,
4815     internal::None, internal::None, internal::None, internal::None,
4816     internal::None, internal::None, internal::None, internal::None,
4817     internal::None, internal::None, internal::None, internal::None> {
4818   typedef internal::Types19<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
4819       T13, T14, T15, T16, T17, T18, T19> type;
4820 };
4821 template <typename T1, typename T2, typename T3, typename T4, typename T5,
4822     typename T6, typename T7, typename T8, typename T9, typename T10,
4823     typename T11, typename T12, typename T13, typename T14, typename T15,
4824     typename T16, typename T17, typename T18, typename T19, typename T20>
4825 struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
4826     T16, T17, T18, T19, T20, internal::None, internal::None, internal::None,
4827     internal::None, internal::None, internal::None, internal::None,
4828     internal::None, internal::None, internal::None, internal::None,
4829     internal::None, internal::None, internal::None, internal::None,
4830     internal::None, internal::None, internal::None, internal::None,
4831     internal::None, internal::None, internal::None, internal::None,
4832     internal::None, internal::None, internal::None, internal::None,
4833     internal::None, internal::None, internal::None> {
4834   typedef internal::Types20<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
4835       T13, T14, T15, T16, T17, T18, T19, T20> type;
4836 };
4837 template <typename T1, typename T2, typename T3, typename T4, typename T5,
4838     typename T6, typename T7, typename T8, typename T9, typename T10,
4839     typename T11, typename T12, typename T13, typename T14, typename T15,
4840     typename T16, typename T17, typename T18, typename T19, typename T20,
4841     typename T21>
4842 struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
4843     T16, T17, T18, T19, T20, T21, internal::None, internal::None,
4844     internal::None, internal::None, internal::None, internal::None,
4845     internal::None, internal::None, internal::None, internal::None,
4846     internal::None, internal::None, internal::None, internal::None,
4847     internal::None, internal::None, internal::None, internal::None,
4848     internal::None, internal::None, internal::None, internal::None,
4849     internal::None, internal::None, internal::None, internal::None,
4850     internal::None, internal::None, internal::None> {
4851   typedef internal::Types21<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
4852       T13, T14, T15, T16, T17, T18, T19, T20, T21> type;
4853 };
4854 template <typename T1, typename T2, typename T3, typename T4, typename T5,
4855     typename T6, typename T7, typename T8, typename T9, typename T10,
4856     typename T11, typename T12, typename T13, typename T14, typename T15,
4857     typename T16, typename T17, typename T18, typename T19, typename T20,
4858     typename T21, typename T22>
4859 struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
4860     T16, T17, T18, T19, T20, T21, T22, internal::None, internal::None,
4861     internal::None, internal::None, internal::None, internal::None,
4862     internal::None, internal::None, internal::None, internal::None,
4863     internal::None, internal::None, internal::None, internal::None,
4864     internal::None, internal::None, internal::None, internal::None,
4865     internal::None, internal::None, internal::None, internal::None,
4866     internal::None, internal::None, internal::None, internal::None,
4867     internal::None, internal::None> {
4868   typedef internal::Types22<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
4869       T13, T14, T15, T16, T17, T18, T19, T20, T21, T22> type;
4870 };
4871 template <typename T1, typename T2, typename T3, typename T4, typename T5,
4872     typename T6, typename T7, typename T8, typename T9, typename T10,
4873     typename T11, typename T12, typename T13, typename T14, typename T15,
4874     typename T16, typename T17, typename T18, typename T19, typename T20,
4875     typename T21, typename T22, typename T23>
4876 struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
4877     T16, T17, T18, T19, T20, T21, T22, T23, internal::None, internal::None,
4878     internal::None, internal::None, internal::None, internal::None,
4879     internal::None, internal::None, internal::None, internal::None,
4880     internal::None, internal::None, internal::None, internal::None,
4881     internal::None, internal::None, internal::None, internal::None,
4882     internal::None, internal::None, internal::None, internal::None,
4883     internal::None, internal::None, internal::None, internal::None,
4884     internal::None> {
4885   typedef internal::Types23<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
4886       T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23> type;
4887 };
4888 template <typename T1, typename T2, typename T3, typename T4, typename T5,
4889     typename T6, typename T7, typename T8, typename T9, typename T10,
4890     typename T11, typename T12, typename T13, typename T14, typename T15,
4891     typename T16, typename T17, typename T18, typename T19, typename T20,
4892     typename T21, typename T22, typename T23, typename T24>
4893 struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
4894     T16, T17, T18, T19, T20, T21, T22, T23, T24, internal::None,
4895     internal::None, internal::None, internal::None, internal::None,
4896     internal::None, internal::None, internal::None, internal::None,
4897     internal::None, internal::None, internal::None, internal::None,
4898     internal::None, internal::None, internal::None, internal::None,
4899     internal::None, internal::None, internal::None, internal::None,
4900     internal::None, internal::None, internal::None, internal::None,
4901     internal::None> {
4902   typedef internal::Types24<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
4903       T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24> type;
4904 };
4905 template <typename T1, typename T2, typename T3, typename T4, typename T5,
4906     typename T6, typename T7, typename T8, typename T9, typename T10,
4907     typename T11, typename T12, typename T13, typename T14, typename T15,
4908     typename T16, typename T17, typename T18, typename T19, typename T20,
4909     typename T21, typename T22, typename T23, typename T24, typename T25>
4910 struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
4911     T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, internal::None,
4912     internal::None, internal::None, internal::None, internal::None,
4913     internal::None, internal::None, internal::None, internal::None,
4914     internal::None, internal::None, internal::None, internal::None,
4915     internal::None, internal::None, internal::None, internal::None,
4916     internal::None, internal::None, internal::None, internal::None,
4917     internal::None, internal::None, internal::None, internal::None> {
4918   typedef internal::Types25<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
4919       T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25> type;
4920 };
4921 template <typename T1, typename T2, typename T3, typename T4, typename T5,
4922     typename T6, typename T7, typename T8, typename T9, typename T10,
4923     typename T11, typename T12, typename T13, typename T14, typename T15,
4924     typename T16, typename T17, typename T18, typename T19, typename T20,
4925     typename T21, typename T22, typename T23, typename T24, typename T25,
4926     typename T26>
4927 struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
4928     T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, internal::None,
4929     internal::None, internal::None, internal::None, internal::None,
4930     internal::None, internal::None, internal::None, internal::None,
4931     internal::None, internal::None, internal::None, internal::None,
4932     internal::None, internal::None, internal::None, internal::None,
4933     internal::None, internal::None, internal::None, internal::None,
4934     internal::None, internal::None, internal::None> {
4935   typedef internal::Types26<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
4936       T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
4937       T26> type;
4938 };
4939 template <typename T1, typename T2, typename T3, typename T4, typename T5,
4940     typename T6, typename T7, typename T8, typename T9, typename T10,
4941     typename T11, typename T12, typename T13, typename T14, typename T15,
4942     typename T16, typename T17, typename T18, typename T19, typename T20,
4943     typename T21, typename T22, typename T23, typename T24, typename T25,
4944     typename T26, typename T27>
4945 struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
4946     T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, internal::None,
4947     internal::None, internal::None, internal::None, internal::None,
4948     internal::None, internal::None, internal::None, internal::None,
4949     internal::None, internal::None, internal::None, internal::None,
4950     internal::None, internal::None, internal::None, internal::None,
4951     internal::None, internal::None, internal::None, internal::None,
4952     internal::None, internal::None> {
4953   typedef internal::Types27<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
4954       T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
4955       T27> type;
4956 };
4957 template <typename T1, typename T2, typename T3, typename T4, typename T5,
4958     typename T6, typename T7, typename T8, typename T9, typename T10,
4959     typename T11, typename T12, typename T13, typename T14, typename T15,
4960     typename T16, typename T17, typename T18, typename T19, typename T20,
4961     typename T21, typename T22, typename T23, typename T24, typename T25,
4962     typename T26, typename T27, typename T28>
4963 struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
4964     T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
4965     internal::None, internal::None, internal::None, internal::None,
4966     internal::None, internal::None, internal::None, internal::None,
4967     internal::None, internal::None, internal::None, internal::None,
4968     internal::None, internal::None, internal::None, internal::None,
4969     internal::None, internal::None, internal::None, internal::None,
4970     internal::None, internal::None> {
4971   typedef internal::Types28<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
4972       T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
4973       T27, T28> type;
4974 };
4975 template <typename T1, typename T2, typename T3, typename T4, typename T5,
4976     typename T6, typename T7, typename T8, typename T9, typename T10,
4977     typename T11, typename T12, typename T13, typename T14, typename T15,
4978     typename T16, typename T17, typename T18, typename T19, typename T20,
4979     typename T21, typename T22, typename T23, typename T24, typename T25,
4980     typename T26, typename T27, typename T28, typename T29>
4981 struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
4982     T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
4983     internal::None, internal::None, internal::None, internal::None,
4984     internal::None, internal::None, internal::None, internal::None,
4985     internal::None, internal::None, internal::None, internal::None,
4986     internal::None, internal::None, internal::None, internal::None,
4987     internal::None, internal::None, internal::None, internal::None,
4988     internal::None> {
4989   typedef internal::Types29<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
4990       T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
4991       T27, T28, T29> type;
4992 };
4993 template <typename T1, typename T2, typename T3, typename T4, typename T5,
4994     typename T6, typename T7, typename T8, typename T9, typename T10,
4995     typename T11, typename T12, typename T13, typename T14, typename T15,
4996     typename T16, typename T17, typename T18, typename T19, typename T20,
4997     typename T21, typename T22, typename T23, typename T24, typename T25,
4998     typename T26, typename T27, typename T28, typename T29, typename T30>
4999 struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
5000     T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,
5001     internal::None, internal::None, internal::None, internal::None,
5002     internal::None, internal::None, internal::None, internal::None,
5003     internal::None, internal::None, internal::None, internal::None,
5004     internal::None, internal::None, internal::None, internal::None,
5005     internal::None, internal::None, internal::None, internal::None> {
5006   typedef internal::Types30<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
5007       T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
5008       T27, T28, T29, T30> type;
5009 };
5010 template <typename T1, typename T2, typename T3, typename T4, typename T5,
5011     typename T6, typename T7, typename T8, typename T9, typename T10,
5012     typename T11, typename T12, typename T13, typename T14, typename T15,
5013     typename T16, typename T17, typename T18, typename T19, typename T20,
5014     typename T21, typename T22, typename T23, typename T24, typename T25,
5015     typename T26, typename T27, typename T28, typename T29, typename T30,
5016     typename T31>
5017 struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
5018     T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,
5019     T31, internal::None, internal::None, internal::None, internal::None,
5020     internal::None, internal::None, internal::None, internal::None,
5021     internal::None, internal::None, internal::None, internal::None,
5022     internal::None, internal::None, internal::None, internal::None,
5023     internal::None, internal::None, internal::None> {
5024   typedef internal::Types31<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
5025       T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
5026       T27, T28, T29, T30, T31> type;
5027 };
5028 template <typename T1, typename T2, typename T3, typename T4, typename T5,
5029     typename T6, typename T7, typename T8, typename T9, typename T10,
5030     typename T11, typename T12, typename T13, typename T14, typename T15,
5031     typename T16, typename T17, typename T18, typename T19, typename T20,
5032     typename T21, typename T22, typename T23, typename T24, typename T25,
5033     typename T26, typename T27, typename T28, typename T29, typename T30,
5034     typename T31, typename T32>
5035 struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
5036     T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,
5037     T31, T32, internal::None, internal::None, internal::None, internal::None,
5038     internal::None, internal::None, internal::None, internal::None,
5039     internal::None, internal::None, internal::None, internal::None,
5040     internal::None, internal::None, internal::None, internal::None,
5041     internal::None, internal::None> {
5042   typedef internal::Types32<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
5043       T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
5044       T27, T28, T29, T30, T31, T32> type;
5045 };
5046 template <typename T1, typename T2, typename T3, typename T4, typename T5,
5047     typename T6, typename T7, typename T8, typename T9, typename T10,
5048     typename T11, typename T12, typename T13, typename T14, typename T15,
5049     typename T16, typename T17, typename T18, typename T19, typename T20,
5050     typename T21, typename T22, typename T23, typename T24, typename T25,
5051     typename T26, typename T27, typename T28, typename T29, typename T30,
5052     typename T31, typename T32, typename T33>
5053 struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
5054     T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,
5055     T31, T32, T33, internal::None, internal::None, internal::None,
5056     internal::None, internal::None, internal::None, internal::None,
5057     internal::None, internal::None, internal::None, internal::None,
5058     internal::None, internal::None, internal::None, internal::None,
5059     internal::None, internal::None> {
5060   typedef internal::Types33<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
5061       T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
5062       T27, T28, T29, T30, T31, T32, T33> type;
5063 };
5064 template <typename T1, typename T2, typename T3, typename T4, typename T5,
5065     typename T6, typename T7, typename T8, typename T9, typename T10,
5066     typename T11, typename T12, typename T13, typename T14, typename T15,
5067     typename T16, typename T17, typename T18, typename T19, typename T20,
5068     typename T21, typename T22, typename T23, typename T24, typename T25,
5069     typename T26, typename T27, typename T28, typename T29, typename T30,
5070     typename T31, typename T32, typename T33, typename T34>
5071 struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
5072     T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,
5073     T31, T32, T33, T34, internal::None, internal::None, internal::None,
5074     internal::None, internal::None, internal::None, internal::None,
5075     internal::None, internal::None, internal::None, internal::None,
5076     internal::None, internal::None, internal::None, internal::None,
5077     internal::None> {
5078   typedef internal::Types34<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
5079       T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
5080       T27, T28, T29, T30, T31, T32, T33, T34> type;
5081 };
5082 template <typename T1, typename T2, typename T3, typename T4, typename T5,
5083     typename T6, typename T7, typename T8, typename T9, typename T10,
5084     typename T11, typename T12, typename T13, typename T14, typename T15,
5085     typename T16, typename T17, typename T18, typename T19, typename T20,
5086     typename T21, typename T22, typename T23, typename T24, typename T25,
5087     typename T26, typename T27, typename T28, typename T29, typename T30,
5088     typename T31, typename T32, typename T33, typename T34, typename T35>
5089 struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
5090     T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,
5091     T31, T32, T33, T34, T35, internal::None, internal::None, internal::None,
5092     internal::None, internal::None, internal::None, internal::None,
5093     internal::None, internal::None, internal::None, internal::None,
5094     internal::None, internal::None, internal::None, internal::None> {
5095   typedef internal::Types35<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
5096       T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
5097       T27, T28, T29, T30, T31, T32, T33, T34, T35> type;
5098 };
5099 template <typename T1, typename T2, typename T3, typename T4, typename T5,
5100     typename T6, typename T7, typename T8, typename T9, typename T10,
5101     typename T11, typename T12, typename T13, typename T14, typename T15,
5102     typename T16, typename T17, typename T18, typename T19, typename T20,
5103     typename T21, typename T22, typename T23, typename T24, typename T25,
5104     typename T26, typename T27, typename T28, typename T29, typename T30,
5105     typename T31, typename T32, typename T33, typename T34, typename T35,
5106     typename T36>
5107 struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
5108     T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,
5109     T31, T32, T33, T34, T35, T36, internal::None, internal::None,
5110     internal::None, internal::None, internal::None, internal::None,
5111     internal::None, internal::None, internal::None, internal::None,
5112     internal::None, internal::None, internal::None, internal::None> {
5113   typedef internal::Types36<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
5114       T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
5115       T27, T28, T29, T30, T31, T32, T33, T34, T35, T36> type;
5116 };
5117 template <typename T1, typename T2, typename T3, typename T4, typename T5,
5118     typename T6, typename T7, typename T8, typename T9, typename T10,
5119     typename T11, typename T12, typename T13, typename T14, typename T15,
5120     typename T16, typename T17, typename T18, typename T19, typename T20,
5121     typename T21, typename T22, typename T23, typename T24, typename T25,
5122     typename T26, typename T27, typename T28, typename T29, typename T30,
5123     typename T31, typename T32, typename T33, typename T34, typename T35,
5124     typename T36, typename T37>
5125 struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
5126     T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,
5127     T31, T32, T33, T34, T35, T36, T37, internal::None, internal::None,
5128     internal::None, internal::None, internal::None, internal::None,
5129     internal::None, internal::None, internal::None, internal::None,
5130     internal::None, internal::None, internal::None> {
5131   typedef internal::Types37<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
5132       T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
5133       T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37> type;
5134 };
5135 template <typename T1, typename T2, typename T3, typename T4, typename T5,
5136     typename T6, typename T7, typename T8, typename T9, typename T10,
5137     typename T11, typename T12, typename T13, typename T14, typename T15,
5138     typename T16, typename T17, typename T18, typename T19, typename T20,
5139     typename T21, typename T22, typename T23, typename T24, typename T25,
5140     typename T26, typename T27, typename T28, typename T29, typename T30,
5141     typename T31, typename T32, typename T33, typename T34, typename T35,
5142     typename T36, typename T37, typename T38>
5143 struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
5144     T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,
5145     T31, T32, T33, T34, T35, T36, T37, T38, internal::None, internal::None,
5146     internal::None, internal::None, internal::None, internal::None,
5147     internal::None, internal::None, internal::None, internal::None,
5148     internal::None, internal::None> {
5149   typedef internal::Types38<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
5150       T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
5151       T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38> type;
5152 };
5153 template <typename T1, typename T2, typename T3, typename T4, typename T5,
5154     typename T6, typename T7, typename T8, typename T9, typename T10,
5155     typename T11, typename T12, typename T13, typename T14, typename T15,
5156     typename T16, typename T17, typename T18, typename T19, typename T20,
5157     typename T21, typename T22, typename T23, typename T24, typename T25,
5158     typename T26, typename T27, typename T28, typename T29, typename T30,
5159     typename T31, typename T32, typename T33, typename T34, typename T35,
5160     typename T36, typename T37, typename T38, typename T39>
5161 struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
5162     T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,
5163     T31, T32, T33, T34, T35, T36, T37, T38, T39, internal::None,
5164     internal::None, internal::None, internal::None, internal::None,
5165     internal::None, internal::None, internal::None, internal::None,
5166     internal::None, internal::None> {
5167   typedef internal::Types39<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
5168       T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
5169       T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39> type;
5170 };
5171 template <typename T1, typename T2, typename T3, typename T4, typename T5,
5172     typename T6, typename T7, typename T8, typename T9, typename T10,
5173     typename T11, typename T12, typename T13, typename T14, typename T15,
5174     typename T16, typename T17, typename T18, typename T19, typename T20,
5175     typename T21, typename T22, typename T23, typename T24, typename T25,
5176     typename T26, typename T27, typename T28, typename T29, typename T30,
5177     typename T31, typename T32, typename T33, typename T34, typename T35,
5178     typename T36, typename T37, typename T38, typename T39, typename T40>
5179 struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
5180     T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,
5181     T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, internal::None,
5182     internal::None, internal::None, internal::None, internal::None,
5183     internal::None, internal::None, internal::None, internal::None,
5184     internal::None> {
5185   typedef internal::Types40<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
5186       T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
5187       T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39,
5188       T40> type;
5189 };
5190 template <typename T1, typename T2, typename T3, typename T4, typename T5,
5191     typename T6, typename T7, typename T8, typename T9, typename T10,
5192     typename T11, typename T12, typename T13, typename T14, typename T15,
5193     typename T16, typename T17, typename T18, typename T19, typename T20,
5194     typename T21, typename T22, typename T23, typename T24, typename T25,
5195     typename T26, typename T27, typename T28, typename T29, typename T30,
5196     typename T31, typename T32, typename T33, typename T34, typename T35,
5197     typename T36, typename T37, typename T38, typename T39, typename T40,
5198     typename T41>
5199 struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
5200     T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,
5201     T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, internal::None,
5202     internal::None, internal::None, internal::None, internal::None,
5203     internal::None, internal::None, internal::None, internal::None> {
5204   typedef internal::Types41<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
5205       T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
5206       T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40,
5207       T41> type;
5208 };
5209 template <typename T1, typename T2, typename T3, typename T4, typename T5,
5210     typename T6, typename T7, typename T8, typename T9, typename T10,
5211     typename T11, typename T12, typename T13, typename T14, typename T15,
5212     typename T16, typename T17, typename T18, typename T19, typename T20,
5213     typename T21, typename T22, typename T23, typename T24, typename T25,
5214     typename T26, typename T27, typename T28, typename T29, typename T30,
5215     typename T31, typename T32, typename T33, typename T34, typename T35,
5216     typename T36, typename T37, typename T38, typename T39, typename T40,
5217     typename T41, typename T42>
5218 struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
5219     T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,
5220     T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, internal::None,
5221     internal::None, internal::None, internal::None, internal::None,
5222     internal::None, internal::None, internal::None> {
5223   typedef internal::Types42<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
5224       T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
5225       T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40,
5226       T41, T42> type;
5227 };
5228 template <typename T1, typename T2, typename T3, typename T4, typename T5,
5229     typename T6, typename T7, typename T8, typename T9, typename T10,
5230     typename T11, typename T12, typename T13, typename T14, typename T15,
5231     typename T16, typename T17, typename T18, typename T19, typename T20,
5232     typename T21, typename T22, typename T23, typename T24, typename T25,
5233     typename T26, typename T27, typename T28, typename T29, typename T30,
5234     typename T31, typename T32, typename T33, typename T34, typename T35,
5235     typename T36, typename T37, typename T38, typename T39, typename T40,
5236     typename T41, typename T42, typename T43>
5237 struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
5238     T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,
5239     T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43,
5240     internal::None, internal::None, internal::None, internal::None,
5241     internal::None, internal::None, internal::None> {
5242   typedef internal::Types43<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
5243       T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
5244       T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40,
5245       T41, T42, T43> type;
5246 };
5247 template <typename T1, typename T2, typename T3, typename T4, typename T5,
5248     typename T6, typename T7, typename T8, typename T9, typename T10,
5249     typename T11, typename T12, typename T13, typename T14, typename T15,
5250     typename T16, typename T17, typename T18, typename T19, typename T20,
5251     typename T21, typename T22, typename T23, typename T24, typename T25,
5252     typename T26, typename T27, typename T28, typename T29, typename T30,
5253     typename T31, typename T32, typename T33, typename T34, typename T35,
5254     typename T36, typename T37, typename T38, typename T39, typename T40,
5255     typename T41, typename T42, typename T43, typename T44>
5256 struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
5257     T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,
5258     T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, T44,
5259     internal::None, internal::None, internal::None, internal::None,
5260     internal::None, internal::None> {
5261   typedef internal::Types44<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
5262       T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
5263       T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40,
5264       T41, T42, T43, T44> type;
5265 };
5266 template <typename T1, typename T2, typename T3, typename T4, typename T5,
5267     typename T6, typename T7, typename T8, typename T9, typename T10,
5268     typename T11, typename T12, typename T13, typename T14, typename T15,
5269     typename T16, typename T17, typename T18, typename T19, typename T20,
5270     typename T21, typename T22, typename T23, typename T24, typename T25,
5271     typename T26, typename T27, typename T28, typename T29, typename T30,
5272     typename T31, typename T32, typename T33, typename T34, typename T35,
5273     typename T36, typename T37, typename T38, typename T39, typename T40,
5274     typename T41, typename T42, typename T43, typename T44, typename T45>
5275 struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
5276     T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,
5277     T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, T44, T45,
5278     internal::None, internal::None, internal::None, internal::None,
5279     internal::None> {
5280   typedef internal::Types45<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
5281       T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
5282       T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40,
5283       T41, T42, T43, T44, T45> type;
5284 };
5285 template <typename T1, typename T2, typename T3, typename T4, typename T5,
5286     typename T6, typename T7, typename T8, typename T9, typename T10,
5287     typename T11, typename T12, typename T13, typename T14, typename T15,
5288     typename T16, typename T17, typename T18, typename T19, typename T20,
5289     typename T21, typename T22, typename T23, typename T24, typename T25,
5290     typename T26, typename T27, typename T28, typename T29, typename T30,
5291     typename T31, typename T32, typename T33, typename T34, typename T35,
5292     typename T36, typename T37, typename T38, typename T39, typename T40,
5293     typename T41, typename T42, typename T43, typename T44, typename T45,
5294     typename T46>
5295 struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
5296     T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,
5297     T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, T44, T45,
5298     T46, internal::None, internal::None, internal::None, internal::None> {
5299   typedef internal::Types46<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
5300       T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
5301       T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40,
5302       T41, T42, T43, T44, T45, T46> type;
5303 };
5304 template <typename T1, typename T2, typename T3, typename T4, typename T5,
5305     typename T6, typename T7, typename T8, typename T9, typename T10,
5306     typename T11, typename T12, typename T13, typename T14, typename T15,
5307     typename T16, typename T17, typename T18, typename T19, typename T20,
5308     typename T21, typename T22, typename T23, typename T24, typename T25,
5309     typename T26, typename T27, typename T28, typename T29, typename T30,
5310     typename T31, typename T32, typename T33, typename T34, typename T35,
5311     typename T36, typename T37, typename T38, typename T39, typename T40,
5312     typename T41, typename T42, typename T43, typename T44, typename T45,
5313     typename T46, typename T47>
5314 struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
5315     T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,
5316     T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, T44, T45,
5317     T46, T47, internal::None, internal::None, internal::None> {
5318   typedef internal::Types47<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
5319       T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
5320       T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40,
5321       T41, T42, T43, T44, T45, T46, T47> type;
5322 };
5323 template <typename T1, typename T2, typename T3, typename T4, typename T5,
5324     typename T6, typename T7, typename T8, typename T9, typename T10,
5325     typename T11, typename T12, typename T13, typename T14, typename T15,
5326     typename T16, typename T17, typename T18, typename T19, typename T20,
5327     typename T21, typename T22, typename T23, typename T24, typename T25,
5328     typename T26, typename T27, typename T28, typename T29, typename T30,
5329     typename T31, typename T32, typename T33, typename T34, typename T35,
5330     typename T36, typename T37, typename T38, typename T39, typename T40,
5331     typename T41, typename T42, typename T43, typename T44, typename T45,
5332     typename T46, typename T47, typename T48>
5333 struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
5334     T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,
5335     T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, T44, T45,
5336     T46, T47, T48, internal::None, internal::None> {
5337   typedef internal::Types48<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
5338       T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
5339       T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40,
5340       T41, T42, T43, T44, T45, T46, T47, T48> type;
5341 };
5342 template <typename T1, typename T2, typename T3, typename T4, typename T5,
5343     typename T6, typename T7, typename T8, typename T9, typename T10,
5344     typename T11, typename T12, typename T13, typename T14, typename T15,
5345     typename T16, typename T17, typename T18, typename T19, typename T20,
5346     typename T21, typename T22, typename T23, typename T24, typename T25,
5347     typename T26, typename T27, typename T28, typename T29, typename T30,
5348     typename T31, typename T32, typename T33, typename T34, typename T35,
5349     typename T36, typename T37, typename T38, typename T39, typename T40,
5350     typename T41, typename T42, typename T43, typename T44, typename T45,
5351     typename T46, typename T47, typename T48, typename T49>
5352 struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
5353     T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,
5354     T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, T44, T45,
5355     T46, T47, T48, T49, internal::None> {
5356   typedef internal::Types49<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
5357       T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
5358       T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40,
5359       T41, T42, T43, T44, T45, T46, T47, T48, T49> type;
5360 };
5361
5362 namespace internal {
5363
5364 # define GTEST_TEMPLATE_ template <typename T> class
5365
5366 // The template "selector" struct TemplateSel<Tmpl> is used to
5367 // represent Tmpl, which must be a class template with one type
5368 // parameter, as a type.  TemplateSel<Tmpl>::Bind<T>::type is defined
5369 // as the type Tmpl<T>.  This allows us to actually instantiate the
5370 // template "selected" by TemplateSel<Tmpl>.
5371 //
5372 // This trick is necessary for simulating typedef for class templates,
5373 // which C++ doesn't support directly.
5374 template <GTEST_TEMPLATE_ Tmpl>
5375 struct TemplateSel {
5376   template <typename T>
5377   struct Bind {
5378     typedef Tmpl<T> type;
5379   };
5380 };
5381
5382 # define GTEST_BIND_(TmplSel, T) \
5383   TmplSel::template Bind<T>::type
5384
5385 // A unique struct template used as the default value for the
5386 // arguments of class template Templates.  This allows us to simulate
5387 // variadic templates (e.g. Templates<int>, Templates<int, double>,
5388 // and etc), which C++ doesn't support directly.
5389 template <typename T>
5390 struct NoneT {};
5391
5392 // The following family of struct and struct templates are used to
5393 // represent template lists.  In particular, TemplatesN<T1, T2, ...,
5394 // TN> represents a list of N templates (T1, T2, ..., and TN).  Except
5395 // for Templates0, every struct in the family has two member types:
5396 // Head for the selector of the first template in the list, and Tail
5397 // for the rest of the list.
5398
5399 // The empty template list.
5400 struct Templates0 {};
5401
5402 // Template lists of length 1, 2, 3, and so on.
5403
5404 template <GTEST_TEMPLATE_ T1>
5405 struct Templates1 {
5406   typedef TemplateSel<T1> Head;
5407   typedef Templates0 Tail;
5408 };
5409 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2>
5410 struct Templates2 {
5411   typedef TemplateSel<T1> Head;
5412   typedef Templates1<T2> Tail;
5413 };
5414
5415 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3>
5416 struct Templates3 {
5417   typedef TemplateSel<T1> Head;
5418   typedef Templates2<T2, T3> Tail;
5419 };
5420
5421 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
5422     GTEST_TEMPLATE_ T4>
5423 struct Templates4 {
5424   typedef TemplateSel<T1> Head;
5425   typedef Templates3<T2, T3, T4> Tail;
5426 };
5427
5428 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
5429     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5>
5430 struct Templates5 {
5431   typedef TemplateSel<T1> Head;
5432   typedef Templates4<T2, T3, T4, T5> Tail;
5433 };
5434
5435 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
5436     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6>
5437 struct Templates6 {
5438   typedef TemplateSel<T1> Head;
5439   typedef Templates5<T2, T3, T4, T5, T6> Tail;
5440 };
5441
5442 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
5443     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
5444     GTEST_TEMPLATE_ T7>
5445 struct Templates7 {
5446   typedef TemplateSel<T1> Head;
5447   typedef Templates6<T2, T3, T4, T5, T6, T7> Tail;
5448 };
5449
5450 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
5451     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
5452     GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8>
5453 struct Templates8 {
5454   typedef TemplateSel<T1> Head;
5455   typedef Templates7<T2, T3, T4, T5, T6, T7, T8> Tail;
5456 };
5457
5458 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
5459     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
5460     GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9>
5461 struct Templates9 {
5462   typedef TemplateSel<T1> Head;
5463   typedef Templates8<T2, T3, T4, T5, T6, T7, T8, T9> Tail;
5464 };
5465
5466 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
5467     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
5468     GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
5469     GTEST_TEMPLATE_ T10>
5470 struct Templates10 {
5471   typedef TemplateSel<T1> Head;
5472   typedef Templates9<T2, T3, T4, T5, T6, T7, T8, T9, T10> Tail;
5473 };
5474
5475 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
5476     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
5477     GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
5478     GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11>
5479 struct Templates11 {
5480   typedef TemplateSel<T1> Head;
5481   typedef Templates10<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11> Tail;
5482 };
5483
5484 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
5485     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
5486     GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
5487     GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12>
5488 struct Templates12 {
5489   typedef TemplateSel<T1> Head;
5490   typedef Templates11<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12> Tail;
5491 };
5492
5493 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
5494     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
5495     GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
5496     GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
5497     GTEST_TEMPLATE_ T13>
5498 struct Templates13 {
5499   typedef TemplateSel<T1> Head;
5500   typedef Templates12<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13> Tail;
5501 };
5502
5503 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
5504     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
5505     GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
5506     GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
5507     GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14>
5508 struct Templates14 {
5509   typedef TemplateSel<T1> Head;
5510   typedef Templates13<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
5511       T14> Tail;
5512 };
5513
5514 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
5515     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
5516     GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
5517     GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
5518     GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15>
5519 struct Templates15 {
5520   typedef TemplateSel<T1> Head;
5521   typedef Templates14<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
5522       T15> Tail;
5523 };
5524
5525 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
5526     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
5527     GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
5528     GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
5529     GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
5530     GTEST_TEMPLATE_ T16>
5531 struct Templates16 {
5532   typedef TemplateSel<T1> Head;
5533   typedef Templates15<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
5534       T15, T16> Tail;
5535 };
5536
5537 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
5538     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
5539     GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
5540     GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
5541     GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
5542     GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17>
5543 struct Templates17 {
5544   typedef TemplateSel<T1> Head;
5545   typedef Templates16<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
5546       T15, T16, T17> Tail;
5547 };
5548
5549 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
5550     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
5551     GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
5552     GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
5553     GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
5554     GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18>
5555 struct Templates18 {
5556   typedef TemplateSel<T1> Head;
5557   typedef Templates17<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
5558       T15, T16, T17, T18> Tail;
5559 };
5560
5561 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
5562     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
5563     GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
5564     GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
5565     GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
5566     GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
5567     GTEST_TEMPLATE_ T19>
5568 struct Templates19 {
5569   typedef TemplateSel<T1> Head;
5570   typedef Templates18<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
5571       T15, T16, T17, T18, T19> Tail;
5572 };
5573
5574 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
5575     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
5576     GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
5577     GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
5578     GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
5579     GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
5580     GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20>
5581 struct Templates20 {
5582   typedef TemplateSel<T1> Head;
5583   typedef Templates19<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
5584       T15, T16, T17, T18, T19, T20> Tail;
5585 };
5586
5587 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
5588     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
5589     GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
5590     GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
5591     GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
5592     GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
5593     GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21>
5594 struct Templates21 {
5595   typedef TemplateSel<T1> Head;
5596   typedef Templates20<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
5597       T15, T16, T17, T18, T19, T20, T21> Tail;
5598 };
5599
5600 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
5601     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
5602     GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
5603     GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
5604     GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
5605     GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
5606     GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
5607     GTEST_TEMPLATE_ T22>
5608 struct Templates22 {
5609   typedef TemplateSel<T1> Head;
5610   typedef Templates21<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
5611       T15, T16, T17, T18, T19, T20, T21, T22> Tail;
5612 };
5613
5614 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
5615     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
5616     GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
5617     GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
5618     GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
5619     GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
5620     GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
5621     GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23>
5622 struct Templates23 {
5623   typedef TemplateSel<T1> Head;
5624   typedef Templates22<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
5625       T15, T16, T17, T18, T19, T20, T21, T22, T23> Tail;
5626 };
5627
5628 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
5629     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
5630     GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
5631     GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
5632     GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
5633     GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
5634     GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
5635     GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24>
5636 struct Templates24 {
5637   typedef TemplateSel<T1> Head;
5638   typedef Templates23<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
5639       T15, T16, T17, T18, T19, T20, T21, T22, T23, T24> Tail;
5640 };
5641
5642 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
5643     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
5644     GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
5645     GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
5646     GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
5647     GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
5648     GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
5649     GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
5650     GTEST_TEMPLATE_ T25>
5651 struct Templates25 {
5652   typedef TemplateSel<T1> Head;
5653   typedef Templates24<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
5654       T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25> Tail;
5655 };
5656
5657 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
5658     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
5659     GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
5660     GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
5661     GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
5662     GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
5663     GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
5664     GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
5665     GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26>
5666 struct Templates26 {
5667   typedef TemplateSel<T1> Head;
5668   typedef Templates25<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
5669       T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26> Tail;
5670 };
5671
5672 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
5673     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
5674     GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
5675     GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
5676     GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
5677     GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
5678     GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
5679     GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
5680     GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27>
5681 struct Templates27 {
5682   typedef TemplateSel<T1> Head;
5683   typedef Templates26<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
5684       T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27> Tail;
5685 };
5686
5687 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
5688     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
5689     GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
5690     GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
5691     GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
5692     GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
5693     GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
5694     GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
5695     GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
5696     GTEST_TEMPLATE_ T28>
5697 struct Templates28 {
5698   typedef TemplateSel<T1> Head;
5699   typedef Templates27<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
5700       T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
5701       T28> Tail;
5702 };
5703
5704 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
5705     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
5706     GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
5707     GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
5708     GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
5709     GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
5710     GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
5711     GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
5712     GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
5713     GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29>
5714 struct Templates29 {
5715   typedef TemplateSel<T1> Head;
5716   typedef Templates28<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
5717       T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
5718       T29> Tail;
5719 };
5720
5721 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
5722     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
5723     GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
5724     GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
5725     GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
5726     GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
5727     GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
5728     GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
5729     GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
5730     GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30>
5731 struct Templates30 {
5732   typedef TemplateSel<T1> Head;
5733   typedef Templates29<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
5734       T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
5735       T29, T30> Tail;
5736 };
5737
5738 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
5739     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
5740     GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
5741     GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
5742     GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
5743     GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
5744     GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
5745     GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
5746     GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
5747     GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
5748     GTEST_TEMPLATE_ T31>
5749 struct Templates31 {
5750   typedef TemplateSel<T1> Head;
5751   typedef Templates30<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
5752       T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
5753       T29, T30, T31> Tail;
5754 };
5755
5756 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
5757     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
5758     GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
5759     GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
5760     GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
5761     GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
5762     GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
5763     GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
5764     GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
5765     GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
5766     GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32>
5767 struct Templates32 {
5768   typedef TemplateSel<T1> Head;
5769   typedef Templates31<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
5770       T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
5771       T29, T30, T31, T32> Tail;
5772 };
5773
5774 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
5775     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
5776     GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
5777     GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
5778     GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
5779     GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
5780     GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
5781     GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
5782     GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
5783     GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
5784     GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33>
5785 struct Templates33 {
5786   typedef TemplateSel<T1> Head;
5787   typedef Templates32<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
5788       T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
5789       T29, T30, T31, T32, T33> Tail;
5790 };
5791
5792 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
5793     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
5794     GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
5795     GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
5796     GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
5797     GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
5798     GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
5799     GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
5800     GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
5801     GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
5802     GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
5803     GTEST_TEMPLATE_ T34>
5804 struct Templates34 {
5805   typedef TemplateSel<T1> Head;
5806   typedef Templates33<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
5807       T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
5808       T29, T30, T31, T32, T33, T34> Tail;
5809 };
5810
5811 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
5812     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
5813     GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
5814     GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
5815     GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
5816     GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
5817     GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
5818     GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
5819     GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
5820     GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
5821     GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
5822     GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35>
5823 struct Templates35 {
5824   typedef TemplateSel<T1> Head;
5825   typedef Templates34<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
5826       T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
5827       T29, T30, T31, T32, T33, T34, T35> Tail;
5828 };
5829
5830 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
5831     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
5832     GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
5833     GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
5834     GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
5835     GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
5836     GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
5837     GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
5838     GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
5839     GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
5840     GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
5841     GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36>
5842 struct Templates36 {
5843   typedef TemplateSel<T1> Head;
5844   typedef Templates35<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
5845       T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
5846       T29, T30, T31, T32, T33, T34, T35, T36> Tail;
5847 };
5848
5849 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
5850     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
5851     GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
5852     GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
5853     GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
5854     GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
5855     GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
5856     GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
5857     GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
5858     GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
5859     GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
5860     GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
5861     GTEST_TEMPLATE_ T37>
5862 struct Templates37 {
5863   typedef TemplateSel<T1> Head;
5864   typedef Templates36<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
5865       T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
5866       T29, T30, T31, T32, T33, T34, T35, T36, T37> Tail;
5867 };
5868
5869 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
5870     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
5871     GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
5872     GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
5873     GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
5874     GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
5875     GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
5876     GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
5877     GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
5878     GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
5879     GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
5880     GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
5881     GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38>
5882 struct Templates38 {
5883   typedef TemplateSel<T1> Head;
5884   typedef Templates37<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
5885       T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
5886       T29, T30, T31, T32, T33, T34, T35, T36, T37, T38> Tail;
5887 };
5888
5889 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
5890     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
5891     GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
5892     GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
5893     GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
5894     GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
5895     GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
5896     GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
5897     GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
5898     GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
5899     GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
5900     GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
5901     GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39>
5902 struct Templates39 {
5903   typedef TemplateSel<T1> Head;
5904   typedef Templates38<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
5905       T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
5906       T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39> Tail;
5907 };
5908
5909 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
5910     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
5911     GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
5912     GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
5913     GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
5914     GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
5915     GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
5916     GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
5917     GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
5918     GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
5919     GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
5920     GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
5921     GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,
5922     GTEST_TEMPLATE_ T40>
5923 struct Templates40 {
5924   typedef TemplateSel<T1> Head;
5925   typedef Templates39<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
5926       T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
5927       T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40> Tail;
5928 };
5929
5930 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
5931     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
5932     GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
5933     GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
5934     GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
5935     GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
5936     GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
5937     GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
5938     GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
5939     GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
5940     GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
5941     GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
5942     GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,
5943     GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41>
5944 struct Templates41 {
5945   typedef TemplateSel<T1> Head;
5946   typedef Templates40<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
5947       T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
5948       T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41> Tail;
5949 };
5950
5951 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
5952     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
5953     GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
5954     GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
5955     GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
5956     GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
5957     GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
5958     GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
5959     GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
5960     GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
5961     GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
5962     GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
5963     GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,
5964     GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42>
5965 struct Templates42 {
5966   typedef TemplateSel<T1> Head;
5967   typedef Templates41<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
5968       T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
5969       T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41,
5970       T42> Tail;
5971 };
5972
5973 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
5974     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
5975     GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
5976     GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
5977     GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
5978     GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
5979     GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
5980     GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
5981     GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
5982     GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
5983     GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
5984     GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
5985     GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,
5986     GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42,
5987     GTEST_TEMPLATE_ T43>
5988 struct Templates43 {
5989   typedef TemplateSel<T1> Head;
5990   typedef Templates42<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
5991       T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
5992       T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42,
5993       T43> Tail;
5994 };
5995
5996 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
5997     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
5998     GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
5999     GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
6000     GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
6001     GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
6002     GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
6003     GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
6004     GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
6005     GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
6006     GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
6007     GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
6008     GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,
6009     GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42,
6010     GTEST_TEMPLATE_ T43, GTEST_TEMPLATE_ T44>
6011 struct Templates44 {
6012   typedef TemplateSel<T1> Head;
6013   typedef Templates43<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
6014       T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
6015       T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42,
6016       T43, T44> Tail;
6017 };
6018
6019 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
6020     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
6021     GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
6022     GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
6023     GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
6024     GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
6025     GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
6026     GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
6027     GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
6028     GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
6029     GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
6030     GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
6031     GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,
6032     GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42,
6033     GTEST_TEMPLATE_ T43, GTEST_TEMPLATE_ T44, GTEST_TEMPLATE_ T45>
6034 struct Templates45 {
6035   typedef TemplateSel<T1> Head;
6036   typedef Templates44<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
6037       T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
6038       T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42,
6039       T43, T44, T45> Tail;
6040 };
6041
6042 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
6043     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
6044     GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
6045     GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
6046     GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
6047     GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
6048     GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
6049     GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
6050     GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
6051     GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
6052     GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
6053     GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
6054     GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,
6055     GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42,
6056     GTEST_TEMPLATE_ T43, GTEST_TEMPLATE_ T44, GTEST_TEMPLATE_ T45,
6057     GTEST_TEMPLATE_ T46>
6058 struct Templates46 {
6059   typedef TemplateSel<T1> Head;
6060   typedef Templates45<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
6061       T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
6062       T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42,
6063       T43, T44, T45, T46> Tail;
6064 };
6065
6066 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
6067     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
6068     GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
6069     GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
6070     GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
6071     GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
6072     GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
6073     GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
6074     GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
6075     GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
6076     GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
6077     GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
6078     GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,
6079     GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42,
6080     GTEST_TEMPLATE_ T43, GTEST_TEMPLATE_ T44, GTEST_TEMPLATE_ T45,
6081     GTEST_TEMPLATE_ T46, GTEST_TEMPLATE_ T47>
6082 struct Templates47 {
6083   typedef TemplateSel<T1> Head;
6084   typedef Templates46<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
6085       T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
6086       T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42,
6087       T43, T44, T45, T46, T47> Tail;
6088 };
6089
6090 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
6091     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
6092     GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
6093     GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
6094     GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
6095     GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
6096     GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
6097     GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
6098     GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
6099     GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
6100     GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
6101     GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
6102     GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,
6103     GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42,
6104     GTEST_TEMPLATE_ T43, GTEST_TEMPLATE_ T44, GTEST_TEMPLATE_ T45,
6105     GTEST_TEMPLATE_ T46, GTEST_TEMPLATE_ T47, GTEST_TEMPLATE_ T48>
6106 struct Templates48 {
6107   typedef TemplateSel<T1> Head;
6108   typedef Templates47<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
6109       T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
6110       T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42,
6111       T43, T44, T45, T46, T47, T48> Tail;
6112 };
6113
6114 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
6115     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
6116     GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
6117     GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
6118     GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
6119     GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
6120     GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
6121     GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
6122     GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
6123     GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
6124     GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
6125     GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
6126     GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,
6127     GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42,
6128     GTEST_TEMPLATE_ T43, GTEST_TEMPLATE_ T44, GTEST_TEMPLATE_ T45,
6129     GTEST_TEMPLATE_ T46, GTEST_TEMPLATE_ T47, GTEST_TEMPLATE_ T48,
6130     GTEST_TEMPLATE_ T49>
6131 struct Templates49 {
6132   typedef TemplateSel<T1> Head;
6133   typedef Templates48<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
6134       T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
6135       T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42,
6136       T43, T44, T45, T46, T47, T48, T49> Tail;
6137 };
6138
6139 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
6140     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
6141     GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
6142     GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
6143     GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
6144     GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
6145     GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
6146     GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
6147     GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
6148     GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
6149     GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
6150     GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
6151     GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,
6152     GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42,
6153     GTEST_TEMPLATE_ T43, GTEST_TEMPLATE_ T44, GTEST_TEMPLATE_ T45,
6154     GTEST_TEMPLATE_ T46, GTEST_TEMPLATE_ T47, GTEST_TEMPLATE_ T48,
6155     GTEST_TEMPLATE_ T49, GTEST_TEMPLATE_ T50>
6156 struct Templates50 {
6157   typedef TemplateSel<T1> Head;
6158   typedef Templates49<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
6159       T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
6160       T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42,
6161       T43, T44, T45, T46, T47, T48, T49, T50> Tail;
6162 };
6163
6164
6165 // We don't want to require the users to write TemplatesN<...> directly,
6166 // as that would require them to count the length.  Templates<...> is much
6167 // easier to write, but generates horrible messages when there is a
6168 // compiler error, as gcc insists on printing out each template
6169 // argument, even if it has the default value (this means Templates<list>
6170 // will appear as Templates<list, NoneT, NoneT, ..., NoneT> in the compiler
6171 // errors).
6172 //
6173 // Our solution is to combine the best part of the two approaches: a
6174 // user would write Templates<T1, ..., TN>, and Google Test will translate
6175 // that to TemplatesN<T1, ..., TN> internally to make error messages
6176 // readable.  The translation is done by the 'type' member of the
6177 // Templates template.
6178 template <GTEST_TEMPLATE_ T1 = NoneT, GTEST_TEMPLATE_ T2 = NoneT,
6179     GTEST_TEMPLATE_ T3 = NoneT, GTEST_TEMPLATE_ T4 = NoneT,
6180     GTEST_TEMPLATE_ T5 = NoneT, GTEST_TEMPLATE_ T6 = NoneT,
6181     GTEST_TEMPLATE_ T7 = NoneT, GTEST_TEMPLATE_ T8 = NoneT,
6182     GTEST_TEMPLATE_ T9 = NoneT, GTEST_TEMPLATE_ T10 = NoneT,
6183     GTEST_TEMPLATE_ T11 = NoneT, GTEST_TEMPLATE_ T12 = NoneT,
6184     GTEST_TEMPLATE_ T13 = NoneT, GTEST_TEMPLATE_ T14 = NoneT,
6185     GTEST_TEMPLATE_ T15 = NoneT, GTEST_TEMPLATE_ T16 = NoneT,
6186     GTEST_TEMPLATE_ T17 = NoneT, GTEST_TEMPLATE_ T18 = NoneT,
6187     GTEST_TEMPLATE_ T19 = NoneT, GTEST_TEMPLATE_ T20 = NoneT,
6188     GTEST_TEMPLATE_ T21 = NoneT, GTEST_TEMPLATE_ T22 = NoneT,
6189     GTEST_TEMPLATE_ T23 = NoneT, GTEST_TEMPLATE_ T24 = NoneT,
6190     GTEST_TEMPLATE_ T25 = NoneT, GTEST_TEMPLATE_ T26 = NoneT,
6191     GTEST_TEMPLATE_ T27 = NoneT, GTEST_TEMPLATE_ T28 = NoneT,
6192     GTEST_TEMPLATE_ T29 = NoneT, GTEST_TEMPLATE_ T30 = NoneT,
6193     GTEST_TEMPLATE_ T31 = NoneT, GTEST_TEMPLATE_ T32 = NoneT,
6194     GTEST_TEMPLATE_ T33 = NoneT, GTEST_TEMPLATE_ T34 = NoneT,
6195     GTEST_TEMPLATE_ T35 = NoneT, GTEST_TEMPLATE_ T36 = NoneT,
6196     GTEST_TEMPLATE_ T37 = NoneT, GTEST_TEMPLATE_ T38 = NoneT,
6197     GTEST_TEMPLATE_ T39 = NoneT, GTEST_TEMPLATE_ T40 = NoneT,
6198     GTEST_TEMPLATE_ T41 = NoneT, GTEST_TEMPLATE_ T42 = NoneT,
6199     GTEST_TEMPLATE_ T43 = NoneT, GTEST_TEMPLATE_ T44 = NoneT,
6200     GTEST_TEMPLATE_ T45 = NoneT, GTEST_TEMPLATE_ T46 = NoneT,
6201     GTEST_TEMPLATE_ T47 = NoneT, GTEST_TEMPLATE_ T48 = NoneT,
6202     GTEST_TEMPLATE_ T49 = NoneT, GTEST_TEMPLATE_ T50 = NoneT>
6203 struct Templates {
6204   typedef Templates50<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
6205       T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
6206       T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41,
6207       T42, T43, T44, T45, T46, T47, T48, T49, T50> type;
6208 };
6209
6210 template <>
6211 struct Templates<NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
6212     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
6213     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
6214     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
6215     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
6216     NoneT> {
6217   typedef Templates0 type;
6218 };
6219 template <GTEST_TEMPLATE_ T1>
6220 struct Templates<T1, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
6221     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
6222     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
6223     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
6224     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
6225     NoneT> {
6226   typedef Templates1<T1> type;
6227 };
6228 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2>
6229 struct Templates<T1, T2, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
6230     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
6231     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
6232     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
6233     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
6234     NoneT> {
6235   typedef Templates2<T1, T2> type;
6236 };
6237 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3>
6238 struct Templates<T1, T2, T3, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
6239     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
6240     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
6241     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
6242     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
6243   typedef Templates3<T1, T2, T3> type;
6244 };
6245 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
6246     GTEST_TEMPLATE_ T4>
6247 struct Templates<T1, T2, T3, T4, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
6248     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
6249     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
6250     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
6251     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
6252   typedef Templates4<T1, T2, T3, T4> type;
6253 };
6254 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
6255     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5>
6256 struct Templates<T1, T2, T3, T4, T5, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
6257     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
6258     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
6259     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
6260     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
6261   typedef Templates5<T1, T2, T3, T4, T5> type;
6262 };
6263 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
6264     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6>
6265 struct Templates<T1, T2, T3, T4, T5, T6, NoneT, NoneT, NoneT, NoneT, NoneT,
6266     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
6267     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
6268     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
6269     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
6270   typedef Templates6<T1, T2, T3, T4, T5, T6> type;
6271 };
6272 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
6273     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
6274     GTEST_TEMPLATE_ T7>
6275 struct Templates<T1, T2, T3, T4, T5, T6, T7, NoneT, NoneT, NoneT, NoneT, NoneT,
6276     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
6277     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
6278     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
6279     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
6280   typedef Templates7<T1, T2, T3, T4, T5, T6, T7> type;
6281 };
6282 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
6283     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
6284     GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8>
6285 struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, NoneT, NoneT, NoneT, NoneT,
6286     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
6287     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
6288     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
6289     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
6290   typedef Templates8<T1, T2, T3, T4, T5, T6, T7, T8> type;
6291 };
6292 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
6293     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
6294     GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9>
6295 struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, NoneT, NoneT, NoneT,
6296     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
6297     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
6298     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
6299     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
6300   typedef Templates9<T1, T2, T3, T4, T5, T6, T7, T8, T9> type;
6301 };
6302 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
6303     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
6304     GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
6305     GTEST_TEMPLATE_ T10>
6306 struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, NoneT, NoneT, NoneT,
6307     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
6308     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
6309     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
6310     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
6311   typedef Templates10<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> type;
6312 };
6313 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
6314     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
6315     GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
6316     GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11>
6317 struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, NoneT, NoneT,
6318     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
6319     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
6320     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
6321     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
6322   typedef Templates11<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11> type;
6323 };
6324 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
6325     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
6326     GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
6327     GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12>
6328 struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, NoneT,
6329     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
6330     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
6331     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
6332     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
6333   typedef Templates12<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12> type;
6334 };
6335 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
6336     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
6337     GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
6338     GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
6339     GTEST_TEMPLATE_ T13>
6340 struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, NoneT,
6341     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
6342     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
6343     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
6344     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
6345   typedef Templates13<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
6346       T13> type;
6347 };
6348 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
6349     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
6350     GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
6351     GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
6352     GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14>
6353 struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
6354     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
6355     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
6356     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
6357     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
6358   typedef Templates14<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
6359       T14> type;
6360 };
6361 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
6362     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
6363     GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
6364     GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
6365     GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15>
6366 struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
6367     T15, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
6368     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
6369     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
6370     NoneT, NoneT, NoneT, NoneT, NoneT> {
6371   typedef Templates15<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
6372       T14, T15> type;
6373 };
6374 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
6375     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
6376     GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
6377     GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
6378     GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
6379     GTEST_TEMPLATE_ T16>
6380 struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
6381     T15, T16, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
6382     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
6383     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
6384     NoneT, NoneT, NoneT, NoneT, NoneT> {
6385   typedef Templates16<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
6386       T14, T15, T16> type;
6387 };
6388 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
6389     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
6390     GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
6391     GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
6392     GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
6393     GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17>
6394 struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
6395     T15, T16, T17, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
6396     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
6397     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
6398     NoneT, NoneT, NoneT, NoneT, NoneT> {
6399   typedef Templates17<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
6400       T14, T15, T16, T17> type;
6401 };
6402 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
6403     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
6404     GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
6405     GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
6406     GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
6407     GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18>
6408 struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
6409     T15, T16, T17, T18, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
6410     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
6411     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
6412     NoneT, NoneT, NoneT, NoneT> {
6413   typedef Templates18<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
6414       T14, T15, T16, T17, T18> type;
6415 };
6416 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
6417     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
6418     GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
6419     GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
6420     GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
6421     GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
6422     GTEST_TEMPLATE_ T19>
6423 struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
6424     T15, T16, T17, T18, T19, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
6425     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
6426     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
6427     NoneT, NoneT, NoneT, NoneT> {
6428   typedef Templates19<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
6429       T14, T15, T16, T17, T18, T19> type;
6430 };
6431 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
6432     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
6433     GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
6434     GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
6435     GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
6436     GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
6437     GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20>
6438 struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
6439     T15, T16, T17, T18, T19, T20, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
6440     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
6441     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
6442     NoneT, NoneT, NoneT, NoneT> {
6443   typedef Templates20<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
6444       T14, T15, T16, T17, T18, T19, T20> type;
6445 };
6446 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
6447     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
6448     GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
6449     GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
6450     GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
6451     GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
6452     GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21>
6453 struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
6454     T15, T16, T17, T18, T19, T20, T21, NoneT, NoneT, NoneT, NoneT, NoneT,
6455     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
6456     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
6457     NoneT, NoneT, NoneT, NoneT> {
6458   typedef Templates21<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
6459       T14, T15, T16, T17, T18, T19, T20, T21> type;
6460 };
6461 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
6462     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
6463     GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
6464     GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
6465     GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
6466     GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
6467     GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
6468     GTEST_TEMPLATE_ T22>
6469 struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
6470     T15, T16, T17, T18, T19, T20, T21, T22, NoneT, NoneT, NoneT, NoneT, NoneT,
6471     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
6472     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
6473     NoneT, NoneT, NoneT> {
6474   typedef Templates22<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
6475       T14, T15, T16, T17, T18, T19, T20, T21, T22> type;
6476 };
6477 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
6478     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
6479     GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
6480     GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
6481     GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
6482     GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
6483     GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
6484     GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23>
6485 struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
6486     T15, T16, T17, T18, T19, T20, T21, T22, T23, NoneT, NoneT, NoneT, NoneT,
6487     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
6488     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
6489     NoneT, NoneT, NoneT> {
6490   typedef Templates23<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
6491       T14, T15, T16, T17, T18, T19, T20, T21, T22, T23> type;
6492 };
6493 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
6494     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
6495     GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
6496     GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
6497     GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
6498     GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
6499     GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
6500     GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24>
6501 struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
6502     T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, NoneT, NoneT, NoneT,
6503     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
6504     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
6505     NoneT, NoneT, NoneT> {
6506   typedef Templates24<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
6507       T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24> type;
6508 };
6509 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
6510     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
6511     GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
6512     GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
6513     GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
6514     GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
6515     GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
6516     GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
6517     GTEST_TEMPLATE_ T25>
6518 struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
6519     T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, NoneT, NoneT, NoneT,
6520     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
6521     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
6522     NoneT, NoneT> {
6523   typedef Templates25<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
6524       T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25> type;
6525 };
6526 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
6527     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
6528     GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
6529     GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
6530     GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
6531     GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
6532     GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
6533     GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
6534     GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26>
6535 struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
6536     T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, NoneT, NoneT,
6537     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
6538     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
6539     NoneT, NoneT> {
6540   typedef Templates26<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
6541       T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26> type;
6542 };
6543 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
6544     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
6545     GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
6546     GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
6547     GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
6548     GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
6549     GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
6550     GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
6551     GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27>
6552 struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
6553     T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, NoneT,
6554     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
6555     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
6556     NoneT, NoneT> {
6557   typedef Templates27<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
6558       T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
6559       T27> type;
6560 };
6561 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
6562     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
6563     GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
6564     GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
6565     GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
6566     GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
6567     GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
6568     GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
6569     GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
6570     GTEST_TEMPLATE_ T28>
6571 struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
6572     T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
6573     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
6574     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
6575     NoneT, NoneT> {
6576   typedef Templates28<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
6577       T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
6578       T28> type;
6579 };
6580 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
6581     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
6582     GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
6583     GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
6584     GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
6585     GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
6586     GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
6587     GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
6588     GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
6589     GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29>
6590 struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
6591     T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
6592     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
6593     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
6594     NoneT> {
6595   typedef Templates29<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
6596       T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
6597       T28, T29> type;
6598 };
6599 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
6600     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
6601     GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
6602     GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
6603     GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
6604     GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
6605     GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
6606     GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
6607     GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
6608     GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30>
6609 struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
6610     T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
6611     T30, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
6612     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
6613   typedef Templates30<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
6614       T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
6615       T28, T29, T30> type;
6616 };
6617 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
6618     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
6619     GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
6620     GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
6621     GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
6622     GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
6623     GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
6624     GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
6625     GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
6626     GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
6627     GTEST_TEMPLATE_ T31>
6628 struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
6629     T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
6630     T30, T31, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
6631     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
6632   typedef Templates31<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
6633       T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
6634       T28, T29, T30, T31> type;
6635 };
6636 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
6637     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
6638     GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
6639     GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
6640     GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
6641     GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
6642     GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
6643     GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
6644     GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
6645     GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
6646     GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32>
6647 struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
6648     T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
6649     T30, T31, T32, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
6650     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
6651   typedef Templates32<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
6652       T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
6653       T28, T29, T30, T31, T32> type;
6654 };
6655 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
6656     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
6657     GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
6658     GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
6659     GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
6660     GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
6661     GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
6662     GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
6663     GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
6664     GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
6665     GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33>
6666 struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
6667     T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
6668     T30, T31, T32, T33, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
6669     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
6670   typedef Templates33<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
6671       T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
6672       T28, T29, T30, T31, T32, T33> type;
6673 };
6674 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
6675     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
6676     GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
6677     GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
6678     GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
6679     GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
6680     GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
6681     GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
6682     GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
6683     GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
6684     GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
6685     GTEST_TEMPLATE_ T34>
6686 struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
6687     T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
6688     T30, T31, T32, T33, T34, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
6689     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
6690   typedef Templates34<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
6691       T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
6692       T28, T29, T30, T31, T32, T33, T34> type;
6693 };
6694 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
6695     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
6696     GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
6697     GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
6698     GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
6699     GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
6700     GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
6701     GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
6702     GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
6703     GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
6704     GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
6705     GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35>
6706 struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
6707     T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
6708     T30, T31, T32, T33, T34, T35, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
6709     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
6710   typedef Templates35<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
6711       T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
6712       T28, T29, T30, T31, T32, T33, T34, T35> type;
6713 };
6714 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
6715     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
6716     GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
6717     GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
6718     GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
6719     GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
6720     GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
6721     GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
6722     GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
6723     GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
6724     GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
6725     GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36>
6726 struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
6727     T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
6728     T30, T31, T32, T33, T34, T35, T36, NoneT, NoneT, NoneT, NoneT, NoneT,
6729     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
6730   typedef Templates36<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
6731       T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
6732       T28, T29, T30, T31, T32, T33, T34, T35, T36> type;
6733 };
6734 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
6735     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
6736     GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
6737     GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
6738     GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
6739     GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
6740     GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
6741     GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
6742     GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
6743     GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
6744     GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
6745     GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
6746     GTEST_TEMPLATE_ T37>
6747 struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
6748     T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
6749     T30, T31, T32, T33, T34, T35, T36, T37, NoneT, NoneT, NoneT, NoneT, NoneT,
6750     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
6751   typedef Templates37<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
6752       T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
6753       T28, T29, T30, T31, T32, T33, T34, T35, T36, T37> type;
6754 };
6755 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
6756     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
6757     GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
6758     GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
6759     GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
6760     GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
6761     GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
6762     GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
6763     GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
6764     GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
6765     GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
6766     GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
6767     GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38>
6768 struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
6769     T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
6770     T30, T31, T32, T33, T34, T35, T36, T37, T38, NoneT, NoneT, NoneT, NoneT,
6771     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
6772   typedef Templates38<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
6773       T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
6774       T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38> type;
6775 };
6776 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
6777     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
6778     GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
6779     GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
6780     GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
6781     GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
6782     GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
6783     GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
6784     GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
6785     GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
6786     GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
6787     GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
6788     GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39>
6789 struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
6790     T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
6791     T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, NoneT, NoneT, NoneT,
6792     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
6793   typedef Templates39<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
6794       T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
6795       T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39> type;
6796 };
6797 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
6798     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
6799     GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
6800     GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
6801     GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
6802     GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
6803     GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
6804     GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
6805     GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
6806     GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
6807     GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
6808     GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
6809     GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,
6810     GTEST_TEMPLATE_ T40>
6811 struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
6812     T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
6813     T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, NoneT, NoneT, NoneT,
6814     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
6815   typedef Templates40<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
6816       T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
6817       T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40> type;
6818 };
6819 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
6820     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
6821     GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
6822     GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
6823     GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
6824     GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
6825     GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
6826     GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
6827     GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
6828     GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
6829     GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
6830     GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
6831     GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,
6832     GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41>
6833 struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
6834     T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
6835     T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, NoneT, NoneT,
6836     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
6837   typedef Templates41<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
6838       T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
6839       T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40,
6840       T41> type;
6841 };
6842 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
6843     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
6844     GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
6845     GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
6846     GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
6847     GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
6848     GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
6849     GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
6850     GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
6851     GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
6852     GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
6853     GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
6854     GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,
6855     GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42>
6856 struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
6857     T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
6858     T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, NoneT,
6859     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
6860   typedef Templates42<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
6861       T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
6862       T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41,
6863       T42> type;
6864 };
6865 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
6866     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
6867     GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
6868     GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
6869     GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
6870     GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
6871     GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
6872     GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
6873     GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
6874     GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
6875     GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
6876     GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
6877     GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,
6878     GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42,
6879     GTEST_TEMPLATE_ T43>
6880 struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
6881     T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
6882     T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43,
6883     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
6884   typedef Templates43<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
6885       T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
6886       T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41,
6887       T42, T43> type;
6888 };
6889 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
6890     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
6891     GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
6892     GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
6893     GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
6894     GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
6895     GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
6896     GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
6897     GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
6898     GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
6899     GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
6900     GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
6901     GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,
6902     GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42,
6903     GTEST_TEMPLATE_ T43, GTEST_TEMPLATE_ T44>
6904 struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
6905     T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
6906     T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, T44,
6907     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
6908   typedef Templates44<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
6909       T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
6910       T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41,
6911       T42, T43, T44> type;
6912 };
6913 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
6914     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
6915     GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
6916     GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
6917     GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
6918     GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
6919     GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
6920     GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
6921     GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
6922     GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
6923     GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
6924     GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
6925     GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,
6926     GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42,
6927     GTEST_TEMPLATE_ T43, GTEST_TEMPLATE_ T44, GTEST_TEMPLATE_ T45>
6928 struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
6929     T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
6930     T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, T44,
6931     T45, NoneT, NoneT, NoneT, NoneT, NoneT> {
6932   typedef Templates45<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
6933       T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
6934       T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41,
6935       T42, T43, T44, T45> type;
6936 };
6937 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
6938     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
6939     GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
6940     GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
6941     GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
6942     GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
6943     GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
6944     GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
6945     GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
6946     GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
6947     GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
6948     GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
6949     GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,
6950     GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42,
6951     GTEST_TEMPLATE_ T43, GTEST_TEMPLATE_ T44, GTEST_TEMPLATE_ T45,
6952     GTEST_TEMPLATE_ T46>
6953 struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
6954     T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
6955     T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, T44,
6956     T45, T46, NoneT, NoneT, NoneT, NoneT> {
6957   typedef Templates46<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
6958       T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
6959       T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41,
6960       T42, T43, T44, T45, T46> type;
6961 };
6962 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
6963     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
6964     GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
6965     GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
6966     GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
6967     GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
6968     GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
6969     GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
6970     GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
6971     GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
6972     GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
6973     GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
6974     GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,
6975     GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42,
6976     GTEST_TEMPLATE_ T43, GTEST_TEMPLATE_ T44, GTEST_TEMPLATE_ T45,
6977     GTEST_TEMPLATE_ T46, GTEST_TEMPLATE_ T47>
6978 struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
6979     T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
6980     T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, T44,
6981     T45, T46, T47, NoneT, NoneT, NoneT> {
6982   typedef Templates47<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
6983       T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
6984       T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41,
6985       T42, T43, T44, T45, T46, T47> type;
6986 };
6987 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
6988     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
6989     GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
6990     GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
6991     GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
6992     GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
6993     GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
6994     GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
6995     GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
6996     GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
6997     GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
6998     GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
6999     GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,
7000     GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42,
7001     GTEST_TEMPLATE_ T43, GTEST_TEMPLATE_ T44, GTEST_TEMPLATE_ T45,
7002     GTEST_TEMPLATE_ T46, GTEST_TEMPLATE_ T47, GTEST_TEMPLATE_ T48>
7003 struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
7004     T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
7005     T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, T44,
7006     T45, T46, T47, T48, NoneT, NoneT> {
7007   typedef Templates48<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
7008       T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
7009       T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41,
7010       T42, T43, T44, T45, T46, T47, T48> type;
7011 };
7012 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
7013     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
7014     GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
7015     GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
7016     GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
7017     GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
7018     GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
7019     GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
7020     GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
7021     GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
7022     GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
7023     GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
7024     GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,
7025     GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42,
7026     GTEST_TEMPLATE_ T43, GTEST_TEMPLATE_ T44, GTEST_TEMPLATE_ T45,
7027     GTEST_TEMPLATE_ T46, GTEST_TEMPLATE_ T47, GTEST_TEMPLATE_ T48,
7028     GTEST_TEMPLATE_ T49>
7029 struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
7030     T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
7031     T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, T44,
7032     T45, T46, T47, T48, T49, NoneT> {
7033   typedef Templates49<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
7034       T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
7035       T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41,
7036       T42, T43, T44, T45, T46, T47, T48, T49> type;
7037 };
7038
7039 // The TypeList template makes it possible to use either a single type
7040 // or a Types<...> list in TYPED_TEST_CASE() and
7041 // INSTANTIATE_TYPED_TEST_CASE_P().
7042
7043 template <typename T>
7044 struct TypeList {
7045   typedef Types1<T> type;
7046 };
7047
7048 template <typename T1, typename T2, typename T3, typename T4, typename T5,
7049     typename T6, typename T7, typename T8, typename T9, typename T10,
7050     typename T11, typename T12, typename T13, typename T14, typename T15,
7051     typename T16, typename T17, typename T18, typename T19, typename T20,
7052     typename T21, typename T22, typename T23, typename T24, typename T25,
7053     typename T26, typename T27, typename T28, typename T29, typename T30,
7054     typename T31, typename T32, typename T33, typename T34, typename T35,
7055     typename T36, typename T37, typename T38, typename T39, typename T40,
7056     typename T41, typename T42, typename T43, typename T44, typename T45,
7057     typename T46, typename T47, typename T48, typename T49, typename T50>
7058 struct TypeList<Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
7059     T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
7060     T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43,
7061     T44, T45, T46, T47, T48, T49, T50> > {
7062   typedef typename Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
7063       T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
7064       T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40,
7065       T41, T42, T43, T44, T45, T46, T47, T48, T49, T50>::type type;
7066 };
7067
7068 #endif  // GTEST_HAS_TYPED_TEST || GTEST_HAS_TYPED_TEST_P
7069
7070 }  // namespace internal
7071 }  // namespace testing
7072
7073 #endif  // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_TYPE_UTIL_H_
7074
7075 // Due to C++ preprocessor weirdness, we need double indirection to
7076 // concatenate two tokens when one of them is __LINE__.  Writing
7077 //
7078 //   foo ## __LINE__
7079 //
7080 // will result in the token foo__LINE__, instead of foo followed by
7081 // the current line number.  For more details, see
7082 // http://www.parashift.com/c++-faq-lite/misc-technical-issues.html#faq-39.6
7083 #define GTEST_CONCAT_TOKEN_(foo, bar) GTEST_CONCAT_TOKEN_IMPL_(foo, bar)
7084 #define GTEST_CONCAT_TOKEN_IMPL_(foo, bar) foo ## bar
7085
7086 class ProtocolMessage;
7087 namespace proto2 { class Message; }
7088
7089 namespace testing {
7090
7091 // Forward declarations.
7092
7093 class AssertionResult;                 // Result of an assertion.
7094 class Message;                         // Represents a failure message.
7095 class Test;                            // Represents a test.
7096 class TestInfo;                        // Information about a test.
7097 class TestPartResult;                  // Result of a test part.
7098 class UnitTest;                        // A collection of test cases.
7099
7100 template <typename T>
7101 ::std::string PrintToString(const T& value);
7102
7103 namespace internal {
7104
7105 struct TraceInfo;                      // Information about a trace point.
7106 class ScopedTrace;                     // Implements scoped trace.
7107 class TestInfoImpl;                    // Opaque implementation of TestInfo
7108 class UnitTestImpl;                    // Opaque implementation of UnitTest
7109
7110 // How many times InitGoogleTest() has been called.
7111 GTEST_API_ extern int g_init_gtest_count;
7112
7113 // The text used in failure messages to indicate the start of the
7114 // stack trace.
7115 GTEST_API_ extern const char kStackTraceMarker[];
7116
7117 // Two overloaded helpers for checking at compile time whether an
7118 // expression is a null pointer literal (i.e. NULL or any 0-valued
7119 // compile-time integral constant).  Their return values have
7120 // different sizes, so we can use sizeof() to test which version is
7121 // picked by the compiler.  These helpers have no implementations, as
7122 // we only need their signatures.
7123 //
7124 // Given IsNullLiteralHelper(x), the compiler will pick the first
7125 // version if x can be implicitly converted to Secret*, and pick the
7126 // second version otherwise.  Since Secret is a secret and incomplete
7127 // type, the only expression a user can write that has type Secret* is
7128 // a null pointer literal.  Therefore, we know that x is a null
7129 // pointer literal if and only if the first version is picked by the
7130 // compiler.
7131 char IsNullLiteralHelper(Secret* p);
7132 char (&IsNullLiteralHelper(...))[2];  // NOLINT
7133
7134 // A compile-time bool constant that is true if and only if x is a
7135 // null pointer literal (i.e. NULL or any 0-valued compile-time
7136 // integral constant).
7137 #ifdef GTEST_ELLIPSIS_NEEDS_POD_
7138 // We lose support for NULL detection where the compiler doesn't like
7139 // passing non-POD classes through ellipsis (...).
7140 # define GTEST_IS_NULL_LITERAL_(x) false
7141 #else
7142 # define GTEST_IS_NULL_LITERAL_(x) \
7143     (sizeof(::testing::internal::IsNullLiteralHelper(x)) == 1)
7144 #endif  // GTEST_ELLIPSIS_NEEDS_POD_
7145
7146 // Appends the user-supplied message to the Google-Test-generated message.
7147 GTEST_API_ std::string AppendUserMessage(
7148     const std::string& gtest_msg, const Message& user_msg);
7149
7150 #if GTEST_HAS_EXCEPTIONS
7151
7152 // This exception is thrown by (and only by) a failed Google Test
7153 // assertion when GTEST_FLAG(throw_on_failure) is true (if exceptions
7154 // are enabled).  We derive it from std::runtime_error, which is for
7155 // errors presumably detectable only at run time.  Since
7156 // std::runtime_error inherits from std::exception, many testing
7157 // frameworks know how to extract and print the message inside it.
7158
7159 #ifdef _MSC_VER
7160 # pragma warning(push)          // Saves the current warning state.
7161 # pragma warning(disable:4275)  // Temporarily disables warning 4275.
7162 #endif  // _MSC_VER
7163
7164 class GTEST_API_ GoogleTestFailureException : public ::std::runtime_error {
7165  public:
7166   explicit GoogleTestFailureException(const TestPartResult& failure);
7167 };
7168
7169 #ifdef _MSC_VER
7170 # pragma warning(pop)           // Restores the warning state.
7171 #endif  // _MSC_VER
7172
7173 #endif  // GTEST_HAS_EXCEPTIONS
7174
7175 // A helper class for creating scoped traces in user programs.
7176 class GTEST_API_ ScopedTrace {
7177  public:
7178   // The c'tor pushes the given source file location and message onto
7179   // a trace stack maintained by Google Test.
7180   ScopedTrace(const char* file, int line, const Message& message);
7181
7182   // The d'tor pops the info pushed by the c'tor.
7183   //
7184   // Note that the d'tor is not virtual in order to be efficient.
7185   // Don't inherit from ScopedTrace!
7186   ~ScopedTrace();
7187
7188  private:
7189   GTEST_DISALLOW_COPY_AND_ASSIGN_(ScopedTrace);
7190 } GTEST_ATTRIBUTE_UNUSED_;  // A ScopedTrace object does its job in its
7191                             // c'tor and d'tor.  Therefore it doesn't
7192                             // need to be used otherwise.
7193
7194 // Constructs and returns the message for an equality assertion
7195 // (e.g. ASSERT_EQ, EXPECT_STREQ, etc) failure.
7196 //
7197 // The first four parameters are the expressions used in the assertion
7198 // and their values, as strings.  For example, for ASSERT_EQ(foo, bar)
7199 // where foo is 5 and bar is 6, we have:
7200 //
7201 //   expected_expression: "foo"
7202 //   actual_expression:   "bar"
7203 //   expected_value:      "5"
7204 //   actual_value:        "6"
7205 //
7206 // The ignoring_case parameter is true iff the assertion is a
7207 // *_STRCASEEQ*.  When it's true, the string " (ignoring case)" will
7208 // be inserted into the message.
7209 GTEST_API_ AssertionResult EqFailure(const char* expected_expression,
7210                                      const char* actual_expression,
7211                                      const std::string& expected_value,
7212                                      const std::string& actual_value,
7213                                      bool ignoring_case);
7214
7215 // Constructs a failure message for Boolean assertions such as EXPECT_TRUE.
7216 GTEST_API_ std::string GetBoolAssertionFailureMessage(
7217     const AssertionResult& assertion_result,
7218     const char* expression_text,
7219     const char* actual_predicate_value,
7220     const char* expected_predicate_value);
7221
7222 // This template class represents an IEEE floating-point number
7223 // (either single-precision or double-precision, depending on the
7224 // template parameters).
7225 //
7226 // The purpose of this class is to do more sophisticated number
7227 // comparison.  (Due to round-off error, etc, it's very unlikely that
7228 // two floating-points will be equal exactly.  Hence a naive
7229 // comparison by the == operation often doesn't work.)
7230 //
7231 // Format of IEEE floating-point:
7232 //
7233 //   The most-significant bit being the leftmost, an IEEE
7234 //   floating-point looks like
7235 //
7236 //     sign_bit exponent_bits fraction_bits
7237 //
7238 //   Here, sign_bit is a single bit that designates the sign of the
7239 //   number.
7240 //
7241 //   For float, there are 8 exponent bits and 23 fraction bits.
7242 //
7243 //   For double, there are 11 exponent bits and 52 fraction bits.
7244 //
7245 //   More details can be found at
7246 //   http://en.wikipedia.org/wiki/IEEE_floating-point_standard.
7247 //
7248 // Template parameter:
7249 //
7250 //   RawType: the raw floating-point type (either float or double)
7251 template <typename RawType>
7252 class FloatingPoint {
7253  public:
7254   // Defines the unsigned integer type that has the same size as the
7255   // floating point number.
7256   typedef typename TypeWithSize<sizeof(RawType)>::UInt Bits;
7257
7258   // Constants.
7259
7260   // # of bits in a number.
7261   static const size_t kBitCount = 8*sizeof(RawType);
7262
7263   // # of fraction bits in a number.
7264   static const size_t kFractionBitCount =
7265     std::numeric_limits<RawType>::digits - 1;
7266
7267   // # of exponent bits in a number.
7268   static const size_t kExponentBitCount = kBitCount - 1 - kFractionBitCount;
7269
7270   // The mask for the sign bit.
7271   static const Bits kSignBitMask = static_cast<Bits>(1) << (kBitCount - 1);
7272
7273   // The mask for the fraction bits.
7274   static const Bits kFractionBitMask =
7275     ~static_cast<Bits>(0) >> (kExponentBitCount + 1);
7276
7277   // The mask for the exponent bits.
7278   static const Bits kExponentBitMask = ~(kSignBitMask | kFractionBitMask);
7279
7280   // How many ULP's (Units in the Last Place) we want to tolerate when
7281   // comparing two numbers.  The larger the value, the more error we
7282   // allow.  A 0 value means that two numbers must be exactly the same
7283   // to be considered equal.
7284   //
7285   // The maximum error of a single floating-point operation is 0.5
7286   // units in the last place.  On Intel CPU's, all floating-point
7287   // calculations are done with 80-bit precision, while double has 64
7288   // bits.  Therefore, 4 should be enough for ordinary use.
7289   //
7290   // See the following article for more details on ULP:
7291   // http://randomascii.wordpress.com/2012/02/25/comparing-floating-point-numbers-2012-edition/
7292   static const size_t kMaxUlps = 4;
7293
7294   // Constructs a FloatingPoint from a raw floating-point number.
7295   //
7296   // On an Intel CPU, passing a non-normalized NAN (Not a Number)
7297   // around may change its bits, although the new value is guaranteed
7298   // to be also a NAN.  Therefore, don't expect this constructor to
7299   // preserve the bits in x when x is a NAN.
7300   explicit FloatingPoint(const RawType& x) { u_.value_ = x; }
7301
7302   // Static methods
7303
7304   // Reinterprets a bit pattern as a floating-point number.
7305   //
7306   // This function is needed to test the AlmostEquals() method.
7307   static RawType ReinterpretBits(const Bits bits) {
7308     FloatingPoint fp(0);
7309     fp.u_.bits_ = bits;
7310     return fp.u_.value_;
7311   }
7312
7313   // Returns the floating-point number that represent positive infinity.
7314   static RawType Infinity() {
7315     return ReinterpretBits(kExponentBitMask);
7316   }
7317
7318   // Non-static methods
7319
7320   // Returns the bits that represents this number.
7321   const Bits &bits() const { return u_.bits_; }
7322
7323   // Returns the exponent bits of this number.
7324   Bits exponent_bits() const { return kExponentBitMask & u_.bits_; }
7325
7326   // Returns the fraction bits of this number.
7327   Bits fraction_bits() const { return kFractionBitMask & u_.bits_; }
7328
7329   // Returns the sign bit of this number.
7330   Bits sign_bit() const { return kSignBitMask & u_.bits_; }
7331
7332   // Returns true iff this is NAN (not a number).
7333   bool is_nan() const {
7334     // It's a NAN if the exponent bits are all ones and the fraction
7335     // bits are not entirely zeros.
7336     return (exponent_bits() == kExponentBitMask) && (fraction_bits() != 0);
7337   }
7338
7339   // Returns true iff this number is at most kMaxUlps ULP's away from
7340   // rhs.  In particular, this function:
7341   //
7342   //   - returns false if either number is (or both are) NAN.
7343   //   - treats really large numbers as almost equal to infinity.
7344   //   - thinks +0.0 and -0.0 are 0 DLP's apart.
7345   bool AlmostEquals(const FloatingPoint& rhs) const {
7346     // The IEEE standard says that any comparison operation involving
7347     // a NAN must return false.
7348     if (is_nan() || rhs.is_nan()) return false;
7349
7350     return DistanceBetweenSignAndMagnitudeNumbers(u_.bits_, rhs.u_.bits_)
7351         <= kMaxUlps;
7352   }
7353
7354  private:
7355   // The data type used to store the actual floating-point number.
7356   union FloatingPointUnion {
7357     RawType value_;  // The raw floating-point number.
7358     Bits bits_;      // The bits that represent the number.
7359   };
7360
7361   // Converts an integer from the sign-and-magnitude representation to
7362   // the biased representation.  More precisely, let N be 2 to the
7363   // power of (kBitCount - 1), an integer x is represented by the
7364   // unsigned number x + N.
7365   //
7366   // For instance,
7367   //
7368   //   -N + 1 (the most negative number representable using
7369   //          sign-and-magnitude) is represented by 1;
7370   //   0      is represented by N; and
7371   //   N - 1  (the biggest number representable using
7372   //          sign-and-magnitude) is represented by 2N - 1.
7373   //
7374   // Read http://en.wikipedia.org/wiki/Signed_number_representations
7375   // for more details on signed number representations.
7376   static Bits SignAndMagnitudeToBiased(const Bits &sam) {
7377     if (kSignBitMask & sam) {
7378       // sam represents a negative number.
7379       return ~sam + 1;
7380     } else {
7381       // sam represents a positive number.
7382       return kSignBitMask | sam;
7383     }
7384   }
7385
7386   // Given two numbers in the sign-and-magnitude representation,
7387   // returns the distance between them as an unsigned number.
7388   static Bits DistanceBetweenSignAndMagnitudeNumbers(const Bits &sam1,
7389                                                      const Bits &sam2) {
7390     const Bits biased1 = SignAndMagnitudeToBiased(sam1);
7391     const Bits biased2 = SignAndMagnitudeToBiased(sam2);
7392     return (biased1 >= biased2) ? (biased1 - biased2) : (biased2 - biased1);
7393   }
7394
7395   FloatingPointUnion u_;
7396 };
7397
7398 // Typedefs the instances of the FloatingPoint template class that we
7399 // care to use.
7400 typedef FloatingPoint<float> Float;
7401 typedef FloatingPoint<double> Double;
7402
7403 // In order to catch the mistake of putting tests that use different
7404 // test fixture classes in the same test case, we need to assign
7405 // unique IDs to fixture classes and compare them.  The TypeId type is
7406 // used to hold such IDs.  The user should treat TypeId as an opaque
7407 // type: the only operation allowed on TypeId values is to compare
7408 // them for equality using the == operator.
7409 typedef const void* TypeId;
7410
7411 template <typename T>
7412 class TypeIdHelper {
7413  public:
7414   // dummy_ must not have a const type.  Otherwise an overly eager
7415   // compiler (e.g. MSVC 7.1 & 8.0) may try to merge
7416   // TypeIdHelper<T>::dummy_ for different Ts as an "optimization".
7417   static bool dummy_;
7418 };
7419
7420 template <typename T>
7421 bool TypeIdHelper<T>::dummy_ = false;
7422
7423 // GetTypeId<T>() returns the ID of type T.  Different values will be
7424 // returned for different types.  Calling the function twice with the
7425 // same type argument is guaranteed to return the same ID.
7426 template <typename T>
7427 TypeId GetTypeId() {
7428   // The compiler is required to allocate a different
7429   // TypeIdHelper<T>::dummy_ variable for each T used to instantiate
7430   // the template.  Therefore, the address of dummy_ is guaranteed to
7431   // be unique.
7432   return &(TypeIdHelper<T>::dummy_);
7433 }
7434
7435 // Returns the type ID of ::testing::Test.  Always call this instead
7436 // of GetTypeId< ::testing::Test>() to get the type ID of
7437 // ::testing::Test, as the latter may give the wrong result due to a
7438 // suspected linker bug when compiling Google Test as a Mac OS X
7439 // framework.
7440 GTEST_API_ TypeId GetTestTypeId();
7441
7442 // Defines the abstract factory interface that creates instances
7443 // of a Test object.
7444 class TestFactoryBase {
7445  public:
7446   virtual ~TestFactoryBase() {}
7447
7448   // Creates a test instance to run. The instance is both created and destroyed
7449   // within TestInfoImpl::Run()
7450   virtual Test* CreateTest() = 0;
7451
7452  protected:
7453   TestFactoryBase() {}
7454
7455  private:
7456   GTEST_DISALLOW_COPY_AND_ASSIGN_(TestFactoryBase);
7457 };
7458
7459 // This class provides implementation of TeastFactoryBase interface.
7460 // It is used in TEST and TEST_F macros.
7461 template <class TestClass>
7462 class TestFactoryImpl : public TestFactoryBase {
7463  public:
7464   virtual Test* CreateTest() { return new TestClass; }
7465 };
7466
7467 #if GTEST_OS_WINDOWS
7468
7469 // Predicate-formatters for implementing the HRESULT checking macros
7470 // {ASSERT|EXPECT}_HRESULT_{SUCCEEDED|FAILED}
7471 // We pass a long instead of HRESULT to avoid causing an
7472 // include dependency for the HRESULT type.
7473 GTEST_API_ AssertionResult IsHRESULTSuccess(const char* expr,
7474                                             long hr);  // NOLINT
7475 GTEST_API_ AssertionResult IsHRESULTFailure(const char* expr,
7476                                             long hr);  // NOLINT
7477
7478 #endif  // GTEST_OS_WINDOWS
7479
7480 // Types of SetUpTestCase() and TearDownTestCase() functions.
7481 typedef void (*SetUpTestCaseFunc)();
7482 typedef void (*TearDownTestCaseFunc)();
7483
7484 // Creates a new TestInfo object and registers it with Google Test;
7485 // returns the created object.
7486 //
7487 // Arguments:
7488 //
7489 //   test_case_name:   name of the test case
7490 //   name:             name of the test
7491 //   type_param        the name of the test's type parameter, or NULL if
7492 //                     this is not a typed or a type-parameterized test.
7493 //   value_param       text representation of the test's value parameter,
7494 //                     or NULL if this is not a type-parameterized test.
7495 //   fixture_class_id: ID of the test fixture class
7496 //   set_up_tc:        pointer to the function that sets up the test case
7497 //   tear_down_tc:     pointer to the function that tears down the test case
7498 //   factory:          pointer to the factory that creates a test object.
7499 //                     The newly created TestInfo instance will assume
7500 //                     ownership of the factory object.
7501 GTEST_API_ TestInfo* MakeAndRegisterTestInfo(
7502     const char* test_case_name,
7503     const char* name,
7504     const char* type_param,
7505     const char* value_param,
7506     TypeId fixture_class_id,
7507     SetUpTestCaseFunc set_up_tc,
7508     TearDownTestCaseFunc tear_down_tc,
7509     TestFactoryBase* factory);
7510
7511 // If *pstr starts with the given prefix, modifies *pstr to be right
7512 // past the prefix and returns true; otherwise leaves *pstr unchanged
7513 // and returns false.  None of pstr, *pstr, and prefix can be NULL.
7514 GTEST_API_ bool SkipPrefix(const char* prefix, const char** pstr);
7515
7516 #if GTEST_HAS_TYPED_TEST || GTEST_HAS_TYPED_TEST_P
7517
7518 // State of the definition of a type-parameterized test case.
7519 class GTEST_API_ TypedTestCasePState {
7520  public:
7521   TypedTestCasePState() : registered_(false) {}
7522
7523   // Adds the given test name to defined_test_names_ and return true
7524   // if the test case hasn't been registered; otherwise aborts the
7525   // program.
7526   bool AddTestName(const char* file, int line, const char* case_name,
7527                    const char* test_name) {
7528     if (registered_) {
7529       fprintf(stderr, "%s Test %s must be defined before "
7530               "REGISTER_TYPED_TEST_CASE_P(%s, ...).\n",
7531               FormatFileLocation(file, line).c_str(), test_name, case_name);
7532       fflush(stderr);
7533       posix::Abort();
7534     }
7535     defined_test_names_.insert(test_name);
7536     return true;
7537   }
7538
7539   // Verifies that registered_tests match the test names in
7540   // defined_test_names_; returns registered_tests if successful, or
7541   // aborts the program otherwise.
7542   const char* VerifyRegisteredTestNames(
7543       const char* file, int line, const char* registered_tests);
7544
7545  private:
7546   bool registered_;
7547   ::std::set<const char*> defined_test_names_;
7548 };
7549
7550 // Skips to the first non-space char after the first comma in 'str';
7551 // returns NULL if no comma is found in 'str'.
7552 inline const char* SkipComma(const char* str) {
7553   const char* comma = strchr(str, ',');
7554   if (comma == NULL) {
7555     return NULL;
7556   }
7557   while (IsSpace(*(++comma))) {}
7558   return comma;
7559 }
7560
7561 // Returns the prefix of 'str' before the first comma in it; returns
7562 // the entire string if it contains no comma.
7563 inline std::string GetPrefixUntilComma(const char* str) {
7564   const char* comma = strchr(str, ',');
7565   return comma == NULL ? str : std::string(str, comma);
7566 }
7567
7568 // TypeParameterizedTest<Fixture, TestSel, Types>::Register()
7569 // registers a list of type-parameterized tests with Google Test.  The
7570 // return value is insignificant - we just need to return something
7571 // such that we can call this function in a namespace scope.
7572 //
7573 // Implementation note: The GTEST_TEMPLATE_ macro declares a template
7574 // template parameter.  It's defined in gtest-type-util.h.
7575 template <GTEST_TEMPLATE_ Fixture, class TestSel, typename Types>
7576 class TypeParameterizedTest {
7577  public:
7578   // 'index' is the index of the test in the type list 'Types'
7579   // specified in INSTANTIATE_TYPED_TEST_CASE_P(Prefix, TestCase,
7580   // Types).  Valid values for 'index' are [0, N - 1] where N is the
7581   // length of Types.
7582   static bool Register(const char* prefix, const char* case_name,
7583                        const char* test_names, int index) {
7584     typedef typename Types::Head Type;
7585     typedef Fixture<Type> FixtureClass;
7586     typedef typename GTEST_BIND_(TestSel, Type) TestClass;
7587
7588     // First, registers the first type-parameterized test in the type
7589     // list.
7590     MakeAndRegisterTestInfo(
7591         (std::string(prefix) + (prefix[0] == '\0' ? "" : "/") + case_name + "/"
7592          + StreamableToString(index)).c_str(),
7593         GetPrefixUntilComma(test_names).c_str(),
7594         GetTypeName<Type>().c_str(),
7595         NULL,  // No value parameter.
7596         GetTypeId<FixtureClass>(),
7597         TestClass::SetUpTestCase,
7598         TestClass::TearDownTestCase,
7599         new TestFactoryImpl<TestClass>);
7600
7601     // Next, recurses (at compile time) with the tail of the type list.
7602     return TypeParameterizedTest<Fixture, TestSel, typename Types::Tail>
7603         ::Register(prefix, case_name, test_names, index + 1);
7604   }
7605 };
7606
7607 // The base case for the compile time recursion.
7608 template <GTEST_TEMPLATE_ Fixture, class TestSel>
7609 class TypeParameterizedTest<Fixture, TestSel, Types0> {
7610  public:
7611   static bool Register(const char* /*prefix*/, const char* /*case_name*/,
7612                        const char* /*test_names*/, int /*index*/) {
7613     return true;
7614   }
7615 };
7616
7617 // TypeParameterizedTestCase<Fixture, Tests, Types>::Register()
7618 // registers *all combinations* of 'Tests' and 'Types' with Google
7619 // Test.  The return value is insignificant - we just need to return
7620 // something such that we can call this function in a namespace scope.
7621 template <GTEST_TEMPLATE_ Fixture, typename Tests, typename Types>
7622 class TypeParameterizedTestCase {
7623  public:
7624   static bool Register(const char* prefix, const char* case_name,
7625                        const char* test_names) {
7626     typedef typename Tests::Head Head;
7627
7628     // First, register the first test in 'Test' for each type in 'Types'.
7629     TypeParameterizedTest<Fixture, Head, Types>::Register(
7630         prefix, case_name, test_names, 0);
7631
7632     // Next, recurses (at compile time) with the tail of the test list.
7633     return TypeParameterizedTestCase<Fixture, typename Tests::Tail, Types>
7634         ::Register(prefix, case_name, SkipComma(test_names));
7635   }
7636 };
7637
7638 // The base case for the compile time recursion.
7639 template <GTEST_TEMPLATE_ Fixture, typename Types>
7640 class TypeParameterizedTestCase<Fixture, Templates0, Types> {
7641  public:
7642   static bool Register(const char* /*prefix*/, const char* /*case_name*/,
7643                        const char* /*test_names*/) {
7644     return true;
7645   }
7646 };
7647
7648 #endif  // GTEST_HAS_TYPED_TEST || GTEST_HAS_TYPED_TEST_P
7649
7650 // Returns the current OS stack trace as an std::string.
7651 //
7652 // The maximum number of stack frames to be included is specified by
7653 // the gtest_stack_trace_depth flag.  The skip_count parameter
7654 // specifies the number of top frames to be skipped, which doesn't
7655 // count against the number of frames to be included.
7656 //
7657 // For example, if Foo() calls Bar(), which in turn calls
7658 // GetCurrentOsStackTraceExceptTop(..., 1), Foo() will be included in
7659 // the trace but Bar() and GetCurrentOsStackTraceExceptTop() won't.
7660 GTEST_API_ std::string GetCurrentOsStackTraceExceptTop(
7661     UnitTest* unit_test, int skip_count);
7662
7663 // Helpers for suppressing warnings on unreachable code or constant
7664 // condition.
7665
7666 // Always returns true.
7667 GTEST_API_ bool AlwaysTrue();
7668
7669 // Always returns false.
7670 inline bool AlwaysFalse() { return !AlwaysTrue(); }
7671
7672 // Helper for suppressing false warning from Clang on a const char*
7673 // variable declared in a conditional expression always being NULL in
7674 // the else branch.
7675 struct GTEST_API_ ConstCharPtr {
7676   ConstCharPtr(const char* str) : value(str) {}
7677   operator bool() const { return true; }
7678   const char* value;
7679 };
7680
7681 // A simple Linear Congruential Generator for generating random
7682 // numbers with a uniform distribution.  Unlike rand() and srand(), it
7683 // doesn't use global state (and therefore can't interfere with user
7684 // code).  Unlike rand_r(), it's portable.  An LCG isn't very random,
7685 // but it's good enough for our purposes.
7686 class GTEST_API_ Random {
7687  public:
7688   static const UInt32 kMaxRange = 1u << 31;
7689
7690   explicit Random(UInt32 seed) : state_(seed) {}
7691
7692   void Reseed(UInt32 seed) { state_ = seed; }
7693
7694   // Generates a random number from [0, range).  Crashes if 'range' is
7695   // 0 or greater than kMaxRange.
7696   UInt32 Generate(UInt32 range);
7697
7698  private:
7699   UInt32 state_;
7700   GTEST_DISALLOW_COPY_AND_ASSIGN_(Random);
7701 };
7702
7703 // Defining a variable of type CompileAssertTypesEqual<T1, T2> will cause a
7704 // compiler error iff T1 and T2 are different types.
7705 template <typename T1, typename T2>
7706 struct CompileAssertTypesEqual;
7707
7708 template <typename T>
7709 struct CompileAssertTypesEqual<T, T> {
7710 };
7711
7712 // Removes the reference from a type if it is a reference type,
7713 // otherwise leaves it unchanged.  This is the same as
7714 // tr1::remove_reference, which is not widely available yet.
7715 template <typename T>
7716 struct RemoveReference { typedef T type; };  // NOLINT
7717 template <typename T>
7718 struct RemoveReference<T&> { typedef T type; };  // NOLINT
7719
7720 // A handy wrapper around RemoveReference that works when the argument
7721 // T depends on template parameters.
7722 #define GTEST_REMOVE_REFERENCE_(T) \
7723     typename ::testing::internal::RemoveReference<T>::type
7724
7725 // Removes const from a type if it is a const type, otherwise leaves
7726 // it unchanged.  This is the same as tr1::remove_const, which is not
7727 // widely available yet.
7728 template <typename T>
7729 struct RemoveConst { typedef T type; };  // NOLINT
7730 template <typename T>
7731 struct RemoveConst<const T> { typedef T type; };  // NOLINT
7732
7733 // MSVC 8.0, Sun C++, and IBM XL C++ have a bug which causes the above
7734 // definition to fail to remove the const in 'const int[3]' and 'const
7735 // char[3][4]'.  The following specialization works around the bug.
7736 template <typename T, size_t N>
7737 struct RemoveConst<const T[N]> {
7738   typedef typename RemoveConst<T>::type type[N];
7739 };
7740
7741 #if defined(_MSC_VER) && _MSC_VER < 1400
7742 // This is the only specialization that allows VC++ 7.1 to remove const in
7743 // 'const int[3] and 'const int[3][4]'.  However, it causes trouble with GCC
7744 // and thus needs to be conditionally compiled.
7745 template <typename T, size_t N>
7746 struct RemoveConst<T[N]> {
7747   typedef typename RemoveConst<T>::type type[N];
7748 };
7749 #endif
7750
7751 // A handy wrapper around RemoveConst that works when the argument
7752 // T depends on template parameters.
7753 #define GTEST_REMOVE_CONST_(T) \
7754     typename ::testing::internal::RemoveConst<T>::type
7755
7756 // Turns const U&, U&, const U, and U all into U.
7757 #define GTEST_REMOVE_REFERENCE_AND_CONST_(T) \
7758     GTEST_REMOVE_CONST_(GTEST_REMOVE_REFERENCE_(T))
7759
7760 // Adds reference to a type if it is not a reference type,
7761 // otherwise leaves it unchanged.  This is the same as
7762 // tr1::add_reference, which is not widely available yet.
7763 template <typename T>
7764 struct AddReference { typedef T& type; };  // NOLINT
7765 template <typename T>
7766 struct AddReference<T&> { typedef T& type; };  // NOLINT
7767
7768 // A handy wrapper around AddReference that works when the argument T
7769 // depends on template parameters.
7770 #define GTEST_ADD_REFERENCE_(T) \
7771     typename ::testing::internal::AddReference<T>::type
7772
7773 // Adds a reference to const on top of T as necessary.  For example,
7774 // it transforms
7775 //
7776 //   char         ==> const char&
7777 //   const char   ==> const char&
7778 //   char&        ==> const char&
7779 //   const char&  ==> const char&
7780 //
7781 // The argument T must depend on some template parameters.
7782 #define GTEST_REFERENCE_TO_CONST_(T) \
7783     GTEST_ADD_REFERENCE_(const GTEST_REMOVE_REFERENCE_(T))
7784
7785 // ImplicitlyConvertible<From, To>::value is a compile-time bool
7786 // constant that's true iff type From can be implicitly converted to
7787 // type To.
7788 template <typename From, typename To>
7789 class ImplicitlyConvertible {
7790  private:
7791   // We need the following helper functions only for their types.
7792   // They have no implementations.
7793
7794   // MakeFrom() is an expression whose type is From.  We cannot simply
7795   // use From(), as the type From may not have a public default
7796   // constructor.
7797   static From MakeFrom();
7798
7799   // These two functions are overloaded.  Given an expression
7800   // Helper(x), the compiler will pick the first version if x can be
7801   // implicitly converted to type To; otherwise it will pick the
7802   // second version.
7803   //
7804   // The first version returns a value of size 1, and the second
7805   // version returns a value of size 2.  Therefore, by checking the
7806   // size of Helper(x), which can be done at compile time, we can tell
7807   // which version of Helper() is used, and hence whether x can be
7808   // implicitly converted to type To.
7809   static char Helper(To);
7810   static char (&Helper(...))[2];  // NOLINT
7811
7812   // We have to put the 'public' section after the 'private' section,
7813   // or MSVC refuses to compile the code.
7814  public:
7815   // MSVC warns about implicitly converting from double to int for
7816   // possible loss of data, so we need to temporarily disable the
7817   // warning.
7818 #ifdef _MSC_VER
7819 # pragma warning(push)          // Saves the current warning state.
7820 # pragma warning(disable:4244)  // Temporarily disables warning 4244.
7821
7822   static const bool value =
7823       sizeof(Helper(ImplicitlyConvertible::MakeFrom())) == 1;
7824 # pragma warning(pop)           // Restores the warning state.
7825 #elif defined(__BORLANDC__)
7826   // C++Builder cannot use member overload resolution during template
7827   // instantiation.  The simplest workaround is to use its C++0x type traits
7828   // functions (C++Builder 2009 and above only).
7829   static const bool value = __is_convertible(From, To);
7830 #else
7831   static const bool value =
7832       sizeof(Helper(ImplicitlyConvertible::MakeFrom())) == 1;
7833 #endif  // _MSV_VER
7834 };
7835 template <typename From, typename To>
7836 const bool ImplicitlyConvertible<From, To>::value;
7837
7838 // IsAProtocolMessage<T>::value is a compile-time bool constant that's
7839 // true iff T is type ProtocolMessage, proto2::Message, or a subclass
7840 // of those.
7841 template <typename T>
7842 struct IsAProtocolMessage
7843     : public bool_constant<
7844   ImplicitlyConvertible<const T*, const ::ProtocolMessage*>::value ||
7845   ImplicitlyConvertible<const T*, const ::proto2::Message*>::value> {
7846 };
7847
7848 // When the compiler sees expression IsContainerTest<C>(0), if C is an
7849 // STL-style container class, the first overload of IsContainerTest
7850 // will be viable (since both C::iterator* and C::const_iterator* are
7851 // valid types and NULL can be implicitly converted to them).  It will
7852 // be picked over the second overload as 'int' is a perfect match for
7853 // the type of argument 0.  If C::iterator or C::const_iterator is not
7854 // a valid type, the first overload is not viable, and the second
7855 // overload will be picked.  Therefore, we can determine whether C is
7856 // a container class by checking the type of IsContainerTest<C>(0).
7857 // The value of the expression is insignificant.
7858 //
7859 // Note that we look for both C::iterator and C::const_iterator.  The
7860 // reason is that C++ injects the name of a class as a member of the
7861 // class itself (e.g. you can refer to class iterator as either
7862 // 'iterator' or 'iterator::iterator').  If we look for C::iterator
7863 // only, for example, we would mistakenly think that a class named
7864 // iterator is an STL container.
7865 //
7866 // Also note that the simpler approach of overloading
7867 // IsContainerTest(typename C::const_iterator*) and
7868 // IsContainerTest(...) doesn't work with Visual Age C++ and Sun C++.
7869 typedef int IsContainer;
7870 template <class C>
7871 IsContainer IsContainerTest(int /* dummy */,
7872                             typename C::iterator* /* it */ = NULL,
7873                             typename C::const_iterator* /* const_it */ = NULL) {
7874   return 0;
7875 }
7876
7877 typedef char IsNotContainer;
7878 template <class C>
7879 IsNotContainer IsContainerTest(long /* dummy */) { return '\0'; }
7880
7881 // EnableIf<condition>::type is void when 'Cond' is true, and
7882 // undefined when 'Cond' is false.  To use SFINAE to make a function
7883 // overload only apply when a particular expression is true, add
7884 // "typename EnableIf<expression>::type* = 0" as the last parameter.
7885 template<bool> struct EnableIf;
7886 template<> struct EnableIf<true> { typedef void type; };  // NOLINT
7887
7888 // Utilities for native arrays.
7889
7890 // ArrayEq() compares two k-dimensional native arrays using the
7891 // elements' operator==, where k can be any integer >= 0.  When k is
7892 // 0, ArrayEq() degenerates into comparing a single pair of values.
7893
7894 template <typename T, typename U>
7895 bool ArrayEq(const T* lhs, size_t size, const U* rhs);
7896
7897 // This generic version is used when k is 0.
7898 template <typename T, typename U>
7899 inline bool ArrayEq(const T& lhs, const U& rhs) { return lhs == rhs; }
7900
7901 // This overload is used when k >= 1.
7902 template <typename T, typename U, size_t N>
7903 inline bool ArrayEq(const T(&lhs)[N], const U(&rhs)[N]) {
7904   return internal::ArrayEq(lhs, N, rhs);
7905 }
7906
7907 // This helper reduces code bloat.  If we instead put its logic inside
7908 // the previous ArrayEq() function, arrays with different sizes would
7909 // lead to different copies of the template code.
7910 template <typename T, typename U>
7911 bool ArrayEq(const T* lhs, size_t size, const U* rhs) {
7912   for (size_t i = 0; i != size; i++) {
7913     if (!internal::ArrayEq(lhs[i], rhs[i]))
7914       return false;
7915   }
7916   return true;
7917 }
7918
7919 // Finds the first element in the iterator range [begin, end) that
7920 // equals elem.  Element may be a native array type itself.
7921 template <typename Iter, typename Element>
7922 Iter ArrayAwareFind(Iter begin, Iter end, const Element& elem) {
7923   for (Iter it = begin; it != end; ++it) {
7924     if (internal::ArrayEq(*it, elem))
7925       return it;
7926   }
7927   return end;
7928 }
7929
7930 // CopyArray() copies a k-dimensional native array using the elements'
7931 // operator=, where k can be any integer >= 0.  When k is 0,
7932 // CopyArray() degenerates into copying a single value.
7933
7934 template <typename T, typename U>
7935 void CopyArray(const T* from, size_t size, U* to);
7936
7937 // This generic version is used when k is 0.
7938 template <typename T, typename U>
7939 inline void CopyArray(const T& from, U* to) { *to = from; }
7940
7941 // This overload is used when k >= 1.
7942 template <typename T, typename U, size_t N>
7943 inline void CopyArray(const T(&from)[N], U(*to)[N]) {
7944   internal::CopyArray(from, N, *to);
7945 }
7946
7947 // This helper reduces code bloat.  If we instead put its logic inside
7948 // the previous CopyArray() function, arrays with different sizes
7949 // would lead to different copies of the template code.
7950 template <typename T, typename U>
7951 void CopyArray(const T* from, size_t size, U* to) {
7952   for (size_t i = 0; i != size; i++) {
7953     internal::CopyArray(from[i], to + i);
7954   }
7955 }
7956
7957 // The relation between an NativeArray object (see below) and the
7958 // native array it represents.
7959 enum RelationToSource {
7960   kReference,  // The NativeArray references the native array.
7961   kCopy        // The NativeArray makes a copy of the native array and
7962                // owns the copy.
7963 };
7964
7965 // Adapts a native array to a read-only STL-style container.  Instead
7966 // of the complete STL container concept, this adaptor only implements
7967 // members useful for Google Mock's container matchers.  New members
7968 // should be added as needed.  To simplify the implementation, we only
7969 // support Element being a raw type (i.e. having no top-level const or
7970 // reference modifier).  It's the client's responsibility to satisfy
7971 // this requirement.  Element can be an array type itself (hence
7972 // multi-dimensional arrays are supported).
7973 template <typename Element>
7974 class NativeArray {
7975  public:
7976   // STL-style container typedefs.
7977   typedef Element value_type;
7978   typedef Element* iterator;
7979   typedef const Element* const_iterator;
7980
7981   // Constructs from a native array.
7982   NativeArray(const Element* array, size_t count, RelationToSource relation) {
7983     Init(array, count, relation);
7984   }
7985
7986   // Copy constructor.
7987   NativeArray(const NativeArray& rhs) {
7988     Init(rhs.array_, rhs.size_, rhs.relation_to_source_);
7989   }
7990
7991   ~NativeArray() {
7992     // Ensures that the user doesn't instantiate NativeArray with a
7993     // const or reference type.
7994     static_cast<void>(StaticAssertTypeEqHelper<Element,
7995         GTEST_REMOVE_REFERENCE_AND_CONST_(Element)>());
7996     if (relation_to_source_ == kCopy)
7997       delete[] array_;
7998   }
7999
8000   // STL-style container methods.
8001   size_t size() const { return size_; }
8002   const_iterator begin() const { return array_; }
8003   const_iterator end() const { return array_ + size_; }
8004   bool operator==(const NativeArray& rhs) const {
8005     return size() == rhs.size() &&
8006         ArrayEq(begin(), size(), rhs.begin());
8007   }
8008
8009  private:
8010   // Initializes this object; makes a copy of the input array if
8011   // 'relation' is kCopy.
8012   void Init(const Element* array, size_t a_size, RelationToSource relation) {
8013     if (relation == kReference) {
8014       array_ = array;
8015     } else {
8016       Element* const copy = new Element[a_size];
8017       CopyArray(array, a_size, copy);
8018       array_ = copy;
8019     }
8020     size_ = a_size;
8021     relation_to_source_ = relation;
8022   }
8023
8024   const Element* array_;
8025   size_t size_;
8026   RelationToSource relation_to_source_;
8027
8028   GTEST_DISALLOW_ASSIGN_(NativeArray);
8029 };
8030
8031 }  // namespace internal
8032 }  // namespace testing
8033
8034 #define GTEST_MESSAGE_AT_(file, line, message, result_type) \
8035   ::testing::internal::AssertHelper(result_type, file, line, message) \
8036     = ::testing::Message()
8037
8038 #define GTEST_MESSAGE_(message, result_type) \
8039   GTEST_MESSAGE_AT_(__FILE__, __LINE__, message, result_type)
8040
8041 #define GTEST_FATAL_FAILURE_(message) \
8042   return GTEST_MESSAGE_(message, ::testing::TestPartResult::kFatalFailure)
8043
8044 #define GTEST_NONFATAL_FAILURE_(message) \
8045   GTEST_MESSAGE_(message, ::testing::TestPartResult::kNonFatalFailure)
8046
8047 #define GTEST_SUCCESS_(message) \
8048   GTEST_MESSAGE_(message, ::testing::TestPartResult::kSuccess)
8049
8050 // Suppresses MSVC warnings 4072 (unreachable code) for the code following
8051 // statement if it returns or throws (or doesn't return or throw in some
8052 // situations).
8053 #define GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement) \
8054   if (::testing::internal::AlwaysTrue()) { statement; }
8055
8056 #define GTEST_TEST_THROW_(statement, expected_exception, fail) \
8057   GTEST_AMBIGUOUS_ELSE_BLOCKER_ \
8058   if (::testing::internal::ConstCharPtr gtest_msg = "") { \
8059     bool gtest_caught_expected = false; \
8060     try { \
8061       GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement); \
8062     } \
8063     catch (expected_exception const&) { \
8064       gtest_caught_expected = true; \
8065     } \
8066     catch (...) { \
8067       gtest_msg.value = \
8068           "Expected: " #statement " throws an exception of type " \
8069           #expected_exception ".\n  Actual: it throws a different type."; \
8070       goto GTEST_CONCAT_TOKEN_(gtest_label_testthrow_, __LINE__); \
8071     } \
8072     if (!gtest_caught_expected) { \
8073       gtest_msg.value = \
8074           "Expected: " #statement " throws an exception of type " \
8075           #expected_exception ".\n  Actual: it throws nothing."; \
8076       goto GTEST_CONCAT_TOKEN_(gtest_label_testthrow_, __LINE__); \
8077     } \
8078   } else \
8079     GTEST_CONCAT_TOKEN_(gtest_label_testthrow_, __LINE__): \
8080       fail(gtest_msg.value)
8081
8082 #define GTEST_TEST_NO_THROW_(statement, fail) \
8083   GTEST_AMBIGUOUS_ELSE_BLOCKER_ \
8084   if (::testing::internal::AlwaysTrue()) { \
8085     try { \
8086       GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement); \
8087     } \
8088     catch (...) { \
8089       goto GTEST_CONCAT_TOKEN_(gtest_label_testnothrow_, __LINE__); \
8090     } \
8091   } else \
8092     GTEST_CONCAT_TOKEN_(gtest_label_testnothrow_, __LINE__): \
8093       fail("Expected: " #statement " doesn't throw an exception.\n" \
8094            "  Actual: it throws.")
8095
8096 #define GTEST_TEST_ANY_THROW_(statement, fail) \
8097   GTEST_AMBIGUOUS_ELSE_BLOCKER_ \
8098   if (::testing::internal::AlwaysTrue()) { \
8099     bool gtest_caught_any = false; \
8100     try { \
8101       GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement); \
8102     } \
8103     catch (...) { \
8104       gtest_caught_any = true; \
8105     } \
8106     if (!gtest_caught_any) { \
8107       goto GTEST_CONCAT_TOKEN_(gtest_label_testanythrow_, __LINE__); \
8108     } \
8109   } else \
8110     GTEST_CONCAT_TOKEN_(gtest_label_testanythrow_, __LINE__): \
8111       fail("Expected: " #statement " throws an exception.\n" \
8112            "  Actual: it doesn't.")
8113
8114
8115 // Implements Boolean test assertions such as EXPECT_TRUE. expression can be
8116 // either a boolean expression or an AssertionResult. text is a textual
8117 // represenation of expression as it was passed into the EXPECT_TRUE.
8118 #define GTEST_TEST_BOOLEAN_(expression, text, actual, expected, fail) \
8119   GTEST_AMBIGUOUS_ELSE_BLOCKER_ \
8120   if (const ::testing::AssertionResult gtest_ar_ = \
8121       ::testing::AssertionResult(expression)) \
8122     ; \
8123   else \
8124     fail(::testing::internal::GetBoolAssertionFailureMessage(\
8125         gtest_ar_, text, #actual, #expected).c_str())
8126
8127 #define GTEST_TEST_NO_FATAL_FAILURE_(statement, fail) \
8128   GTEST_AMBIGUOUS_ELSE_BLOCKER_ \
8129   if (::testing::internal::AlwaysTrue()) { \
8130     ::testing::internal::HasNewFatalFailureHelper gtest_fatal_failure_checker; \
8131     GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement); \
8132     if (gtest_fatal_failure_checker.has_new_fatal_failure()) { \
8133       goto GTEST_CONCAT_TOKEN_(gtest_label_testnofatal_, __LINE__); \
8134     } \
8135   } else \
8136     GTEST_CONCAT_TOKEN_(gtest_label_testnofatal_, __LINE__): \
8137       fail("Expected: " #statement " doesn't generate new fatal " \
8138            "failures in the current thread.\n" \
8139            "  Actual: it does.")
8140
8141 // Expands to the name of the class that implements the given test.
8142 #define GTEST_TEST_CLASS_NAME_(test_case_name, test_name) \
8143   test_case_name##_##test_name##_Test
8144
8145 // Helper macro for defining tests.
8146 #define GTEST_TEST_(test_case_name, test_name, parent_class, parent_id)\
8147 class GTEST_TEST_CLASS_NAME_(test_case_name, test_name) : public parent_class {\
8148  public:\
8149   GTEST_TEST_CLASS_NAME_(test_case_name, test_name)() {}\
8150  private:\
8151   virtual void TestBody();\
8152   static ::testing::TestInfo* const test_info_ GTEST_ATTRIBUTE_UNUSED_;\
8153   GTEST_DISALLOW_COPY_AND_ASSIGN_(\
8154       GTEST_TEST_CLASS_NAME_(test_case_name, test_name));\
8155 };\
8156 \
8157 ::testing::TestInfo* const GTEST_TEST_CLASS_NAME_(test_case_name, test_name)\
8158   ::test_info_ =\
8159     ::testing::internal::MakeAndRegisterTestInfo(\
8160         #test_case_name, #test_name, NULL, NULL, \
8161         (parent_id), \
8162         parent_class::SetUpTestCase, \
8163         parent_class::TearDownTestCase, \
8164         new ::testing::internal::TestFactoryImpl<\
8165             GTEST_TEST_CLASS_NAME_(test_case_name, test_name)>);\
8166 void GTEST_TEST_CLASS_NAME_(test_case_name, test_name)::TestBody()
8167
8168 #endif  // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_INTERNAL_H_
8169 // Copyright 2005, Google Inc.
8170 // All rights reserved.
8171 //
8172 // Redistribution and use in source and binary forms, with or without
8173 // modification, are permitted provided that the following conditions are
8174 // met:
8175 //
8176 //     * Redistributions of source code must retain the above copyright
8177 // notice, this list of conditions and the following disclaimer.
8178 //     * Redistributions in binary form must reproduce the above
8179 // copyright notice, this list of conditions and the following disclaimer
8180 // in the documentation and/or other materials provided with the
8181 // distribution.
8182 //     * Neither the name of Google Inc. nor the names of its
8183 // contributors may be used to endorse or promote products derived from
8184 // this software without specific prior written permission.
8185 //
8186 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
8187 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
8188 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
8189 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
8190 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
8191 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
8192 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
8193 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
8194 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
8195 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
8196 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
8197 //
8198 // Author: wan@google.com (Zhanyong Wan)
8199 //
8200 // The Google C++ Testing Framework (Google Test)
8201 //
8202 // This header file defines the public API for death tests.  It is
8203 // #included by gtest.h so a user doesn't need to include this
8204 // directly.
8205
8206 #ifndef GTEST_INCLUDE_GTEST_GTEST_DEATH_TEST_H_
8207 #define GTEST_INCLUDE_GTEST_GTEST_DEATH_TEST_H_
8208
8209 // Copyright 2005, Google Inc.
8210 // All rights reserved.
8211 //
8212 // Redistribution and use in source and binary forms, with or without
8213 // modification, are permitted provided that the following conditions are
8214 // met:
8215 //
8216 //     * Redistributions of source code must retain the above copyright
8217 // notice, this list of conditions and the following disclaimer.
8218 //     * Redistributions in binary form must reproduce the above
8219 // copyright notice, this list of conditions and the following disclaimer
8220 // in the documentation and/or other materials provided with the
8221 // distribution.
8222 //     * Neither the name of Google Inc. nor the names of its
8223 // contributors may be used to endorse or promote products derived from
8224 // this software without specific prior written permission.
8225 //
8226 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
8227 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
8228 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
8229 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
8230 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
8231 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
8232 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
8233 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
8234 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
8235 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
8236 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
8237 //
8238 // Authors: wan@google.com (Zhanyong Wan), eefacm@gmail.com (Sean Mcafee)
8239 //
8240 // The Google C++ Testing Framework (Google Test)
8241 //
8242 // This header file defines internal utilities needed for implementing
8243 // death tests.  They are subject to change without notice.
8244
8245 #ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_DEATH_TEST_INTERNAL_H_
8246 #define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_DEATH_TEST_INTERNAL_H_
8247
8248
8249 #include <stdio.h>
8250
8251 namespace testing {
8252 namespace internal {
8253
8254 GTEST_DECLARE_string_(internal_run_death_test);
8255
8256 // Names of the flags (needed for parsing Google Test flags).
8257 const char kDeathTestStyleFlag[] = "death_test_style";
8258 const char kDeathTestUseFork[] = "death_test_use_fork";
8259 const char kInternalRunDeathTestFlag[] = "internal_run_death_test";
8260
8261 #if GTEST_HAS_DEATH_TEST
8262
8263 // DeathTest is a class that hides much of the complexity of the
8264 // GTEST_DEATH_TEST_ macro.  It is abstract; its static Create method
8265 // returns a concrete class that depends on the prevailing death test
8266 // style, as defined by the --gtest_death_test_style and/or
8267 // --gtest_internal_run_death_test flags.
8268
8269 // In describing the results of death tests, these terms are used with
8270 // the corresponding definitions:
8271 //
8272 // exit status:  The integer exit information in the format specified
8273 //               by wait(2)
8274 // exit code:    The integer code passed to exit(3), _exit(2), or
8275 //               returned from main()
8276 class GTEST_API_ DeathTest {
8277  public:
8278   // Create returns false if there was an error determining the
8279   // appropriate action to take for the current death test; for example,
8280   // if the gtest_death_test_style flag is set to an invalid value.
8281   // The LastMessage method will return a more detailed message in that
8282   // case.  Otherwise, the DeathTest pointer pointed to by the "test"
8283   // argument is set.  If the death test should be skipped, the pointer
8284   // is set to NULL; otherwise, it is set to the address of a new concrete
8285   // DeathTest object that controls the execution of the current test.
8286   static bool Create(const char* statement, const RE* regex,
8287                      const char* file, int line, DeathTest** test);
8288   DeathTest();
8289   virtual ~DeathTest() { }
8290
8291   // A helper class that aborts a death test when it's deleted.
8292   class ReturnSentinel {
8293    public:
8294     explicit ReturnSentinel(DeathTest* test) : test_(test) { }
8295     ~ReturnSentinel() { test_->Abort(TEST_ENCOUNTERED_RETURN_STATEMENT); }
8296    private:
8297     DeathTest* const test_;
8298     GTEST_DISALLOW_COPY_AND_ASSIGN_(ReturnSentinel);
8299   } GTEST_ATTRIBUTE_UNUSED_;
8300
8301   // An enumeration of possible roles that may be taken when a death
8302   // test is encountered.  EXECUTE means that the death test logic should
8303   // be executed immediately.  OVERSEE means that the program should prepare
8304   // the appropriate environment for a child process to execute the death
8305   // test, then wait for it to complete.
8306   enum TestRole { OVERSEE_TEST, EXECUTE_TEST };
8307
8308   // An enumeration of the three reasons that a test might be aborted.
8309   enum AbortReason {
8310     TEST_ENCOUNTERED_RETURN_STATEMENT,
8311     TEST_THREW_EXCEPTION,
8312     TEST_DID_NOT_DIE
8313   };
8314
8315   // Assumes one of the above roles.
8316   virtual TestRole AssumeRole() = 0;
8317
8318   // Waits for the death test to finish and returns its status.
8319   virtual int Wait() = 0;
8320
8321   // Returns true if the death test passed; that is, the test process
8322   // exited during the test, its exit status matches a user-supplied
8323   // predicate, and its stderr output matches a user-supplied regular
8324   // expression.
8325   // The user-supplied predicate may be a macro expression rather
8326   // than a function pointer or functor, or else Wait and Passed could
8327   // be combined.
8328   virtual bool Passed(bool exit_status_ok) = 0;
8329
8330   // Signals that the death test did not die as expected.
8331   virtual void Abort(AbortReason reason) = 0;
8332
8333   // Returns a human-readable outcome message regarding the outcome of
8334   // the last death test.
8335   static const char* LastMessage();
8336
8337   static void set_last_death_test_message(const std::string& message);
8338
8339  private:
8340   // A string containing a description of the outcome of the last death test.
8341   static std::string last_death_test_message_;
8342
8343   GTEST_DISALLOW_COPY_AND_ASSIGN_(DeathTest);
8344 };
8345
8346 // Factory interface for death tests.  May be mocked out for testing.
8347 class DeathTestFactory {
8348  public:
8349   virtual ~DeathTestFactory() { }
8350   virtual bool Create(const char* statement, const RE* regex,
8351                       const char* file, int line, DeathTest** test) = 0;
8352 };
8353
8354 // A concrete DeathTestFactory implementation for normal use.
8355 class DefaultDeathTestFactory : public DeathTestFactory {
8356  public:
8357   virtual bool Create(const char* statement, const RE* regex,
8358                       const char* file, int line, DeathTest** test);
8359 };
8360
8361 // Returns true if exit_status describes a process that was terminated
8362 // by a signal, or exited normally with a nonzero exit code.
8363 GTEST_API_ bool ExitedUnsuccessfully(int exit_status);
8364
8365 // Traps C++ exceptions escaping statement and reports them as test
8366 // failures. Note that trapping SEH exceptions is not implemented here.
8367 # if GTEST_HAS_EXCEPTIONS
8368 #  define GTEST_EXECUTE_DEATH_TEST_STATEMENT_(statement, death_test) \
8369   try { \
8370     GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement); \
8371   } catch (const ::std::exception& gtest_exception) { \
8372     fprintf(\
8373         stderr, \
8374         "\n%s: Caught std::exception-derived exception escaping the " \
8375         "death test statement. Exception message: %s\n", \
8376         ::testing::internal::FormatFileLocation(__FILE__, __LINE__).c_str(), \
8377         gtest_exception.what()); \
8378     fflush(stderr); \
8379     death_test->Abort(::testing::internal::DeathTest::TEST_THREW_EXCEPTION); \
8380   } catch (...) { \
8381     death_test->Abort(::testing::internal::DeathTest::TEST_THREW_EXCEPTION); \
8382   }
8383
8384 # else
8385 #  define GTEST_EXECUTE_DEATH_TEST_STATEMENT_(statement, death_test) \
8386   GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement)
8387
8388 # endif
8389
8390 // This macro is for implementing ASSERT_DEATH*, EXPECT_DEATH*,
8391 // ASSERT_EXIT*, and EXPECT_EXIT*.
8392 # define GTEST_DEATH_TEST_(statement, predicate, regex, fail) \
8393   GTEST_AMBIGUOUS_ELSE_BLOCKER_ \
8394   if (::testing::internal::AlwaysTrue()) { \
8395     const ::testing::internal::RE& gtest_regex = (regex); \
8396     ::testing::internal::DeathTest* gtest_dt; \
8397     if (!::testing::internal::DeathTest::Create(#statement, &gtest_regex, \
8398         __FILE__, __LINE__, &gtest_dt)) { \
8399       goto GTEST_CONCAT_TOKEN_(gtest_label_, __LINE__); \
8400     } \
8401     if (gtest_dt != NULL) { \
8402       ::testing::internal::scoped_ptr< ::testing::internal::DeathTest> \
8403           gtest_dt_ptr(gtest_dt); \
8404       switch (gtest_dt->AssumeRole()) { \
8405         case ::testing::internal::DeathTest::OVERSEE_TEST: \
8406           if (!gtest_dt->Passed(predicate(gtest_dt->Wait()))) { \
8407             goto GTEST_CONCAT_TOKEN_(gtest_label_, __LINE__); \
8408           } \
8409           break; \
8410         case ::testing::internal::DeathTest::EXECUTE_TEST: { \
8411           ::testing::internal::DeathTest::ReturnSentinel \
8412               gtest_sentinel(gtest_dt); \
8413           GTEST_EXECUTE_DEATH_TEST_STATEMENT_(statement, gtest_dt); \
8414           gtest_dt->Abort(::testing::internal::DeathTest::TEST_DID_NOT_DIE); \
8415           break; \
8416         } \
8417         default: \
8418           break; \
8419       } \
8420     } \
8421   } else \
8422     GTEST_CONCAT_TOKEN_(gtest_label_, __LINE__): \
8423       fail(::testing::internal::DeathTest::LastMessage())
8424 // The symbol "fail" here expands to something into which a message
8425 // can be streamed.
8426
8427 // This macro is for implementing ASSERT/EXPECT_DEBUG_DEATH when compiled in
8428 // NDEBUG mode. In this case we need the statements to be executed, the regex is
8429 // ignored, and the macro must accept a streamed message even though the message
8430 // is never printed.
8431 # define GTEST_EXECUTE_STATEMENT_(statement, regex) \
8432   GTEST_AMBIGUOUS_ELSE_BLOCKER_ \
8433   if (::testing::internal::AlwaysTrue()) { \
8434      GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement); \
8435   } else \
8436     ::testing::Message()
8437
8438 // A class representing the parsed contents of the
8439 // --gtest_internal_run_death_test flag, as it existed when
8440 // RUN_ALL_TESTS was called.
8441 class InternalRunDeathTestFlag {
8442  public:
8443   InternalRunDeathTestFlag(const std::string& a_file,
8444                            int a_line,
8445                            int an_index,
8446                            int a_write_fd)
8447       : file_(a_file), line_(a_line), index_(an_index),
8448         write_fd_(a_write_fd) {}
8449
8450   ~InternalRunDeathTestFlag() {
8451     if (write_fd_ >= 0)
8452       posix::Close(write_fd_);
8453   }
8454
8455   const std::string& file() const { return file_; }
8456   int line() const { return line_; }
8457   int index() const { return index_; }
8458   int write_fd() const { return write_fd_; }
8459
8460  private:
8461   std::string file_;
8462   int line_;
8463   int index_;
8464   int write_fd_;
8465
8466   GTEST_DISALLOW_COPY_AND_ASSIGN_(InternalRunDeathTestFlag);
8467 };
8468
8469 // Returns a newly created InternalRunDeathTestFlag object with fields
8470 // initialized from the GTEST_FLAG(internal_run_death_test) flag if
8471 // the flag is specified; otherwise returns NULL.
8472 InternalRunDeathTestFlag* ParseInternalRunDeathTestFlag();
8473
8474 #else  // GTEST_HAS_DEATH_TEST
8475
8476 // This macro is used for implementing macros such as
8477 // EXPECT_DEATH_IF_SUPPORTED and ASSERT_DEATH_IF_SUPPORTED on systems where
8478 // death tests are not supported. Those macros must compile on such systems
8479 // iff EXPECT_DEATH and ASSERT_DEATH compile with the same parameters on
8480 // systems that support death tests. This allows one to write such a macro
8481 // on a system that does not support death tests and be sure that it will
8482 // compile on a death-test supporting system.
8483 //
8484 // Parameters:
8485 //   statement -  A statement that a macro such as EXPECT_DEATH would test
8486 //                for program termination. This macro has to make sure this
8487 //                statement is compiled but not executed, to ensure that
8488 //                EXPECT_DEATH_IF_SUPPORTED compiles with a certain
8489 //                parameter iff EXPECT_DEATH compiles with it.
8490 //   regex     -  A regex that a macro such as EXPECT_DEATH would use to test
8491 //                the output of statement.  This parameter has to be
8492 //                compiled but not evaluated by this macro, to ensure that
8493 //                this macro only accepts expressions that a macro such as
8494 //                EXPECT_DEATH would accept.
8495 //   terminator - Must be an empty statement for EXPECT_DEATH_IF_SUPPORTED
8496 //                and a return statement for ASSERT_DEATH_IF_SUPPORTED.
8497 //                This ensures that ASSERT_DEATH_IF_SUPPORTED will not
8498 //                compile inside functions where ASSERT_DEATH doesn't
8499 //                compile.
8500 //
8501 //  The branch that has an always false condition is used to ensure that
8502 //  statement and regex are compiled (and thus syntactically correct) but
8503 //  never executed. The unreachable code macro protects the terminator
8504 //  statement from generating an 'unreachable code' warning in case
8505 //  statement unconditionally returns or throws. The Message constructor at
8506 //  the end allows the syntax of streaming additional messages into the
8507 //  macro, for compilational compatibility with EXPECT_DEATH/ASSERT_DEATH.
8508 # define GTEST_UNSUPPORTED_DEATH_TEST_(statement, regex, terminator) \
8509     GTEST_AMBIGUOUS_ELSE_BLOCKER_ \
8510     if (::testing::internal::AlwaysTrue()) { \
8511       GTEST_LOG_(WARNING) \
8512           << "Death tests are not supported on this platform.\n" \
8513           << "Statement '" #statement "' cannot be verified."; \
8514     } else if (::testing::internal::AlwaysFalse()) { \
8515       ::testing::internal::RE::PartialMatch(".*", (regex)); \
8516       GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement); \
8517       terminator; \
8518     } else \
8519       ::testing::Message()
8520
8521 #endif  // GTEST_HAS_DEATH_TEST
8522
8523 }  // namespace internal
8524 }  // namespace testing
8525
8526 #endif  // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_DEATH_TEST_INTERNAL_H_
8527
8528 namespace testing {
8529
8530 // This flag controls the style of death tests.  Valid values are "threadsafe",
8531 // meaning that the death test child process will re-execute the test binary
8532 // from the start, running only a single death test, or "fast",
8533 // meaning that the child process will execute the test logic immediately
8534 // after forking.
8535 GTEST_DECLARE_string_(death_test_style);
8536
8537 #if GTEST_HAS_DEATH_TEST
8538
8539 namespace internal {
8540
8541 // Returns a Boolean value indicating whether the caller is currently
8542 // executing in the context of the death test child process.  Tools such as
8543 // Valgrind heap checkers may need this to modify their behavior in death
8544 // tests.  IMPORTANT: This is an internal utility.  Using it may break the
8545 // implementation of death tests.  User code MUST NOT use it.
8546 GTEST_API_ bool InDeathTestChild();
8547
8548 }  // namespace internal
8549
8550 // The following macros are useful for writing death tests.
8551
8552 // Here's what happens when an ASSERT_DEATH* or EXPECT_DEATH* is
8553 // executed:
8554 //
8555 //   1. It generates a warning if there is more than one active
8556 //   thread.  This is because it's safe to fork() or clone() only
8557 //   when there is a single thread.
8558 //
8559 //   2. The parent process clone()s a sub-process and runs the death
8560 //   test in it; the sub-process exits with code 0 at the end of the
8561 //   death test, if it hasn't exited already.
8562 //
8563 //   3. The parent process waits for the sub-process to terminate.
8564 //
8565 //   4. The parent process checks the exit code and error message of
8566 //   the sub-process.
8567 //
8568 // Examples:
8569 //
8570 //   ASSERT_DEATH(server.SendMessage(56, "Hello"), "Invalid port number");
8571 //   for (int i = 0; i < 5; i++) {
8572 //     EXPECT_DEATH(server.ProcessRequest(i),
8573 //                  "Invalid request .* in ProcessRequest()")
8574 //                  << "Failed to die on request " << i;
8575 //   }
8576 //
8577 //   ASSERT_EXIT(server.ExitNow(), ::testing::ExitedWithCode(0), "Exiting");
8578 //
8579 //   bool KilledBySIGHUP(int exit_code) {
8580 //     return WIFSIGNALED(exit_code) && WTERMSIG(exit_code) == SIGHUP;
8581 //   }
8582 //
8583 //   ASSERT_EXIT(client.HangUpServer(), KilledBySIGHUP, "Hanging up!");
8584 //
8585 // On the regular expressions used in death tests:
8586 //
8587 //   On POSIX-compliant systems (*nix), we use the <regex.h> library,
8588 //   which uses the POSIX extended regex syntax.
8589 //
8590 //   On other platforms (e.g. Windows), we only support a simple regex
8591 //   syntax implemented as part of Google Test.  This limited
8592 //   implementation should be enough most of the time when writing
8593 //   death tests; though it lacks many features you can find in PCRE
8594 //   or POSIX extended regex syntax.  For example, we don't support
8595 //   union ("x|y"), grouping ("(xy)"), brackets ("[xy]"), and
8596 //   repetition count ("x{5,7}"), among others.
8597 //
8598 //   Below is the syntax that we do support.  We chose it to be a
8599 //   subset of both PCRE and POSIX extended regex, so it's easy to
8600 //   learn wherever you come from.  In the following: 'A' denotes a
8601 //   literal character, period (.), or a single \\ escape sequence;
8602 //   'x' and 'y' denote regular expressions; 'm' and 'n' are for
8603 //   natural numbers.
8604 //
8605 //     c     matches any literal character c
8606 //     \\d   matches any decimal digit
8607 //     \\D   matches any character that's not a decimal digit
8608 //     \\f   matches \f
8609 //     \\n   matches \n
8610 //     \\r   matches \r
8611 //     \\s   matches any ASCII whitespace, including \n
8612 //     \\S   matches any character that's not a whitespace
8613 //     \\t   matches \t
8614 //     \\v   matches \v
8615 //     \\w   matches any letter, _, or decimal digit
8616 //     \\W   matches any character that \\w doesn't match
8617 //     \\c   matches any literal character c, which must be a punctuation
8618 //     .     matches any single character except \n
8619 //     A?    matches 0 or 1 occurrences of A
8620 //     A*    matches 0 or many occurrences of A
8621 //     A+    matches 1 or many occurrences of A
8622 //     ^     matches the beginning of a string (not that of each line)
8623 //     $     matches the end of a string (not that of each line)
8624 //     xy    matches x followed by y
8625 //
8626 //   If you accidentally use PCRE or POSIX extended regex features
8627 //   not implemented by us, you will get a run-time failure.  In that
8628 //   case, please try to rewrite your regular expression within the
8629 //   above syntax.
8630 //
8631 //   This implementation is *not* meant to be as highly tuned or robust
8632 //   as a compiled regex library, but should perform well enough for a
8633 //   death test, which already incurs significant overhead by launching
8634 //   a child process.
8635 //
8636 // Known caveats:
8637 //
8638 //   A "threadsafe" style death test obtains the path to the test
8639 //   program from argv[0] and re-executes it in the sub-process.  For
8640 //   simplicity, the current implementation doesn't search the PATH
8641 //   when launching the sub-process.  This means that the user must
8642 //   invoke the test program via a path that contains at least one
8643 //   path separator (e.g. path/to/foo_test and
8644 //   /absolute/path/to/bar_test are fine, but foo_test is not).  This
8645 //   is rarely a problem as people usually don't put the test binary
8646 //   directory in PATH.
8647 //
8648 // TODO(wan@google.com): make thread-safe death tests search the PATH.
8649
8650 // Asserts that a given statement causes the program to exit, with an
8651 // integer exit status that satisfies predicate, and emitting error output
8652 // that matches regex.
8653 # define ASSERT_EXIT(statement, predicate, regex) \
8654     GTEST_DEATH_TEST_(statement, predicate, regex, GTEST_FATAL_FAILURE_)
8655
8656 // Like ASSERT_EXIT, but continues on to successive tests in the
8657 // test case, if any:
8658 # define EXPECT_EXIT(statement, predicate, regex) \
8659     GTEST_DEATH_TEST_(statement, predicate, regex, GTEST_NONFATAL_FAILURE_)
8660
8661 // Asserts that a given statement causes the program to exit, either by
8662 // explicitly exiting with a nonzero exit code or being killed by a
8663 // signal, and emitting error output that matches regex.
8664 # define ASSERT_DEATH(statement, regex) \
8665     ASSERT_EXIT(statement, ::testing::internal::ExitedUnsuccessfully, regex)
8666
8667 // Like ASSERT_DEATH, but continues on to successive tests in the
8668 // test case, if any:
8669 # define EXPECT_DEATH(statement, regex) \
8670     EXPECT_EXIT(statement, ::testing::internal::ExitedUnsuccessfully, regex)
8671
8672 // Two predicate classes that can be used in {ASSERT,EXPECT}_EXIT*:
8673
8674 // Tests that an exit code describes a normal exit with a given exit code.
8675 class GTEST_API_ ExitedWithCode {
8676  public:
8677   explicit ExitedWithCode(int exit_code);
8678   bool operator()(int exit_status) const;
8679  private:
8680   // No implementation - assignment is unsupported.
8681   void operator=(const ExitedWithCode& other);
8682
8683   const int exit_code_;
8684 };
8685
8686 # if !GTEST_OS_WINDOWS
8687 // Tests that an exit code describes an exit due to termination by a
8688 // given signal.
8689 class GTEST_API_ KilledBySignal {
8690  public:
8691   explicit KilledBySignal(int signum);
8692   bool operator()(int exit_status) const;
8693  private:
8694   const int signum_;
8695 };
8696 # endif  // !GTEST_OS_WINDOWS
8697
8698 // EXPECT_DEBUG_DEATH asserts that the given statements die in debug mode.
8699 // The death testing framework causes this to have interesting semantics,
8700 // since the sideeffects of the call are only visible in opt mode, and not
8701 // in debug mode.
8702 //
8703 // In practice, this can be used to test functions that utilize the
8704 // LOG(DFATAL) macro using the following style:
8705 //
8706 // int DieInDebugOr12(int* sideeffect) {
8707 //   if (sideeffect) {
8708 //     *sideeffect = 12;
8709 //   }
8710 //   LOG(DFATAL) << "death";
8711 //   return 12;
8712 // }
8713 //
8714 // TEST(TestCase, TestDieOr12WorksInDgbAndOpt) {
8715 //   int sideeffect = 0;
8716 //   // Only asserts in dbg.
8717 //   EXPECT_DEBUG_DEATH(DieInDebugOr12(&sideeffect), "death");
8718 //
8719 // #ifdef NDEBUG
8720 //   // opt-mode has sideeffect visible.
8721 //   EXPECT_EQ(12, sideeffect);
8722 // #else
8723 //   // dbg-mode no visible sideeffect.
8724 //   EXPECT_EQ(0, sideeffect);
8725 // #endif
8726 // }
8727 //
8728 // This will assert that DieInDebugReturn12InOpt() crashes in debug
8729 // mode, usually due to a DCHECK or LOG(DFATAL), but returns the
8730 // appropriate fallback value (12 in this case) in opt mode. If you
8731 // need to test that a function has appropriate side-effects in opt
8732 // mode, include assertions against the side-effects.  A general
8733 // pattern for this is:
8734 //
8735 // EXPECT_DEBUG_DEATH({
8736 //   // Side-effects here will have an effect after this statement in
8737 //   // opt mode, but none in debug mode.
8738 //   EXPECT_EQ(12, DieInDebugOr12(&sideeffect));
8739 // }, "death");
8740 //
8741 # ifdef NDEBUG
8742
8743 #  define EXPECT_DEBUG_DEATH(statement, regex) \
8744   GTEST_EXECUTE_STATEMENT_(statement, regex)
8745
8746 #  define ASSERT_DEBUG_DEATH(statement, regex) \
8747   GTEST_EXECUTE_STATEMENT_(statement, regex)
8748
8749 # else
8750
8751 #  define EXPECT_DEBUG_DEATH(statement, regex) \
8752   EXPECT_DEATH(statement, regex)
8753
8754 #  define ASSERT_DEBUG_DEATH(statement, regex) \
8755   ASSERT_DEATH(statement, regex)
8756
8757 # endif  // NDEBUG for EXPECT_DEBUG_DEATH
8758 #endif  // GTEST_HAS_DEATH_TEST
8759
8760 // EXPECT_DEATH_IF_SUPPORTED(statement, regex) and
8761 // ASSERT_DEATH_IF_SUPPORTED(statement, regex) expand to real death tests if
8762 // death tests are supported; otherwise they just issue a warning.  This is
8763 // useful when you are combining death test assertions with normal test
8764 // assertions in one test.
8765 #if GTEST_HAS_DEATH_TEST
8766 # define EXPECT_DEATH_IF_SUPPORTED(statement, regex) \
8767     EXPECT_DEATH(statement, regex)
8768 # define ASSERT_DEATH_IF_SUPPORTED(statement, regex) \
8769     ASSERT_DEATH(statement, regex)
8770 #else
8771 # define EXPECT_DEATH_IF_SUPPORTED(statement, regex) \
8772     GTEST_UNSUPPORTED_DEATH_TEST_(statement, regex, )
8773 # define ASSERT_DEATH_IF_SUPPORTED(statement, regex) \
8774     GTEST_UNSUPPORTED_DEATH_TEST_(statement, regex, return)
8775 #endif
8776
8777 }  // namespace testing
8778
8779 #endif  // GTEST_INCLUDE_GTEST_GTEST_DEATH_TEST_H_
8780 // This file was GENERATED by command:
8781 //     pump.py gtest-param-test.h.pump
8782 // DO NOT EDIT BY HAND!!!
8783
8784 // Copyright 2008, Google Inc.
8785 // All rights reserved.
8786 //
8787 // Redistribution and use in source and binary forms, with or without
8788 // modification, are permitted provided that the following conditions are
8789 // met:
8790 //
8791 //     * Redistributions of source code must retain the above copyright
8792 // notice, this list of conditions and the following disclaimer.
8793 //     * Redistributions in binary form must reproduce the above
8794 // copyright notice, this list of conditions and the following disclaimer
8795 // in the documentation and/or other materials provided with the
8796 // distribution.
8797 //     * Neither the name of Google Inc. nor the names of its
8798 // contributors may be used to endorse or promote products derived from
8799 // this software without specific prior written permission.
8800 //
8801 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
8802 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
8803 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
8804 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
8805 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
8806 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
8807 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
8808 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
8809 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
8810 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
8811 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
8812 //
8813 // Authors: vladl@google.com (Vlad Losev)
8814 //
8815 // Macros and functions for implementing parameterized tests
8816 // in Google C++ Testing Framework (Google Test)
8817 //
8818 // This file is generated by a SCRIPT.  DO NOT EDIT BY HAND!
8819 //
8820 #ifndef GTEST_INCLUDE_GTEST_GTEST_PARAM_TEST_H_
8821 #define GTEST_INCLUDE_GTEST_GTEST_PARAM_TEST_H_
8822
8823
8824 // Value-parameterized tests allow you to test your code with different
8825 // parameters without writing multiple copies of the same test.
8826 //
8827 // Here is how you use value-parameterized tests:
8828
8829 #if 0
8830
8831 // To write value-parameterized tests, first you should define a fixture
8832 // class. It is usually derived from testing::TestWithParam<T> (see below for
8833 // another inheritance scheme that's sometimes useful in more complicated
8834 // class hierarchies), where the type of your parameter values.
8835 // TestWithParam<T> is itself derived from testing::Test. T can be any
8836 // copyable type. If it's a raw pointer, you are responsible for managing the
8837 // lifespan of the pointed values.
8838
8839 class FooTest : public ::testing::TestWithParam<const char*> {
8840   // You can implement all the usual class fixture members here.
8841 };
8842
8843 // Then, use the TEST_P macro to define as many parameterized tests
8844 // for this fixture as you want. The _P suffix is for "parameterized"
8845 // or "pattern", whichever you prefer to think.
8846
8847 TEST_P(FooTest, DoesBlah) {
8848   // Inside a test, access the test parameter with the GetParam() method
8849   // of the TestWithParam<T> class:
8850   EXPECT_TRUE(foo.Blah(GetParam()));
8851   ...
8852 }
8853
8854 TEST_P(FooTest, HasBlahBlah) {
8855   ...
8856 }
8857
8858 // Finally, you can use INSTANTIATE_TEST_CASE_P to instantiate the test
8859 // case with any set of parameters you want. Google Test defines a number
8860 // of functions for generating test parameters. They return what we call
8861 // (surprise!) parameter generators. Here is a  summary of them, which
8862 // are all in the testing namespace:
8863 //
8864 //
8865 //  Range(begin, end [, step]) - Yields values {begin, begin+step,
8866 //                               begin+step+step, ...}. The values do not
8867 //                               include end. step defaults to 1.
8868 //  Values(v1, v2, ..., vN)    - Yields values {v1, v2, ..., vN}.
8869 //  ValuesIn(container)        - Yields values from a C-style array, an STL
8870 //  ValuesIn(begin,end)          container, or an iterator range [begin, end).
8871 //  Bool()                     - Yields sequence {false, true}.
8872 //  Combine(g1, g2, ..., gN)   - Yields all combinations (the Cartesian product
8873 //                               for the math savvy) of the values generated
8874 //                               by the N generators.
8875 //
8876 // For more details, see comments at the definitions of these functions below
8877 // in this file.
8878 //
8879 // The following statement will instantiate tests from the FooTest test case
8880 // each with parameter values "meeny", "miny", and "moe".
8881
8882 INSTANTIATE_TEST_CASE_P(InstantiationName,
8883                         FooTest,
8884                         Values("meeny", "miny", "moe"));
8885
8886 // To distinguish different instances of the pattern, (yes, you
8887 // can instantiate it more then once) the first argument to the
8888 // INSTANTIATE_TEST_CASE_P macro is a prefix that will be added to the
8889 // actual test case name. Remember to pick unique prefixes for different
8890 // instantiations. The tests from the instantiation above will have
8891 // these names:
8892 //
8893 //    * InstantiationName/FooTest.DoesBlah/0 for "meeny"
8894 //    * InstantiationName/FooTest.DoesBlah/1 for "miny"
8895 //    * InstantiationName/FooTest.DoesBlah/2 for "moe"
8896 //    * InstantiationName/FooTest.HasBlahBlah/0 for "meeny"
8897 //    * InstantiationName/FooTest.HasBlahBlah/1 for "miny"
8898 //    * InstantiationName/FooTest.HasBlahBlah/2 for "moe"
8899 //
8900 // You can use these names in --gtest_filter.
8901 //
8902 // This statement will instantiate all tests from FooTest again, each
8903 // with parameter values "cat" and "dog":
8904
8905 const char* pets[] = {"cat", "dog"};
8906 INSTANTIATE_TEST_CASE_P(AnotherInstantiationName, FooTest, ValuesIn(pets));
8907
8908 // The tests from the instantiation above will have these names:
8909 //
8910 //    * AnotherInstantiationName/FooTest.DoesBlah/0 for "cat"
8911 //    * AnotherInstantiationName/FooTest.DoesBlah/1 for "dog"
8912 //    * AnotherInstantiationName/FooTest.HasBlahBlah/0 for "cat"
8913 //    * AnotherInstantiationName/FooTest.HasBlahBlah/1 for "dog"
8914 //
8915 // Please note that INSTANTIATE_TEST_CASE_P will instantiate all tests
8916 // in the given test case, whether their definitions come before or
8917 // AFTER the INSTANTIATE_TEST_CASE_P statement.
8918 //
8919 // Please also note that generator expressions (including parameters to the
8920 // generators) are evaluated in InitGoogleTest(), after main() has started.
8921 // This allows the user on one hand, to adjust generator parameters in order
8922 // to dynamically determine a set of tests to run and on the other hand,
8923 // give the user a chance to inspect the generated tests with Google Test
8924 // reflection API before RUN_ALL_TESTS() is executed.
8925 //
8926 // You can see samples/sample7_unittest.cc and samples/sample8_unittest.cc
8927 // for more examples.
8928 //
8929 // In the future, we plan to publish the API for defining new parameter
8930 // generators. But for now this interface remains part of the internal
8931 // implementation and is subject to change.
8932 //
8933 //
8934 // A parameterized test fixture must be derived from testing::Test and from
8935 // testing::WithParamInterface<T>, where T is the type of the parameter
8936 // values. Inheriting from TestWithParam<T> satisfies that requirement because
8937 // TestWithParam<T> inherits from both Test and WithParamInterface. In more
8938 // complicated hierarchies, however, it is occasionally useful to inherit
8939 // separately from Test and WithParamInterface. For example:
8940
8941 class BaseTest : public ::testing::Test {
8942   // You can inherit all the usual members for a non-parameterized test
8943   // fixture here.
8944 };
8945
8946 class DerivedTest : public BaseTest, public ::testing::WithParamInterface<int> {
8947   // The usual test fixture members go here too.
8948 };
8949
8950 TEST_F(BaseTest, HasFoo) {
8951   // This is an ordinary non-parameterized test.
8952 }
8953
8954 TEST_P(DerivedTest, DoesBlah) {
8955   // GetParam works just the same here as if you inherit from TestWithParam.
8956   EXPECT_TRUE(foo.Blah(GetParam()));
8957 }
8958
8959 #endif  // 0
8960
8961
8962 #if !GTEST_OS_SYMBIAN
8963 # include <utility>
8964 #endif
8965
8966 // scripts/fuse_gtest.py depends on gtest's own header being #included
8967 // *unconditionally*.  Therefore these #includes cannot be moved
8968 // inside #if GTEST_HAS_PARAM_TEST.
8969 // Copyright 2008 Google Inc.
8970 // All Rights Reserved.
8971 //
8972 // Redistribution and use in source and binary forms, with or without
8973 // modification, are permitted provided that the following conditions are
8974 // met:
8975 //
8976 //     * Redistributions of source code must retain the above copyright
8977 // notice, this list of conditions and the following disclaimer.
8978 //     * Redistributions in binary form must reproduce the above
8979 // copyright notice, this list of conditions and the following disclaimer
8980 // in the documentation and/or other materials provided with the
8981 // distribution.
8982 //     * Neither the name of Google Inc. nor the names of its
8983 // contributors may be used to endorse or promote products derived from
8984 // this software without specific prior written permission.
8985 //
8986 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
8987 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
8988 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
8989 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
8990 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
8991 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
8992 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
8993 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
8994 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
8995 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
8996 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
8997 //
8998 // Author: vladl@google.com (Vlad Losev)
8999
9000 // Type and function utilities for implementing parameterized tests.
9001
9002 #ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PARAM_UTIL_H_
9003 #define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PARAM_UTIL_H_
9004
9005 #include <iterator>
9006 #include <utility>
9007 #include <vector>
9008
9009 // scripts/fuse_gtest.py depends on gtest's own header being #included
9010 // *unconditionally*.  Therefore these #includes cannot be moved
9011 // inside #if GTEST_HAS_PARAM_TEST.
9012 // Copyright 2003 Google Inc.
9013 // All rights reserved.
9014 //
9015 // Redistribution and use in source and binary forms, with or without
9016 // modification, are permitted provided that the following conditions are
9017 // met:
9018 //
9019 //     * Redistributions of source code must retain the above copyright
9020 // notice, this list of conditions and the following disclaimer.
9021 //     * Redistributions in binary form must reproduce the above
9022 // copyright notice, this list of conditions and the following disclaimer
9023 // in the documentation and/or other materials provided with the
9024 // distribution.
9025 //     * Neither the name of Google Inc. nor the names of its
9026 // contributors may be used to endorse or promote products derived from
9027 // this software without specific prior written permission.
9028 //
9029 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
9030 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
9031 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
9032 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
9033 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
9034 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
9035 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
9036 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
9037 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
9038 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
9039 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
9040 //
9041 // Authors: Dan Egnor (egnor@google.com)
9042 //
9043 // A "smart" pointer type with reference tracking.  Every pointer to a
9044 // particular object is kept on a circular linked list.  When the last pointer
9045 // to an object is destroyed or reassigned, the object is deleted.
9046 //
9047 // Used properly, this deletes the object when the last reference goes away.
9048 // There are several caveats:
9049 // - Like all reference counting schemes, cycles lead to leaks.
9050 // - Each smart pointer is actually two pointers (8 bytes instead of 4).
9051 // - Every time a pointer is assigned, the entire list of pointers to that
9052 //   object is traversed.  This class is therefore NOT SUITABLE when there
9053 //   will often be more than two or three pointers to a particular object.
9054 // - References are only tracked as long as linked_ptr<> objects are copied.
9055 //   If a linked_ptr<> is converted to a raw pointer and back, BAD THINGS
9056 //   will happen (double deletion).
9057 //
9058 // A good use of this class is storing object references in STL containers.
9059 // You can safely put linked_ptr<> in a vector<>.
9060 // Other uses may not be as good.
9061 //
9062 // Note: If you use an incomplete type with linked_ptr<>, the class
9063 // *containing* linked_ptr<> must have a constructor and destructor (even
9064 // if they do nothing!).
9065 //
9066 // Bill Gibbons suggested we use something like this.
9067 //
9068 // Thread Safety:
9069 //   Unlike other linked_ptr implementations, in this implementation
9070 //   a linked_ptr object is thread-safe in the sense that:
9071 //     - it's safe to copy linked_ptr objects concurrently,
9072 //     - it's safe to copy *from* a linked_ptr and read its underlying
9073 //       raw pointer (e.g. via get()) concurrently, and
9074 //     - it's safe to write to two linked_ptrs that point to the same
9075 //       shared object concurrently.
9076 // TODO(wan@google.com): rename this to safe_linked_ptr to avoid
9077 // confusion with normal linked_ptr.
9078
9079 #ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_LINKED_PTR_H_
9080 #define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_LINKED_PTR_H_
9081
9082 #include <stdlib.h>
9083 #include <assert.h>
9084
9085
9086 namespace testing {
9087 namespace internal {
9088
9089 // Protects copying of all linked_ptr objects.
9090 GTEST_API_ GTEST_DECLARE_STATIC_MUTEX_(g_linked_ptr_mutex);
9091
9092 // This is used internally by all instances of linked_ptr<>.  It needs to be
9093 // a non-template class because different types of linked_ptr<> can refer to
9094 // the same object (linked_ptr<Superclass>(obj) vs linked_ptr<Subclass>(obj)).
9095 // So, it needs to be possible for different types of linked_ptr to participate
9096 // in the same circular linked list, so we need a single class type here.
9097 //
9098 // DO NOT USE THIS CLASS DIRECTLY YOURSELF.  Use linked_ptr<T>.
9099 class linked_ptr_internal {
9100  public:
9101   // Create a new circle that includes only this instance.
9102   void join_new() {
9103     next_ = this;
9104   }
9105
9106   // Many linked_ptr operations may change p.link_ for some linked_ptr
9107   // variable p in the same circle as this object.  Therefore we need
9108   // to prevent two such operations from occurring concurrently.
9109   //
9110   // Note that different types of linked_ptr objects can coexist in a
9111   // circle (e.g. linked_ptr<Base>, linked_ptr<Derived1>, and
9112   // linked_ptr<Derived2>).  Therefore we must use a single mutex to
9113   // protect all linked_ptr objects.  This can create serious
9114   // contention in production code, but is acceptable in a testing
9115   // framework.
9116
9117   // Join an existing circle.
9118   void join(linked_ptr_internal const* ptr)
9119       GTEST_LOCK_EXCLUDED_(g_linked_ptr_mutex) {
9120     MutexLock lock(&g_linked_ptr_mutex);
9121
9122     linked_ptr_internal const* p = ptr;
9123     while (p->next_ != ptr) p = p->next_;
9124     p->next_ = this;
9125     next_ = ptr;
9126   }
9127
9128   // Leave whatever circle we're part of.  Returns true if we were the
9129   // last member of the circle.  Once this is done, you can join() another.
9130   bool depart()
9131       GTEST_LOCK_EXCLUDED_(g_linked_ptr_mutex) {
9132     MutexLock lock(&g_linked_ptr_mutex);
9133
9134     if (next_ == this) return true;
9135     linked_ptr_internal const* p = next_;
9136     while (p->next_ != this) p = p->next_;
9137     p->next_ = next_;
9138     return false;
9139   }
9140
9141  private:
9142   mutable linked_ptr_internal const* next_;
9143 };
9144
9145 template <typename T>
9146 class linked_ptr {
9147  public:
9148   typedef T element_type;
9149
9150   // Take over ownership of a raw pointer.  This should happen as soon as
9151   // possible after the object is created.
9152   explicit linked_ptr(T* ptr = NULL) { capture(ptr); }
9153   ~linked_ptr() { depart(); }
9154
9155   // Copy an existing linked_ptr<>, adding ourselves to the list of references.
9156   template <typename U> linked_ptr(linked_ptr<U> const& ptr) { copy(&ptr); }
9157   linked_ptr(linked_ptr const& ptr) {  // NOLINT
9158     assert(&ptr != this);
9159     copy(&ptr);
9160   }
9161
9162   // Assignment releases the old value and acquires the new.
9163   template <typename U> linked_ptr& operator=(linked_ptr<U> const& ptr) {
9164     depart();
9165     copy(&ptr);
9166     return *this;
9167   }
9168
9169   linked_ptr& operator=(linked_ptr const& ptr) {
9170     if (&ptr != this) {
9171       depart();
9172       copy(&ptr);
9173     }
9174     return *this;
9175   }
9176
9177   // Smart pointer members.
9178   void reset(T* ptr = NULL) {
9179     depart();
9180     capture(ptr);
9181   }
9182   T* get() const { return value_; }
9183   T* operator->() const { return value_; }
9184   T& operator*() const { return *value_; }
9185
9186   bool operator==(T* p) const { return value_ == p; }
9187   bool operator!=(T* p) const { return value_ != p; }
9188   template <typename U>
9189   bool operator==(linked_ptr<U> const& ptr) const {
9190     return value_ == ptr.get();
9191   }
9192   template <typename U>
9193   bool operator!=(linked_ptr<U> const& ptr) const {
9194     return value_ != ptr.get();
9195   }
9196
9197  private:
9198   template <typename U>
9199   friend class linked_ptr;
9200
9201   T* value_;
9202   linked_ptr_internal link_;
9203
9204   void depart() {
9205     if (link_.depart()) delete value_;
9206   }
9207
9208   void capture(T* ptr) {
9209     value_ = ptr;
9210     link_.join_new();
9211   }
9212
9213   template <typename U> void copy(linked_ptr<U> const* ptr) {
9214     value_ = ptr->get();
9215     if (value_)
9216       link_.join(&ptr->link_);
9217     else
9218       link_.join_new();
9219   }
9220 };
9221
9222 template<typename T> inline
9223 bool operator==(T* ptr, const linked_ptr<T>& x) {
9224   return ptr == x.get();
9225 }
9226
9227 template<typename T> inline
9228 bool operator!=(T* ptr, const linked_ptr<T>& x) {
9229   return ptr != x.get();
9230 }
9231
9232 // A function to convert T* into linked_ptr<T>
9233 // Doing e.g. make_linked_ptr(new FooBarBaz<type>(arg)) is a shorter notation
9234 // for linked_ptr<FooBarBaz<type> >(new FooBarBaz<type>(arg))
9235 template <typename T>
9236 linked_ptr<T> make_linked_ptr(T* ptr) {
9237   return linked_ptr<T>(ptr);
9238 }
9239
9240 }  // namespace internal
9241 }  // namespace testing
9242
9243 #endif  // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_LINKED_PTR_H_
9244 // Copyright 2007, Google Inc.
9245 // All rights reserved.
9246 //
9247 // Redistribution and use in source and binary forms, with or without
9248 // modification, are permitted provided that the following conditions are
9249 // met:
9250 //
9251 //     * Redistributions of source code must retain the above copyright
9252 // notice, this list of conditions and the following disclaimer.
9253 //     * Redistributions in binary form must reproduce the above
9254 // copyright notice, this list of conditions and the following disclaimer
9255 // in the documentation and/or other materials provided with the
9256 // distribution.
9257 //     * Neither the name of Google Inc. nor the names of its
9258 // contributors may be used to endorse or promote products derived from
9259 // this software without specific prior written permission.
9260 //
9261 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
9262 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
9263 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
9264 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
9265 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
9266 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
9267 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
9268 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
9269 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
9270 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
9271 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
9272 //
9273 // Author: wan@google.com (Zhanyong Wan)
9274
9275 // Google Test - The Google C++ Testing Framework
9276 //
9277 // This file implements a universal value printer that can print a
9278 // value of any type T:
9279 //
9280 //   void ::testing::internal::UniversalPrinter<T>::Print(value, ostream_ptr);
9281 //
9282 // A user can teach this function how to print a class type T by
9283 // defining either operator<<() or PrintTo() in the namespace that
9284 // defines T.  More specifically, the FIRST defined function in the
9285 // following list will be used (assuming T is defined in namespace
9286 // foo):
9287 //
9288 //   1. foo::PrintTo(const T&, ostream*)
9289 //   2. operator<<(ostream&, const T&) defined in either foo or the
9290 //      global namespace.
9291 //
9292 // If none of the above is defined, it will print the debug string of
9293 // the value if it is a protocol buffer, or print the raw bytes in the
9294 // value otherwise.
9295 //
9296 // To aid debugging: when T is a reference type, the address of the
9297 // value is also printed; when T is a (const) char pointer, both the
9298 // pointer value and the NUL-terminated string it points to are
9299 // printed.
9300 //
9301 // We also provide some convenient wrappers:
9302 //
9303 //   // Prints a value to a string.  For a (const or not) char
9304 //   // pointer, the NUL-terminated string (but not the pointer) is
9305 //   // printed.
9306 //   std::string ::testing::PrintToString(const T& value);
9307 //
9308 //   // Prints a value tersely: for a reference type, the referenced
9309 //   // value (but not the address) is printed; for a (const or not) char
9310 //   // pointer, the NUL-terminated string (but not the pointer) is
9311 //   // printed.
9312 //   void ::testing::internal::UniversalTersePrint(const T& value, ostream*);
9313 //
9314 //   // Prints value using the type inferred by the compiler.  The difference
9315 //   // from UniversalTersePrint() is that this function prints both the
9316 //   // pointer and the NUL-terminated string for a (const or not) char pointer.
9317 //   void ::testing::internal::UniversalPrint(const T& value, ostream*);
9318 //
9319 //   // Prints the fields of a tuple tersely to a string vector, one
9320 //   // element for each field. Tuple support must be enabled in
9321 //   // gtest-port.h.
9322 //   std::vector<string> UniversalTersePrintTupleFieldsToStrings(
9323 //       const Tuple& value);
9324 //
9325 // Known limitation:
9326 //
9327 // The print primitives print the elements of an STL-style container
9328 // using the compiler-inferred type of *iter where iter is a
9329 // const_iterator of the container.  When const_iterator is an input
9330 // iterator but not a forward iterator, this inferred type may not
9331 // match value_type, and the print output may be incorrect.  In
9332 // practice, this is rarely a problem as for most containers
9333 // const_iterator is a forward iterator.  We'll fix this if there's an
9334 // actual need for it.  Note that this fix cannot rely on value_type
9335 // being defined as many user-defined container types don't have
9336 // value_type.
9337
9338 #ifndef GTEST_INCLUDE_GTEST_GTEST_PRINTERS_H_
9339 #define GTEST_INCLUDE_GTEST_GTEST_PRINTERS_H_
9340
9341 #include <ostream>  // NOLINT
9342 #include <sstream>
9343 #include <string>
9344 #include <utility>
9345 #include <vector>
9346
9347 namespace testing {
9348
9349 // Definitions in the 'internal' and 'internal2' name spaces are
9350 // subject to change without notice.  DO NOT USE THEM IN USER CODE!
9351 namespace internal2 {
9352
9353 // Prints the given number of bytes in the given object to the given
9354 // ostream.
9355 GTEST_API_ void PrintBytesInObjectTo(const unsigned char* obj_bytes,
9356                                      size_t count,
9357                                      ::std::ostream* os);
9358
9359 // For selecting which printer to use when a given type has neither <<
9360 // nor PrintTo().
9361 enum TypeKind {
9362   kProtobuf,              // a protobuf type
9363   kConvertibleToInteger,  // a type implicitly convertible to BiggestInt
9364                           // (e.g. a named or unnamed enum type)
9365   kOtherType              // anything else
9366 };
9367
9368 // TypeWithoutFormatter<T, kTypeKind>::PrintValue(value, os) is called
9369 // by the universal printer to print a value of type T when neither
9370 // operator<< nor PrintTo() is defined for T, where kTypeKind is the
9371 // "kind" of T as defined by enum TypeKind.
9372 template <typename T, TypeKind kTypeKind>
9373 class TypeWithoutFormatter {
9374  public:
9375   // This default version is called when kTypeKind is kOtherType.
9376   static void PrintValue(const T& value, ::std::ostream* os) {
9377     PrintBytesInObjectTo(reinterpret_cast<const unsigned char*>(&value),
9378                          sizeof(value), os);
9379   }
9380 };
9381
9382 // We print a protobuf using its ShortDebugString() when the string
9383 // doesn't exceed this many characters; otherwise we print it using
9384 // DebugString() for better readability.
9385 const size_t kProtobufOneLinerMaxLength = 50;
9386
9387 template <typename T>
9388 class TypeWithoutFormatter<T, kProtobuf> {
9389  public:
9390   static void PrintValue(const T& value, ::std::ostream* os) {
9391     const ::testing::internal::string short_str = value.ShortDebugString();
9392     const ::testing::internal::string pretty_str =
9393         short_str.length() <= kProtobufOneLinerMaxLength ?
9394         short_str : ("\n" + value.DebugString());
9395     *os << ("<" + pretty_str + ">");
9396   }
9397 };
9398
9399 template <typename T>
9400 class TypeWithoutFormatter<T, kConvertibleToInteger> {
9401  public:
9402   // Since T has no << operator or PrintTo() but can be implicitly
9403   // converted to BiggestInt, we print it as a BiggestInt.
9404   //
9405   // Most likely T is an enum type (either named or unnamed), in which
9406   // case printing it as an integer is the desired behavior.  In case
9407   // T is not an enum, printing it as an integer is the best we can do
9408   // given that it has no user-defined printer.
9409   static void PrintValue(const T& value, ::std::ostream* os) {
9410     const internal::BiggestInt kBigInt = value;
9411     *os << kBigInt;
9412   }
9413 };
9414
9415 // Prints the given value to the given ostream.  If the value is a
9416 // protocol message, its debug string is printed; if it's an enum or
9417 // of a type implicitly convertible to BiggestInt, it's printed as an
9418 // integer; otherwise the bytes in the value are printed.  This is
9419 // what UniversalPrinter<T>::Print() does when it knows nothing about
9420 // type T and T has neither << operator nor PrintTo().
9421 //
9422 // A user can override this behavior for a class type Foo by defining
9423 // a << operator in the namespace where Foo is defined.
9424 //
9425 // We put this operator in namespace 'internal2' instead of 'internal'
9426 // to simplify the implementation, as much code in 'internal' needs to
9427 // use << in STL, which would conflict with our own << were it defined
9428 // in 'internal'.
9429 //
9430 // Note that this operator<< takes a generic std::basic_ostream<Char,
9431 // CharTraits> type instead of the more restricted std::ostream.  If
9432 // we define it to take an std::ostream instead, we'll get an
9433 // "ambiguous overloads" compiler error when trying to print a type
9434 // Foo that supports streaming to std::basic_ostream<Char,
9435 // CharTraits>, as the compiler cannot tell whether
9436 // operator<<(std::ostream&, const T&) or
9437 // operator<<(std::basic_stream<Char, CharTraits>, const Foo&) is more
9438 // specific.
9439 template <typename Char, typename CharTraits, typename T>
9440 ::std::basic_ostream<Char, CharTraits>& operator<<(
9441     ::std::basic_ostream<Char, CharTraits>& os, const T& x) {
9442   TypeWithoutFormatter<T,
9443       (internal::IsAProtocolMessage<T>::value ? kProtobuf :
9444        internal::ImplicitlyConvertible<const T&, internal::BiggestInt>::value ?
9445        kConvertibleToInteger : kOtherType)>::PrintValue(x, &os);
9446   return os;
9447 }
9448
9449 }  // namespace internal2
9450 }  // namespace testing
9451
9452 // This namespace MUST NOT BE NESTED IN ::testing, or the name look-up
9453 // magic needed for implementing UniversalPrinter won't work.
9454 namespace testing_internal {
9455
9456 // Used to print a value that is not an STL-style container when the
9457 // user doesn't define PrintTo() for it.
9458 template <typename T>
9459 void DefaultPrintNonContainerTo(const T& value, ::std::ostream* os) {
9460   // With the following statement, during unqualified name lookup,
9461   // testing::internal2::operator<< appears as if it was declared in
9462   // the nearest enclosing namespace that contains both
9463   // ::testing_internal and ::testing::internal2, i.e. the global
9464   // namespace.  For more details, refer to the C++ Standard section
9465   // 7.3.4-1 [namespace.udir].  This allows us to fall back onto
9466   // testing::internal2::operator<< in case T doesn't come with a <<
9467   // operator.
9468   //
9469   // We cannot write 'using ::testing::internal2::operator<<;', which
9470   // gcc 3.3 fails to compile due to a compiler bug.
9471   using namespace ::testing::internal2;  // NOLINT
9472
9473   // Assuming T is defined in namespace foo, in the next statement,
9474   // the compiler will consider all of:
9475   //
9476   //   1. foo::operator<< (thanks to Koenig look-up),
9477   //   2. ::operator<< (as the current namespace is enclosed in ::),
9478   //   3. testing::internal2::operator<< (thanks to the using statement above).
9479   //
9480   // The operator<< whose type matches T best will be picked.
9481   //
9482   // We deliberately allow #2 to be a candidate, as sometimes it's
9483   // impossible to define #1 (e.g. when foo is ::std, defining
9484   // anything in it is undefined behavior unless you are a compiler
9485   // vendor.).
9486   *os << value;
9487 }
9488
9489 }  // namespace testing_internal
9490
9491 namespace testing {
9492 namespace internal {
9493
9494 // UniversalPrinter<T>::Print(value, ostream_ptr) prints the given
9495 // value to the given ostream.  The caller must ensure that
9496 // 'ostream_ptr' is not NULL, or the behavior is undefined.
9497 //
9498 // We define UniversalPrinter as a class template (as opposed to a
9499 // function template), as we need to partially specialize it for
9500 // reference types, which cannot be done with function templates.
9501 template <typename T>
9502 class UniversalPrinter;
9503
9504 template <typename T>
9505 void UniversalPrint(const T& value, ::std::ostream* os);
9506
9507 // Used to print an STL-style container when the user doesn't define
9508 // a PrintTo() for it.
9509 template <typename C>
9510 void DefaultPrintTo(IsContainer /* dummy */,
9511                     false_type /* is not a pointer */,
9512                     const C& container, ::std::ostream* os) {
9513   const size_t kMaxCount = 32;  // The maximum number of elements to print.
9514   *os << '{';
9515   size_t count = 0;
9516   for (typename C::const_iterator it = container.begin();
9517        it != container.end(); ++it, ++count) {
9518     if (count > 0) {
9519       *os << ',';
9520       if (count == kMaxCount) {  // Enough has been printed.
9521         *os << " ...";
9522         break;
9523       }
9524     }
9525     *os << ' ';
9526     // We cannot call PrintTo(*it, os) here as PrintTo() doesn't
9527     // handle *it being a native array.
9528     internal::UniversalPrint(*it, os);
9529   }
9530
9531   if (count > 0) {
9532     *os << ' ';
9533   }
9534   *os << '}';
9535 }
9536
9537 // Used to print a pointer that is neither a char pointer nor a member
9538 // pointer, when the user doesn't define PrintTo() for it.  (A member
9539 // variable pointer or member function pointer doesn't really point to
9540 // a location in the address space.  Their representation is
9541 // implementation-defined.  Therefore they will be printed as raw
9542 // bytes.)
9543 template <typename T>
9544 void DefaultPrintTo(IsNotContainer /* dummy */,
9545                     true_type /* is a pointer */,
9546                     T* p, ::std::ostream* os) {
9547   if (p == NULL) {
9548     *os << "NULL";
9549   } else {
9550     // C++ doesn't allow casting from a function pointer to any object
9551     // pointer.
9552     //
9553     // IsTrue() silences warnings: "Condition is always true",
9554     // "unreachable code".
9555     if (IsTrue(ImplicitlyConvertible<T*, const void*>::value)) {
9556       // T is not a function type.  We just call << to print p,
9557       // relying on ADL to pick up user-defined << for their pointer
9558       // types, if any.
9559       *os << p;
9560     } else {
9561       // T is a function type, so '*os << p' doesn't do what we want
9562       // (it just prints p as bool).  We want to print p as a const
9563       // void*.  However, we cannot cast it to const void* directly,
9564       // even using reinterpret_cast, as earlier versions of gcc
9565       // (e.g. 3.4.5) cannot compile the cast when p is a function
9566       // pointer.  Casting to UInt64 first solves the problem.
9567       *os << reinterpret_cast<const void*>(
9568           reinterpret_cast<internal::UInt64>(p));
9569     }
9570   }
9571 }
9572
9573 // Used to print a non-container, non-pointer value when the user
9574 // doesn't define PrintTo() for it.
9575 template <typename T>
9576 void DefaultPrintTo(IsNotContainer /* dummy */,
9577                     false_type /* is not a pointer */,
9578                     const T& value, ::std::ostream* os) {
9579   ::testing_internal::DefaultPrintNonContainerTo(value, os);
9580 }
9581
9582 // Prints the given value using the << operator if it has one;
9583 // otherwise prints the bytes in it.  This is what
9584 // UniversalPrinter<T>::Print() does when PrintTo() is not specialized
9585 // or overloaded for type T.
9586 //
9587 // A user can override this behavior for a class type Foo by defining
9588 // an overload of PrintTo() in the namespace where Foo is defined.  We
9589 // give the user this option as sometimes defining a << operator for
9590 // Foo is not desirable (e.g. the coding style may prevent doing it,
9591 // or there is already a << operator but it doesn't do what the user
9592 // wants).
9593 template <typename T>
9594 void PrintTo(const T& value, ::std::ostream* os) {
9595   // DefaultPrintTo() is overloaded.  The type of its first two
9596   // arguments determine which version will be picked.  If T is an
9597   // STL-style container, the version for container will be called; if
9598   // T is a pointer, the pointer version will be called; otherwise the
9599   // generic version will be called.
9600   //
9601   // Note that we check for container types here, prior to we check
9602   // for protocol message types in our operator<<.  The rationale is:
9603   //
9604   // For protocol messages, we want to give people a chance to
9605   // override Google Mock's format by defining a PrintTo() or
9606   // operator<<.  For STL containers, other formats can be
9607   // incompatible with Google Mock's format for the container
9608   // elements; therefore we check for container types here to ensure
9609   // that our format is used.
9610   //
9611   // The second argument of DefaultPrintTo() is needed to bypass a bug
9612   // in Symbian's C++ compiler that prevents it from picking the right
9613   // overload between:
9614   //
9615   //   PrintTo(const T& x, ...);
9616   //   PrintTo(T* x, ...);
9617   DefaultPrintTo(IsContainerTest<T>(0), is_pointer<T>(), value, os);
9618 }
9619
9620 // The following list of PrintTo() overloads tells
9621 // UniversalPrinter<T>::Print() how to print standard types (built-in
9622 // types, strings, plain arrays, and pointers).
9623
9624 // Overloads for various char types.
9625 GTEST_API_ void PrintTo(unsigned char c, ::std::ostream* os);
9626 GTEST_API_ void PrintTo(signed char c, ::std::ostream* os);
9627 inline void PrintTo(char c, ::std::ostream* os) {
9628   // When printing a plain char, we always treat it as unsigned.  This
9629   // way, the output won't be affected by whether the compiler thinks
9630   // char is signed or not.
9631   PrintTo(static_cast<unsigned char>(c), os);
9632 }
9633
9634 // Overloads for other simple built-in types.
9635 inline void PrintTo(bool x, ::std::ostream* os) {
9636   *os << (x ? "true" : "false");
9637 }
9638
9639 // Overload for wchar_t type.
9640 // Prints a wchar_t as a symbol if it is printable or as its internal
9641 // code otherwise and also as its decimal code (except for L'\0').
9642 // The L'\0' char is printed as "L'\\0'". The decimal code is printed
9643 // as signed integer when wchar_t is implemented by the compiler
9644 // as a signed type and is printed as an unsigned integer when wchar_t
9645 // is implemented as an unsigned type.
9646 GTEST_API_ void PrintTo(wchar_t wc, ::std::ostream* os);
9647
9648 // Overloads for C strings.
9649 GTEST_API_ void PrintTo(const char* s, ::std::ostream* os);
9650 inline void PrintTo(char* s, ::std::ostream* os) {
9651   PrintTo(ImplicitCast_<const char*>(s), os);
9652 }
9653
9654 // signed/unsigned char is often used for representing binary data, so
9655 // we print pointers to it as void* to be safe.
9656 inline void PrintTo(const signed char* s, ::std::ostream* os) {
9657   PrintTo(ImplicitCast_<const void*>(s), os);
9658 }
9659 inline void PrintTo(signed char* s, ::std::ostream* os) {
9660   PrintTo(ImplicitCast_<const void*>(s), os);
9661 }
9662 inline void PrintTo(const unsigned char* s, ::std::ostream* os) {
9663   PrintTo(ImplicitCast_<const void*>(s), os);
9664 }
9665 inline void PrintTo(unsigned char* s, ::std::ostream* os) {
9666   PrintTo(ImplicitCast_<const void*>(s), os);
9667 }
9668
9669 // MSVC can be configured to define wchar_t as a typedef of unsigned
9670 // short.  It defines _NATIVE_WCHAR_T_DEFINED when wchar_t is a native
9671 // type.  When wchar_t is a typedef, defining an overload for const
9672 // wchar_t* would cause unsigned short* be printed as a wide string,
9673 // possibly causing invalid memory accesses.
9674 #if !defined(_MSC_VER) || defined(_NATIVE_WCHAR_T_DEFINED)
9675 // Overloads for wide C strings
9676 GTEST_API_ void PrintTo(const wchar_t* s, ::std::ostream* os);
9677 inline void PrintTo(wchar_t* s, ::std::ostream* os) {
9678   PrintTo(ImplicitCast_<const wchar_t*>(s), os);
9679 }
9680 #endif
9681
9682 // Overload for C arrays.  Multi-dimensional arrays are printed
9683 // properly.
9684
9685 // Prints the given number of elements in an array, without printing
9686 // the curly braces.
9687 template <typename T>
9688 void PrintRawArrayTo(const T a[], size_t count, ::std::ostream* os) {
9689   UniversalPrint(a[0], os);
9690   for (size_t i = 1; i != count; i++) {
9691     *os << ", ";
9692     UniversalPrint(a[i], os);
9693   }
9694 }
9695
9696 // Overloads for ::string and ::std::string.
9697 #if GTEST_HAS_GLOBAL_STRING
9698 GTEST_API_ void PrintStringTo(const ::string&s, ::std::ostream* os);
9699 inline void PrintTo(const ::string& s, ::std::ostream* os) {
9700   PrintStringTo(s, os);
9701 }
9702 #endif  // GTEST_HAS_GLOBAL_STRING
9703
9704 GTEST_API_ void PrintStringTo(const ::std::string&s, ::std::ostream* os);
9705 inline void PrintTo(const ::std::string& s, ::std::ostream* os) {
9706   PrintStringTo(s, os);
9707 }
9708
9709 // Overloads for ::wstring and ::std::wstring.
9710 #if GTEST_HAS_GLOBAL_WSTRING
9711 GTEST_API_ void PrintWideStringTo(const ::wstring&s, ::std::ostream* os);
9712 inline void PrintTo(const ::wstring& s, ::std::ostream* os) {
9713   PrintWideStringTo(s, os);
9714 }
9715 #endif  // GTEST_HAS_GLOBAL_WSTRING
9716
9717 #if GTEST_HAS_STD_WSTRING
9718 GTEST_API_ void PrintWideStringTo(const ::std::wstring&s, ::std::ostream* os);
9719 inline void PrintTo(const ::std::wstring& s, ::std::ostream* os) {
9720   PrintWideStringTo(s, os);
9721 }
9722 #endif  // GTEST_HAS_STD_WSTRING
9723
9724 #if GTEST_HAS_TR1_TUPLE
9725 // Overload for ::std::tr1::tuple.  Needed for printing function arguments,
9726 // which are packed as tuples.
9727
9728 // Helper function for printing a tuple.  T must be instantiated with
9729 // a tuple type.
9730 template <typename T>
9731 void PrintTupleTo(const T& t, ::std::ostream* os);
9732
9733 // Overloaded PrintTo() for tuples of various arities.  We support
9734 // tuples of up-to 10 fields.  The following implementation works
9735 // regardless of whether tr1::tuple is implemented using the
9736 // non-standard variadic template feature or not.
9737
9738 inline void PrintTo(const ::std::tr1::tuple<>& t, ::std::ostream* os) {
9739   PrintTupleTo(t, os);
9740 }
9741
9742 template <typename T1>
9743 void PrintTo(const ::std::tr1::tuple<T1>& t, ::std::ostream* os) {
9744   PrintTupleTo(t, os);
9745 }
9746
9747 template <typename T1, typename T2>
9748 void PrintTo(const ::std::tr1::tuple<T1, T2>& t, ::std::ostream* os) {
9749   PrintTupleTo(t, os);
9750 }
9751
9752 template <typename T1, typename T2, typename T3>
9753 void PrintTo(const ::std::tr1::tuple<T1, T2, T3>& t, ::std::ostream* os) {
9754   PrintTupleTo(t, os);
9755 }
9756
9757 template <typename T1, typename T2, typename T3, typename T4>
9758 void PrintTo(const ::std::tr1::tuple<T1, T2, T3, T4>& t, ::std::ostream* os) {
9759   PrintTupleTo(t, os);
9760 }
9761
9762 template <typename T1, typename T2, typename T3, typename T4, typename T5>
9763 void PrintTo(const ::std::tr1::tuple<T1, T2, T3, T4, T5>& t,
9764              ::std::ostream* os) {
9765   PrintTupleTo(t, os);
9766 }
9767
9768 template <typename T1, typename T2, typename T3, typename T4, typename T5,
9769           typename T6>
9770 void PrintTo(const ::std::tr1::tuple<T1, T2, T3, T4, T5, T6>& t,
9771              ::std::ostream* os) {
9772   PrintTupleTo(t, os);
9773 }
9774
9775 template <typename T1, typename T2, typename T3, typename T4, typename T5,
9776           typename T6, typename T7>
9777 void PrintTo(const ::std::tr1::tuple<T1, T2, T3, T4, T5, T6, T7>& t,
9778              ::std::ostream* os) {
9779   PrintTupleTo(t, os);
9780 }
9781
9782 template <typename T1, typename T2, typename T3, typename T4, typename T5,
9783           typename T6, typename T7, typename T8>
9784 void PrintTo(const ::std::tr1::tuple<T1, T2, T3, T4, T5, T6, T7, T8>& t,
9785              ::std::ostream* os) {
9786   PrintTupleTo(t, os);
9787 }
9788
9789 template <typename T1, typename T2, typename T3, typename T4, typename T5,
9790           typename T6, typename T7, typename T8, typename T9>
9791 void PrintTo(const ::std::tr1::tuple<T1, T2, T3, T4, T5, T6, T7, T8, T9>& t,
9792              ::std::ostream* os) {
9793   PrintTupleTo(t, os);
9794 }
9795
9796 template <typename T1, typename T2, typename T3, typename T4, typename T5,
9797           typename T6, typename T7, typename T8, typename T9, typename T10>
9798 void PrintTo(
9799     const ::std::tr1::tuple<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>& t,
9800     ::std::ostream* os) {
9801   PrintTupleTo(t, os);
9802 }
9803 #endif  // GTEST_HAS_TR1_TUPLE
9804
9805 // Overload for std::pair.
9806 template <typename T1, typename T2>
9807 void PrintTo(const ::std::pair<T1, T2>& value, ::std::ostream* os) {
9808   *os << '(';
9809   // We cannot use UniversalPrint(value.first, os) here, as T1 may be
9810   // a reference type.  The same for printing value.second.
9811   UniversalPrinter<T1>::Print(value.first, os);
9812   *os << ", ";
9813   UniversalPrinter<T2>::Print(value.second, os);
9814   *os << ')';
9815 }
9816
9817 // Implements printing a non-reference type T by letting the compiler
9818 // pick the right overload of PrintTo() for T.
9819 template <typename T>
9820 class UniversalPrinter {
9821  public:
9822   // MSVC warns about adding const to a function type, so we want to
9823   // disable the warning.
9824 #ifdef _MSC_VER
9825 # pragma warning(push)          // Saves the current warning state.
9826 # pragma warning(disable:4180)  // Temporarily disables warning 4180.
9827 #endif  // _MSC_VER
9828
9829   // Note: we deliberately don't call this PrintTo(), as that name
9830   // conflicts with ::testing::internal::PrintTo in the body of the
9831   // function.
9832   static void Print(const T& value, ::std::ostream* os) {
9833     // By default, ::testing::internal::PrintTo() is used for printing
9834     // the value.
9835     //
9836     // Thanks to Koenig look-up, if T is a class and has its own
9837     // PrintTo() function defined in its namespace, that function will
9838     // be visible here.  Since it is more specific than the generic ones
9839     // in ::testing::internal, it will be picked by the compiler in the
9840     // following statement - exactly what we want.
9841     PrintTo(value, os);
9842   }
9843
9844 #ifdef _MSC_VER
9845 # pragma warning(pop)           // Restores the warning state.
9846 #endif  // _MSC_VER
9847 };
9848
9849 // UniversalPrintArray(begin, len, os) prints an array of 'len'
9850 // elements, starting at address 'begin'.
9851 template <typename T>
9852 void UniversalPrintArray(const T* begin, size_t len, ::std::ostream* os) {
9853   if (len == 0) {
9854     *os << "{}";
9855   } else {
9856     *os << "{ ";
9857     const size_t kThreshold = 18;
9858     const size_t kChunkSize = 8;
9859     // If the array has more than kThreshold elements, we'll have to
9860     // omit some details by printing only the first and the last
9861     // kChunkSize elements.
9862     // TODO(wan@google.com): let the user control the threshold using a flag.
9863     if (len <= kThreshold) {
9864       PrintRawArrayTo(begin, len, os);
9865     } else {
9866       PrintRawArrayTo(begin, kChunkSize, os);
9867       *os << ", ..., ";
9868       PrintRawArrayTo(begin + len - kChunkSize, kChunkSize, os);
9869     }
9870     *os << " }";
9871   }
9872 }
9873 // This overload prints a (const) char array compactly.
9874 GTEST_API_ void UniversalPrintArray(
9875     const char* begin, size_t len, ::std::ostream* os);
9876
9877 // This overload prints a (const) wchar_t array compactly.
9878 GTEST_API_ void UniversalPrintArray(
9879     const wchar_t* begin, size_t len, ::std::ostream* os);
9880
9881 // Implements printing an array type T[N].
9882 template <typename T, size_t N>
9883 class UniversalPrinter<T[N]> {
9884  public:
9885   // Prints the given array, omitting some elements when there are too
9886   // many.
9887   static void Print(const T (&a)[N], ::std::ostream* os) {
9888     UniversalPrintArray(a, N, os);
9889   }
9890 };
9891
9892 // Implements printing a reference type T&.
9893 template <typename T>
9894 class UniversalPrinter<T&> {
9895  public:
9896   // MSVC warns about adding const to a function type, so we want to
9897   // disable the warning.
9898 #ifdef _MSC_VER
9899 # pragma warning(push)          // Saves the current warning state.
9900 # pragma warning(disable:4180)  // Temporarily disables warning 4180.
9901 #endif  // _MSC_VER
9902
9903   static void Print(const T& value, ::std::ostream* os) {
9904     // Prints the address of the value.  We use reinterpret_cast here
9905     // as static_cast doesn't compile when T is a function type.
9906     *os << "@" << reinterpret_cast<const void*>(&value) << " ";
9907
9908     // Then prints the value itself.
9909     UniversalPrint(value, os);
9910   }
9911
9912 #ifdef _MSC_VER
9913 # pragma warning(pop)           // Restores the warning state.
9914 #endif  // _MSC_VER
9915 };
9916
9917 // Prints a value tersely: for a reference type, the referenced value
9918 // (but not the address) is printed; for a (const) char pointer, the
9919 // NUL-terminated string (but not the pointer) is printed.
9920
9921 template <typename T>
9922 class UniversalTersePrinter {
9923  public:
9924   static void Print(const T& value, ::std::ostream* os) {
9925     UniversalPrint(value, os);
9926   }
9927 };
9928 template <typename T>
9929 class UniversalTersePrinter<T&> {
9930  public:
9931   static void Print(const T& value, ::std::ostream* os) {
9932     UniversalPrint(value, os);
9933   }
9934 };
9935 template <typename T, size_t N>
9936 class UniversalTersePrinter<T[N]> {
9937  public:
9938   static void Print(const T (&value)[N], ::std::ostream* os) {
9939     UniversalPrinter<T[N]>::Print(value, os);
9940   }
9941 };
9942 template <>
9943 class UniversalTersePrinter<const char*> {
9944  public:
9945   static void Print(const char* str, ::std::ostream* os) {
9946     if (str == NULL) {
9947       *os << "NULL";
9948     } else {
9949       UniversalPrint(string(str), os);
9950     }
9951   }
9952 };
9953 template <>
9954 class UniversalTersePrinter<char*> {
9955  public:
9956   static void Print(char* str, ::std::ostream* os) {
9957     UniversalTersePrinter<const char*>::Print(str, os);
9958   }
9959 };
9960
9961 #if GTEST_HAS_STD_WSTRING
9962 template <>
9963 class UniversalTersePrinter<const wchar_t*> {
9964  public:
9965   static void Print(const wchar_t* str, ::std::ostream* os) {
9966     if (str == NULL) {
9967       *os << "NULL";
9968     } else {
9969       UniversalPrint(::std::wstring(str), os);
9970     }
9971   }
9972 };
9973 #endif
9974
9975 template <>
9976 class UniversalTersePrinter<wchar_t*> {
9977  public:
9978   static void Print(wchar_t* str, ::std::ostream* os) {
9979     UniversalTersePrinter<const wchar_t*>::Print(str, os);
9980   }
9981 };
9982
9983 template <typename T>
9984 void UniversalTersePrint(const T& value, ::std::ostream* os) {
9985   UniversalTersePrinter<T>::Print(value, os);
9986 }
9987
9988 // Prints a value using the type inferred by the compiler.  The
9989 // difference between this and UniversalTersePrint() is that for a
9990 // (const) char pointer, this prints both the pointer and the
9991 // NUL-terminated string.
9992 template <typename T>
9993 void UniversalPrint(const T& value, ::std::ostream* os) {
9994   // A workarond for the bug in VC++ 7.1 that prevents us from instantiating
9995   // UniversalPrinter with T directly.
9996   typedef T T1;
9997   UniversalPrinter<T1>::Print(value, os);
9998 }
9999
10000 #if GTEST_HAS_TR1_TUPLE
10001 typedef ::std::vector<string> Strings;
10002
10003 // This helper template allows PrintTo() for tuples and
10004 // UniversalTersePrintTupleFieldsToStrings() to be defined by
10005 // induction on the number of tuple fields.  The idea is that
10006 // TuplePrefixPrinter<N>::PrintPrefixTo(t, os) prints the first N
10007 // fields in tuple t, and can be defined in terms of
10008 // TuplePrefixPrinter<N - 1>.
10009
10010 // The inductive case.
10011 template <size_t N>
10012 struct TuplePrefixPrinter {
10013   // Prints the first N fields of a tuple.
10014   template <typename Tuple>
10015   static void PrintPrefixTo(const Tuple& t, ::std::ostream* os) {
10016     TuplePrefixPrinter<N - 1>::PrintPrefixTo(t, os);
10017     *os << ", ";
10018     UniversalPrinter<typename ::std::tr1::tuple_element<N - 1, Tuple>::type>
10019         ::Print(::std::tr1::get<N - 1>(t), os);
10020   }
10021
10022   // Tersely prints the first N fields of a tuple to a string vector,
10023   // one element for each field.
10024   template <typename Tuple>
10025   static void TersePrintPrefixToStrings(const Tuple& t, Strings* strings) {
10026     TuplePrefixPrinter<N - 1>::TersePrintPrefixToStrings(t, strings);
10027     ::std::stringstream ss;
10028     UniversalTersePrint(::std::tr1::get<N - 1>(t), &ss);
10029     strings->push_back(ss.str());
10030   }
10031 };
10032
10033 // Base cases.
10034 template <>
10035 struct TuplePrefixPrinter<0> {
10036   template <typename Tuple>
10037   static void PrintPrefixTo(const Tuple&, ::std::ostream*) {}
10038
10039   template <typename Tuple>
10040   static void TersePrintPrefixToStrings(const Tuple&, Strings*) {}
10041 };
10042 // We have to specialize the entire TuplePrefixPrinter<> class
10043 // template here, even though the definition of
10044 // TersePrintPrefixToStrings() is the same as the generic version, as
10045 // Embarcadero (formerly CodeGear, formerly Borland) C++ doesn't
10046 // support specializing a method template of a class template.
10047 template <>
10048 struct TuplePrefixPrinter<1> {
10049   template <typename Tuple>
10050   static void PrintPrefixTo(const Tuple& t, ::std::ostream* os) {
10051     UniversalPrinter<typename ::std::tr1::tuple_element<0, Tuple>::type>::
10052         Print(::std::tr1::get<0>(t), os);
10053   }
10054
10055   template <typename Tuple>
10056   static void TersePrintPrefixToStrings(const Tuple& t, Strings* strings) {
10057     ::std::stringstream ss;
10058     UniversalTersePrint(::std::tr1::get<0>(t), &ss);
10059     strings->push_back(ss.str());
10060   }
10061 };
10062
10063 // Helper function for printing a tuple.  T must be instantiated with
10064 // a tuple type.
10065 template <typename T>
10066 void PrintTupleTo(const T& t, ::std::ostream* os) {
10067   *os << "(";
10068   TuplePrefixPrinter< ::std::tr1::tuple_size<T>::value>::
10069       PrintPrefixTo(t, os);
10070   *os << ")";
10071 }
10072
10073 // Prints the fields of a tuple tersely to a string vector, one
10074 // element for each field.  See the comment before
10075 // UniversalTersePrint() for how we define "tersely".
10076 template <typename Tuple>
10077 Strings UniversalTersePrintTupleFieldsToStrings(const Tuple& value) {
10078   Strings result;
10079   TuplePrefixPrinter< ::std::tr1::tuple_size<Tuple>::value>::
10080       TersePrintPrefixToStrings(value, &result);
10081   return result;
10082 }
10083 #endif  // GTEST_HAS_TR1_TUPLE
10084
10085 }  // namespace internal
10086
10087 template <typename T>
10088 ::std::string PrintToString(const T& value) {
10089   ::std::stringstream ss;
10090   internal::UniversalTersePrinter<T>::Print(value, &ss);
10091   return ss.str();
10092 }
10093
10094 }  // namespace testing
10095
10096 #endif  // GTEST_INCLUDE_GTEST_GTEST_PRINTERS_H_
10097
10098 #if GTEST_HAS_PARAM_TEST
10099
10100 namespace testing {
10101 namespace internal {
10102
10103 // INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.
10104 //
10105 // Outputs a message explaining invalid registration of different
10106 // fixture class for the same test case. This may happen when
10107 // TEST_P macro is used to define two tests with the same name
10108 // but in different namespaces.
10109 GTEST_API_ void ReportInvalidTestCaseType(const char* test_case_name,
10110                                           const char* file, int line);
10111
10112 template <typename> class ParamGeneratorInterface;
10113 template <typename> class ParamGenerator;
10114
10115 // Interface for iterating over elements provided by an implementation
10116 // of ParamGeneratorInterface<T>.
10117 template <typename T>
10118 class ParamIteratorInterface {
10119  public:
10120   virtual ~ParamIteratorInterface() {}
10121   // A pointer to the base generator instance.
10122   // Used only for the purposes of iterator comparison
10123   // to make sure that two iterators belong to the same generator.
10124   virtual const ParamGeneratorInterface<T>* BaseGenerator() const = 0;
10125   // Advances iterator to point to the next element
10126   // provided by the generator. The caller is responsible
10127   // for not calling Advance() on an iterator equal to
10128   // BaseGenerator()->End().
10129   virtual void Advance() = 0;
10130   // Clones the iterator object. Used for implementing copy semantics
10131   // of ParamIterator<T>.
10132   virtual ParamIteratorInterface* Clone() const = 0;
10133   // Dereferences the current iterator and provides (read-only) access
10134   // to the pointed value. It is the caller's responsibility not to call
10135   // Current() on an iterator equal to BaseGenerator()->End().
10136   // Used for implementing ParamGenerator<T>::operator*().
10137   virtual const T* Current() const = 0;
10138   // Determines whether the given iterator and other point to the same
10139   // element in the sequence generated by the generator.
10140   // Used for implementing ParamGenerator<T>::operator==().
10141   virtual bool Equals(const ParamIteratorInterface& other) const = 0;
10142 };
10143
10144 // Class iterating over elements provided by an implementation of
10145 // ParamGeneratorInterface<T>. It wraps ParamIteratorInterface<T>
10146 // and implements the const forward iterator concept.
10147 template <typename T>
10148 class ParamIterator {
10149  public:
10150   typedef T value_type;
10151   typedef const T& reference;
10152   typedef ptrdiff_t difference_type;
10153
10154   // ParamIterator assumes ownership of the impl_ pointer.
10155   ParamIterator(const ParamIterator& other) : impl_(other.impl_->Clone()) {}
10156   ParamIterator& operator=(const ParamIterator& other) {
10157     if (this != &other)
10158       impl_.reset(other.impl_->Clone());
10159     return *this;
10160   }
10161
10162   const T& operator*() const { return *impl_->Current(); }
10163   const T* operator->() const { return impl_->Current(); }
10164   // Prefix version of operator++.
10165   ParamIterator& operator++() {
10166     impl_->Advance();
10167     return *this;
10168   }
10169   // Postfix version of operator++.
10170   ParamIterator operator++(int /*unused*/) {
10171     ParamIteratorInterface<T>* clone = impl_->Clone();
10172     impl_->Advance();
10173     return ParamIterator(clone);
10174   }
10175   bool operator==(const ParamIterator& other) const {
10176     return impl_.get() == other.impl_.get() || impl_->Equals(*other.impl_);
10177   }
10178   bool operator!=(const ParamIterator& other) const {
10179     return !(*this == other);
10180   }
10181
10182  private:
10183   friend class ParamGenerator<T>;
10184   explicit ParamIterator(ParamIteratorInterface<T>* impl) : impl_(impl) {}
10185   scoped_ptr<ParamIteratorInterface<T> > impl_;
10186 };
10187
10188 // ParamGeneratorInterface<T> is the binary interface to access generators
10189 // defined in other translation units.
10190 template <typename T>
10191 class ParamGeneratorInterface {
10192  public:
10193   typedef T ParamType;
10194
10195   virtual ~ParamGeneratorInterface() {}
10196
10197   // Generator interface definition
10198   virtual ParamIteratorInterface<T>* Begin() const = 0;
10199   virtual ParamIteratorInterface<T>* End() const = 0;
10200 };
10201
10202 // Wraps ParamGeneratorInterface<T> and provides general generator syntax
10203 // compatible with the STL Container concept.
10204 // This class implements copy initialization semantics and the contained
10205 // ParamGeneratorInterface<T> instance is shared among all copies
10206 // of the original object. This is possible because that instance is immutable.
10207 template<typename T>
10208 class ParamGenerator {
10209  public:
10210   typedef ParamIterator<T> iterator;
10211
10212   explicit ParamGenerator(ParamGeneratorInterface<T>* impl) : impl_(impl) {}
10213   ParamGenerator(const ParamGenerator& other) : impl_(other.impl_) {}
10214
10215   ParamGenerator& operator=(const ParamGenerator& other) {
10216     impl_ = other.impl_;
10217     return *this;
10218   }
10219
10220   iterator begin() const { return iterator(impl_->Begin()); }
10221   iterator end() const { return iterator(impl_->End()); }
10222
10223  private:
10224   linked_ptr<const ParamGeneratorInterface<T> > impl_;
10225 };
10226
10227 // Generates values from a range of two comparable values. Can be used to
10228 // generate sequences of user-defined types that implement operator+() and
10229 // operator<().
10230 // This class is used in the Range() function.
10231 template <typename T, typename IncrementT>
10232 class RangeGenerator : public ParamGeneratorInterface<T> {
10233  public:
10234   RangeGenerator(T begin, T end, IncrementT step)
10235       : begin_(begin), end_(end),
10236         step_(step), end_index_(CalculateEndIndex(begin, end, step)) {}
10237   virtual ~RangeGenerator() {}
10238
10239   virtual ParamIteratorInterface<T>* Begin() const {
10240     return new Iterator(this, begin_, 0, step_);
10241   }
10242   virtual ParamIteratorInterface<T>* End() const {
10243     return new Iterator(this, end_, end_index_, step_);
10244   }
10245
10246  private:
10247   class Iterator : public ParamIteratorInterface<T> {
10248    public:
10249     Iterator(const ParamGeneratorInterface<T>* base, T value, int index,
10250              IncrementT step)
10251         : base_(base), value_(value), index_(index), step_(step) {}
10252     virtual ~Iterator() {}
10253
10254     virtual const ParamGeneratorInterface<T>* BaseGenerator() const {
10255       return base_;
10256     }
10257     virtual void Advance() {
10258       value_ = value_ + step_;
10259       index_++;
10260     }
10261     virtual ParamIteratorInterface<T>* Clone() const {
10262       return new Iterator(*this);
10263     }
10264     virtual const T* Current() const { return &value_; }
10265     virtual bool Equals(const ParamIteratorInterface<T>& other) const {
10266       // Having the same base generator guarantees that the other
10267       // iterator is of the same type and we can downcast.
10268       GTEST_CHECK_(BaseGenerator() == other.BaseGenerator())
10269           << "The program attempted to compare iterators "
10270           << "from different generators." << std::endl;
10271       const int other_index =
10272           CheckedDowncastToActualType<const Iterator>(&other)->index_;
10273       return index_ == other_index;
10274     }
10275
10276    private:
10277     Iterator(const Iterator& other)
10278         : ParamIteratorInterface<T>(),
10279           base_(other.base_), value_(other.value_), index_(other.index_),
10280           step_(other.step_) {}
10281
10282     // No implementation - assignment is unsupported.
10283     void operator=(const Iterator& other);
10284
10285     const ParamGeneratorInterface<T>* const base_;
10286     T value_;
10287     int index_;
10288     const IncrementT step_;
10289   };  // class RangeGenerator::Iterator
10290
10291   static int CalculateEndIndex(const T& begin,
10292                                const T& end,
10293                                const IncrementT& step) {
10294     int end_index = 0;
10295     for (T i = begin; i < end; i = i + step)
10296       end_index++;
10297     return end_index;
10298   }
10299
10300   // No implementation - assignment is unsupported.
10301   void operator=(const RangeGenerator& other);
10302
10303   const T begin_;
10304   const T end_;
10305   const IncrementT step_;
10306   // The index for the end() iterator. All the elements in the generated
10307   // sequence are indexed (0-based) to aid iterator comparison.
10308   const int end_index_;
10309 };  // class RangeGenerator
10310
10311
10312 // Generates values from a pair of STL-style iterators. Used in the
10313 // ValuesIn() function. The elements are copied from the source range
10314 // since the source can be located on the stack, and the generator
10315 // is likely to persist beyond that stack frame.
10316 template <typename T>
10317 class ValuesInIteratorRangeGenerator : public ParamGeneratorInterface<T> {
10318  public:
10319   template <typename ForwardIterator>
10320   ValuesInIteratorRangeGenerator(ForwardIterator begin, ForwardIterator end)
10321       : container_(begin, end) {}
10322   virtual ~ValuesInIteratorRangeGenerator() {}
10323
10324   virtual ParamIteratorInterface<T>* Begin() const {
10325     return new Iterator(this, container_.begin());
10326   }
10327   virtual ParamIteratorInterface<T>* End() const {
10328     return new Iterator(this, container_.end());
10329   }
10330
10331  private:
10332   typedef typename ::std::vector<T> ContainerType;
10333
10334   class Iterator : public ParamIteratorInterface<T> {
10335    public:
10336     Iterator(const ParamGeneratorInterface<T>* base,
10337              typename ContainerType::const_iterator iterator)
10338         : base_(base), iterator_(iterator) {}
10339     virtual ~Iterator() {}
10340
10341     virtual const ParamGeneratorInterface<T>* BaseGenerator() const {
10342       return base_;
10343     }
10344     virtual void Advance() {
10345       ++iterator_;
10346       value_.reset();
10347     }
10348     virtual ParamIteratorInterface<T>* Clone() const {
10349       return new Iterator(*this);
10350     }
10351     // We need to use cached value referenced by iterator_ because *iterator_
10352     // can return a temporary object (and of type other then T), so just
10353     // having "return &*iterator_;" doesn't work.
10354     // value_ is updated here and not in Advance() because Advance()
10355     // can advance iterator_ beyond the end of the range, and we cannot
10356     // detect that fact. The client code, on the other hand, is
10357     // responsible for not calling Current() on an out-of-range iterator.
10358     virtual const T* Current() const {
10359       if (value_.get() == NULL)
10360         value_.reset(new T(*iterator_));
10361       return value_.get();
10362     }
10363     virtual bool Equals(const ParamIteratorInterface<T>& other) const {
10364       // Having the same base generator guarantees that the other
10365       // iterator is of the same type and we can downcast.
10366       GTEST_CHECK_(BaseGenerator() == other.BaseGenerator())
10367           << "The program attempted to compare iterators "
10368           << "from different generators." << std::endl;
10369       return iterator_ ==
10370           CheckedDowncastToActualType<const Iterator>(&other)->iterator_;
10371     }
10372
10373    private:
10374     Iterator(const Iterator& other)
10375           // The explicit constructor call suppresses a false warning
10376           // emitted by gcc when supplied with the -Wextra option.
10377         : ParamIteratorInterface<T>(),
10378           base_(other.base_),
10379           iterator_(other.iterator_) {}
10380
10381     const ParamGeneratorInterface<T>* const base_;
10382     typename ContainerType::const_iterator iterator_;
10383     // A cached value of *iterator_. We keep it here to allow access by
10384     // pointer in the wrapping iterator's operator->().
10385     // value_ needs to be mutable to be accessed in Current().
10386     // Use of scoped_ptr helps manage cached value's lifetime,
10387     // which is bound by the lifespan of the iterator itself.
10388     mutable scoped_ptr<const T> value_;
10389   };  // class ValuesInIteratorRangeGenerator::Iterator
10390
10391   // No implementation - assignment is unsupported.
10392   void operator=(const ValuesInIteratorRangeGenerator& other);
10393
10394   const ContainerType container_;
10395 };  // class ValuesInIteratorRangeGenerator
10396
10397 // INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.
10398 //
10399 // Stores a parameter value and later creates tests parameterized with that
10400 // value.
10401 template <class TestClass>
10402 class ParameterizedTestFactory : public TestFactoryBase {
10403  public:
10404   typedef typename TestClass::ParamType ParamType;
10405   explicit ParameterizedTestFactory(ParamType parameter) :
10406       parameter_(parameter) {}
10407   virtual Test* CreateTest() {
10408     TestClass::SetParam(&parameter_);
10409     return new TestClass();
10410   }
10411
10412  private:
10413   const ParamType parameter_;
10414
10415   GTEST_DISALLOW_COPY_AND_ASSIGN_(ParameterizedTestFactory);
10416 };
10417
10418 // INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.
10419 //
10420 // TestMetaFactoryBase is a base class for meta-factories that create
10421 // test factories for passing into MakeAndRegisterTestInfo function.
10422 template <class ParamType>
10423 class TestMetaFactoryBase {
10424  public:
10425   virtual ~TestMetaFactoryBase() {}
10426
10427   virtual TestFactoryBase* CreateTestFactory(ParamType parameter) = 0;
10428 };
10429
10430 // INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.
10431 //
10432 // TestMetaFactory creates test factories for passing into
10433 // MakeAndRegisterTestInfo function. Since MakeAndRegisterTestInfo receives
10434 // ownership of test factory pointer, same factory object cannot be passed
10435 // into that method twice. But ParameterizedTestCaseInfo is going to call
10436 // it for each Test/Parameter value combination. Thus it needs meta factory
10437 // creator class.
10438 template <class TestCase>
10439 class TestMetaFactory
10440     : public TestMetaFactoryBase<typename TestCase::ParamType> {
10441  public:
10442   typedef typename TestCase::ParamType ParamType;
10443
10444   TestMetaFactory() {}
10445
10446   virtual TestFactoryBase* CreateTestFactory(ParamType parameter) {
10447     return new ParameterizedTestFactory<TestCase>(parameter);
10448   }
10449
10450  private:
10451   GTEST_DISALLOW_COPY_AND_ASSIGN_(TestMetaFactory);
10452 };
10453
10454 // INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.
10455 //
10456 // ParameterizedTestCaseInfoBase is a generic interface
10457 // to ParameterizedTestCaseInfo classes. ParameterizedTestCaseInfoBase
10458 // accumulates test information provided by TEST_P macro invocations
10459 // and generators provided by INSTANTIATE_TEST_CASE_P macro invocations
10460 // and uses that information to register all resulting test instances
10461 // in RegisterTests method. The ParameterizeTestCaseRegistry class holds
10462 // a collection of pointers to the ParameterizedTestCaseInfo objects
10463 // and calls RegisterTests() on each of them when asked.
10464 class ParameterizedTestCaseInfoBase {
10465  public:
10466   virtual ~ParameterizedTestCaseInfoBase() {}
10467
10468   // Base part of test case name for display purposes.
10469   virtual const string& GetTestCaseName() const = 0;
10470   // Test case id to verify identity.
10471   virtual TypeId GetTestCaseTypeId() const = 0;
10472   // UnitTest class invokes this method to register tests in this
10473   // test case right before running them in RUN_ALL_TESTS macro.
10474   // This method should not be called more then once on any single
10475   // instance of a ParameterizedTestCaseInfoBase derived class.
10476   virtual void RegisterTests() = 0;
10477
10478  protected:
10479   ParameterizedTestCaseInfoBase() {}
10480
10481  private:
10482   GTEST_DISALLOW_COPY_AND_ASSIGN_(ParameterizedTestCaseInfoBase);
10483 };
10484
10485 // INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.
10486 //
10487 // ParameterizedTestCaseInfo accumulates tests obtained from TEST_P
10488 // macro invocations for a particular test case and generators
10489 // obtained from INSTANTIATE_TEST_CASE_P macro invocations for that
10490 // test case. It registers tests with all values generated by all
10491 // generators when asked.
10492 template <class TestCase>
10493 class ParameterizedTestCaseInfo : public ParameterizedTestCaseInfoBase {
10494  public:
10495   // ParamType and GeneratorCreationFunc are private types but are required
10496   // for declarations of public methods AddTestPattern() and
10497   // AddTestCaseInstantiation().
10498   typedef typename TestCase::ParamType ParamType;
10499   // A function that returns an instance of appropriate generator type.
10500   typedef ParamGenerator<ParamType>(GeneratorCreationFunc)();
10501
10502   explicit ParameterizedTestCaseInfo(const char* name)
10503       : test_case_name_(name) {}
10504
10505   // Test case base name for display purposes.
10506   virtual const string& GetTestCaseName() const { return test_case_name_; }
10507   // Test case id to verify identity.
10508   virtual TypeId GetTestCaseTypeId() const { return GetTypeId<TestCase>(); }
10509   // TEST_P macro uses AddTestPattern() to record information
10510   // about a single test in a LocalTestInfo structure.
10511   // test_case_name is the base name of the test case (without invocation
10512   // prefix). test_base_name is the name of an individual test without
10513   // parameter index. For the test SequenceA/FooTest.DoBar/1 FooTest is
10514   // test case base name and DoBar is test base name.
10515   void AddTestPattern(const char* test_case_name,
10516                       const char* test_base_name,
10517                       TestMetaFactoryBase<ParamType>* meta_factory) {
10518     tests_.push_back(linked_ptr<TestInfo>(new TestInfo(test_case_name,
10519                                                        test_base_name,
10520                                                        meta_factory)));
10521   }
10522   // INSTANTIATE_TEST_CASE_P macro uses AddGenerator() to record information
10523   // about a generator.
10524   int AddTestCaseInstantiation(const string& instantiation_name,
10525                                GeneratorCreationFunc* func,
10526                                const char* /* file */,
10527                                int /* line */) {
10528     instantiations_.push_back(::std::make_pair(instantiation_name, func));
10529     return 0;  // Return value used only to run this method in namespace scope.
10530   }
10531   // UnitTest class invokes this method to register tests in this test case
10532   // test cases right before running tests in RUN_ALL_TESTS macro.
10533   // This method should not be called more then once on any single
10534   // instance of a ParameterizedTestCaseInfoBase derived class.
10535   // UnitTest has a guard to prevent from calling this method more then once.
10536   virtual void RegisterTests() {
10537     for (typename TestInfoContainer::iterator test_it = tests_.begin();
10538          test_it != tests_.end(); ++test_it) {
10539       linked_ptr<TestInfo> test_info = *test_it;
10540       for (typename InstantiationContainer::iterator gen_it =
10541                instantiations_.begin(); gen_it != instantiations_.end();
10542                ++gen_it) {
10543         const string& instantiation_name = gen_it->first;
10544         ParamGenerator<ParamType> generator((*gen_it->second)());
10545
10546         string test_case_name;
10547         if ( !instantiation_name.empty() )
10548           test_case_name = instantiation_name + "/";
10549         test_case_name += test_info->test_case_base_name;
10550
10551         int i = 0;
10552         for (typename ParamGenerator<ParamType>::iterator param_it =
10553                  generator.begin();
10554              param_it != generator.end(); ++param_it, ++i) {
10555           Message test_name_stream;
10556           test_name_stream << test_info->test_base_name << "/" << i;
10557           MakeAndRegisterTestInfo(
10558               test_case_name.c_str(),
10559               test_name_stream.GetString().c_str(),
10560               NULL,  // No type parameter.
10561               PrintToString(*param_it).c_str(),
10562               GetTestCaseTypeId(),
10563               TestCase::SetUpTestCase,
10564               TestCase::TearDownTestCase,
10565               test_info->test_meta_factory->CreateTestFactory(*param_it));
10566         }  // for param_it
10567       }  // for gen_it
10568     }  // for test_it
10569   }  // RegisterTests
10570
10571  private:
10572   // LocalTestInfo structure keeps information about a single test registered
10573   // with TEST_P macro.
10574   struct TestInfo {
10575     TestInfo(const char* a_test_case_base_name,
10576              const char* a_test_base_name,
10577              TestMetaFactoryBase<ParamType>* a_test_meta_factory) :
10578         test_case_base_name(a_test_case_base_name),
10579         test_base_name(a_test_base_name),
10580         test_meta_factory(a_test_meta_factory) {}
10581
10582     const string test_case_base_name;
10583     const string test_base_name;
10584     const scoped_ptr<TestMetaFactoryBase<ParamType> > test_meta_factory;
10585   };
10586   typedef ::std::vector<linked_ptr<TestInfo> > TestInfoContainer;
10587   // Keeps pairs of <Instantiation name, Sequence generator creation function>
10588   // received from INSTANTIATE_TEST_CASE_P macros.
10589   typedef ::std::vector<std::pair<string, GeneratorCreationFunc*> >
10590       InstantiationContainer;
10591
10592   const string test_case_name_;
10593   TestInfoContainer tests_;
10594   InstantiationContainer instantiations_;
10595
10596   GTEST_DISALLOW_COPY_AND_ASSIGN_(ParameterizedTestCaseInfo);
10597 };  // class ParameterizedTestCaseInfo
10598
10599 // INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.
10600 //
10601 // ParameterizedTestCaseRegistry contains a map of ParameterizedTestCaseInfoBase
10602 // classes accessed by test case names. TEST_P and INSTANTIATE_TEST_CASE_P
10603 // macros use it to locate their corresponding ParameterizedTestCaseInfo
10604 // descriptors.
10605 class ParameterizedTestCaseRegistry {
10606  public:
10607   ParameterizedTestCaseRegistry() {}
10608   ~ParameterizedTestCaseRegistry() {
10609     for (TestCaseInfoContainer::iterator it = test_case_infos_.begin();
10610          it != test_case_infos_.end(); ++it) {
10611       delete *it;
10612     }
10613   }
10614
10615   // Looks up or creates and returns a structure containing information about
10616   // tests and instantiations of a particular test case.
10617   template <class TestCase>
10618   ParameterizedTestCaseInfo<TestCase>* GetTestCasePatternHolder(
10619       const char* test_case_name,
10620       const char* file,
10621       int line) {
10622     ParameterizedTestCaseInfo<TestCase>* typed_test_info = NULL;
10623     for (TestCaseInfoContainer::iterator it = test_case_infos_.begin();
10624          it != test_case_infos_.end(); ++it) {
10625       if ((*it)->GetTestCaseName() == test_case_name) {
10626         if ((*it)->GetTestCaseTypeId() != GetTypeId<TestCase>()) {
10627           // Complain about incorrect usage of Google Test facilities
10628           // and terminate the program since we cannot guaranty correct
10629           // test case setup and tear-down in this case.
10630           ReportInvalidTestCaseType(test_case_name,  file, line);
10631           posix::Abort();
10632         } else {
10633           // At this point we are sure that the object we found is of the same
10634           // type we are looking for, so we downcast it to that type
10635           // without further checks.
10636           typed_test_info = CheckedDowncastToActualType<
10637               ParameterizedTestCaseInfo<TestCase> >(*it);
10638         }
10639         break;
10640       }
10641     }
10642     if (typed_test_info == NULL) {
10643       typed_test_info = new ParameterizedTestCaseInfo<TestCase>(test_case_name);
10644       test_case_infos_.push_back(typed_test_info);
10645     }
10646     return typed_test_info;
10647   }
10648   void RegisterTests() {
10649     for (TestCaseInfoContainer::iterator it = test_case_infos_.begin();
10650          it != test_case_infos_.end(); ++it) {
10651       (*it)->RegisterTests();
10652     }
10653   }
10654
10655  private:
10656   typedef ::std::vector<ParameterizedTestCaseInfoBase*> TestCaseInfoContainer;
10657
10658   TestCaseInfoContainer test_case_infos_;
10659
10660   GTEST_DISALLOW_COPY_AND_ASSIGN_(ParameterizedTestCaseRegistry);
10661 };
10662
10663 }  // namespace internal
10664 }  // namespace testing
10665
10666 #endif  //  GTEST_HAS_PARAM_TEST
10667
10668 #endif  // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PARAM_UTIL_H_
10669 // This file was GENERATED by command:
10670 //     pump.py gtest-param-util-generated.h.pump
10671 // DO NOT EDIT BY HAND!!!
10672
10673 // Copyright 2008 Google Inc.
10674 // All Rights Reserved.
10675 //
10676 // Redistribution and use in source and binary forms, with or without
10677 // modification, are permitted provided that the following conditions are
10678 // met:
10679 //
10680 //     * Redistributions of source code must retain the above copyright
10681 // notice, this list of conditions and the following disclaimer.
10682 //     * Redistributions in binary form must reproduce the above
10683 // copyright notice, this list of conditions and the following disclaimer
10684 // in the documentation and/or other materials provided with the
10685 // distribution.
10686 //     * Neither the name of Google Inc. nor the names of its
10687 // contributors may be used to endorse or promote products derived from
10688 // this software without specific prior written permission.
10689 //
10690 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
10691 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
10692 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
10693 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
10694 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
10695 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
10696 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
10697 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
10698 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
10699 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
10700 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
10701 //
10702 // Author: vladl@google.com (Vlad Losev)
10703
10704 // Type and function utilities for implementing parameterized tests.
10705 // This file is generated by a SCRIPT.  DO NOT EDIT BY HAND!
10706 //
10707 // Currently Google Test supports at most 50 arguments in Values,
10708 // and at most 10 arguments in Combine. Please contact
10709 // googletestframework@googlegroups.com if you need more.
10710 // Please note that the number of arguments to Combine is limited
10711 // by the maximum arity of the implementation of tr1::tuple which is
10712 // currently set at 10.
10713
10714 #ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PARAM_UTIL_GENERATED_H_
10715 #define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PARAM_UTIL_GENERATED_H_
10716
10717 // scripts/fuse_gtest.py depends on gtest's own header being #included
10718 // *unconditionally*.  Therefore these #includes cannot be moved
10719 // inside #if GTEST_HAS_PARAM_TEST.
10720
10721 #if GTEST_HAS_PARAM_TEST
10722
10723 namespace testing {
10724
10725 // Forward declarations of ValuesIn(), which is implemented in
10726 // include/gtest/gtest-param-test.h.
10727 template <typename ForwardIterator>
10728 internal::ParamGenerator<
10729   typename ::testing::internal::IteratorTraits<ForwardIterator>::value_type>
10730 ValuesIn(ForwardIterator begin, ForwardIterator end);
10731
10732 template <typename T, size_t N>
10733 internal::ParamGenerator<T> ValuesIn(const T (&array)[N]);
10734
10735 template <class Container>
10736 internal::ParamGenerator<typename Container::value_type> ValuesIn(
10737     const Container& container);
10738
10739 namespace internal {
10740
10741 // Used in the Values() function to provide polymorphic capabilities.
10742 template <typename T1>
10743 class ValueArray1 {
10744  public:
10745   explicit ValueArray1(T1 v1) : v1_(v1) {}
10746
10747   template <typename T>
10748   operator ParamGenerator<T>() const { return ValuesIn(&v1_, &v1_ + 1); }
10749
10750  private:
10751   // No implementation - assignment is unsupported.
10752   void operator=(const ValueArray1& other);
10753
10754   const T1 v1_;
10755 };
10756
10757 template <typename T1, typename T2>
10758 class ValueArray2 {
10759  public:
10760   ValueArray2(T1 v1, T2 v2) : v1_(v1), v2_(v2) {}
10761
10762   template <typename T>
10763   operator ParamGenerator<T>() const {
10764     const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_)};
10765     return ValuesIn(array);
10766   }
10767
10768  private:
10769   // No implementation - assignment is unsupported.
10770   void operator=(const ValueArray2& other);
10771
10772   const T1 v1_;
10773   const T2 v2_;
10774 };
10775
10776 template <typename T1, typename T2, typename T3>
10777 class ValueArray3 {
10778  public:
10779   ValueArray3(T1 v1, T2 v2, T3 v3) : v1_(v1), v2_(v2), v3_(v3) {}
10780
10781   template <typename T>
10782   operator ParamGenerator<T>() const {
10783     const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
10784         static_cast<T>(v3_)};
10785     return ValuesIn(array);
10786   }
10787
10788  private:
10789   // No implementation - assignment is unsupported.
10790   void operator=(const ValueArray3& other);
10791
10792   const T1 v1_;
10793   const T2 v2_;
10794   const T3 v3_;
10795 };
10796
10797 template <typename T1, typename T2, typename T3, typename T4>
10798 class ValueArray4 {
10799  public:
10800   ValueArray4(T1 v1, T2 v2, T3 v3, T4 v4) : v1_(v1), v2_(v2), v3_(v3),
10801       v4_(v4) {}
10802
10803   template <typename T>
10804   operator ParamGenerator<T>() const {
10805     const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
10806         static_cast<T>(v3_), static_cast<T>(v4_)};
10807     return ValuesIn(array);
10808   }
10809
10810  private:
10811   // No implementation - assignment is unsupported.
10812   void operator=(const ValueArray4& other);
10813
10814   const T1 v1_;
10815   const T2 v2_;
10816   const T3 v3_;
10817   const T4 v4_;
10818 };
10819
10820 template <typename T1, typename T2, typename T3, typename T4, typename T5>
10821 class ValueArray5 {
10822  public:
10823   ValueArray5(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5) : v1_(v1), v2_(v2), v3_(v3),
10824       v4_(v4), v5_(v5) {}
10825
10826   template <typename T>
10827   operator ParamGenerator<T>() const {
10828     const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
10829         static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_)};
10830     return ValuesIn(array);
10831   }
10832
10833  private:
10834   // No implementation - assignment is unsupported.
10835   void operator=(const ValueArray5& other);
10836
10837   const T1 v1_;
10838   const T2 v2_;
10839   const T3 v3_;
10840   const T4 v4_;
10841   const T5 v5_;
10842 };
10843
10844 template <typename T1, typename T2, typename T3, typename T4, typename T5,
10845     typename T6>
10846 class ValueArray6 {
10847  public:
10848   ValueArray6(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6) : v1_(v1), v2_(v2),
10849       v3_(v3), v4_(v4), v5_(v5), v6_(v6) {}
10850
10851   template <typename T>
10852   operator ParamGenerator<T>() const {
10853     const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
10854         static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
10855         static_cast<T>(v6_)};
10856     return ValuesIn(array);
10857   }
10858
10859  private:
10860   // No implementation - assignment is unsupported.
10861   void operator=(const ValueArray6& other);
10862
10863   const T1 v1_;
10864   const T2 v2_;
10865   const T3 v3_;
10866   const T4 v4_;
10867   const T5 v5_;
10868   const T6 v6_;
10869 };
10870
10871 template <typename T1, typename T2, typename T3, typename T4, typename T5,
10872     typename T6, typename T7>
10873 class ValueArray7 {
10874  public:
10875   ValueArray7(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7) : v1_(v1),
10876       v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7) {}
10877
10878   template <typename T>
10879   operator ParamGenerator<T>() const {
10880     const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
10881         static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
10882         static_cast<T>(v6_), static_cast<T>(v7_)};
10883     return ValuesIn(array);
10884   }
10885
10886  private:
10887   // No implementation - assignment is unsupported.
10888   void operator=(const ValueArray7& other);
10889
10890   const T1 v1_;
10891   const T2 v2_;
10892   const T3 v3_;
10893   const T4 v4_;
10894   const T5 v5_;
10895   const T6 v6_;
10896   const T7 v7_;
10897 };
10898
10899 template <typename T1, typename T2, typename T3, typename T4, typename T5,
10900     typename T6, typename T7, typename T8>
10901 class ValueArray8 {
10902  public:
10903   ValueArray8(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7,
10904       T8 v8) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7),
10905       v8_(v8) {}
10906
10907   template <typename T>
10908   operator ParamGenerator<T>() const {
10909     const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
10910         static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
10911         static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_)};
10912     return ValuesIn(array);
10913   }
10914
10915  private:
10916   // No implementation - assignment is unsupported.
10917   void operator=(const ValueArray8& other);
10918
10919   const T1 v1_;
10920   const T2 v2_;
10921   const T3 v3_;
10922   const T4 v4_;
10923   const T5 v5_;
10924   const T6 v6_;
10925   const T7 v7_;
10926   const T8 v8_;
10927 };
10928
10929 template <typename T1, typename T2, typename T3, typename T4, typename T5,
10930     typename T6, typename T7, typename T8, typename T9>
10931 class ValueArray9 {
10932  public:
10933   ValueArray9(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8,
10934       T9 v9) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7),
10935       v8_(v8), v9_(v9) {}
10936
10937   template <typename T>
10938   operator ParamGenerator<T>() const {
10939     const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
10940         static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
10941         static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
10942         static_cast<T>(v9_)};
10943     return ValuesIn(array);
10944   }
10945
10946  private:
10947   // No implementation - assignment is unsupported.
10948   void operator=(const ValueArray9& other);
10949
10950   const T1 v1_;
10951   const T2 v2_;
10952   const T3 v3_;
10953   const T4 v4_;
10954   const T5 v5_;
10955   const T6 v6_;
10956   const T7 v7_;
10957   const T8 v8_;
10958   const T9 v9_;
10959 };
10960
10961 template <typename T1, typename T2, typename T3, typename T4, typename T5,
10962     typename T6, typename T7, typename T8, typename T9, typename T10>
10963 class ValueArray10 {
10964  public:
10965   ValueArray10(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
10966       T10 v10) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7),
10967       v8_(v8), v9_(v9), v10_(v10) {}
10968
10969   template <typename T>
10970   operator ParamGenerator<T>() const {
10971     const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
10972         static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
10973         static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
10974         static_cast<T>(v9_), static_cast<T>(v10_)};
10975     return ValuesIn(array);
10976   }
10977
10978  private:
10979   // No implementation - assignment is unsupported.
10980   void operator=(const ValueArray10& other);
10981
10982   const T1 v1_;
10983   const T2 v2_;
10984   const T3 v3_;
10985   const T4 v4_;
10986   const T5 v5_;
10987   const T6 v6_;
10988   const T7 v7_;
10989   const T8 v8_;
10990   const T9 v9_;
10991   const T10 v10_;
10992 };
10993
10994 template <typename T1, typename T2, typename T3, typename T4, typename T5,
10995     typename T6, typename T7, typename T8, typename T9, typename T10,
10996     typename T11>
10997 class ValueArray11 {
10998  public:
10999   ValueArray11(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
11000       T10 v10, T11 v11) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6),
11001       v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11) {}
11002
11003   template <typename T>
11004   operator ParamGenerator<T>() const {
11005     const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
11006         static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
11007         static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
11008         static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_)};
11009     return ValuesIn(array);
11010   }
11011
11012  private:
11013   // No implementation - assignment is unsupported.
11014   void operator=(const ValueArray11& other);
11015
11016   const T1 v1_;
11017   const T2 v2_;
11018   const T3 v3_;
11019   const T4 v4_;
11020   const T5 v5_;
11021   const T6 v6_;
11022   const T7 v7_;
11023   const T8 v8_;
11024   const T9 v9_;
11025   const T10 v10_;
11026   const T11 v11_;
11027 };
11028
11029 template <typename T1, typename T2, typename T3, typename T4, typename T5,
11030     typename T6, typename T7, typename T8, typename T9, typename T10,
11031     typename T11, typename T12>
11032 class ValueArray12 {
11033  public:
11034   ValueArray12(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
11035       T10 v10, T11 v11, T12 v12) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5),
11036       v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12) {}
11037
11038   template <typename T>
11039   operator ParamGenerator<T>() const {
11040     const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
11041         static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
11042         static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
11043         static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
11044         static_cast<T>(v12_)};
11045     return ValuesIn(array);
11046   }
11047
11048  private:
11049   // No implementation - assignment is unsupported.
11050   void operator=(const ValueArray12& other);
11051
11052   const T1 v1_;
11053   const T2 v2_;
11054   const T3 v3_;
11055   const T4 v4_;
11056   const T5 v5_;
11057   const T6 v6_;
11058   const T7 v7_;
11059   const T8 v8_;
11060   const T9 v9_;
11061   const T10 v10_;
11062   const T11 v11_;
11063   const T12 v12_;
11064 };
11065
11066 template <typename T1, typename T2, typename T3, typename T4, typename T5,
11067     typename T6, typename T7, typename T8, typename T9, typename T10,
11068     typename T11, typename T12, typename T13>
11069 class ValueArray13 {
11070  public:
11071   ValueArray13(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
11072       T10 v10, T11 v11, T12 v12, T13 v13) : v1_(v1), v2_(v2), v3_(v3), v4_(v4),
11073       v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11),
11074       v12_(v12), v13_(v13) {}
11075
11076   template <typename T>
11077   operator ParamGenerator<T>() const {
11078     const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
11079         static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
11080         static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
11081         static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
11082         static_cast<T>(v12_), static_cast<T>(v13_)};
11083     return ValuesIn(array);
11084   }
11085
11086  private:
11087   // No implementation - assignment is unsupported.
11088   void operator=(const ValueArray13& other);
11089
11090   const T1 v1_;
11091   const T2 v2_;
11092   const T3 v3_;
11093   const T4 v4_;
11094   const T5 v5_;
11095   const T6 v6_;
11096   const T7 v7_;
11097   const T8 v8_;
11098   const T9 v9_;
11099   const T10 v10_;
11100   const T11 v11_;
11101   const T12 v12_;
11102   const T13 v13_;
11103 };
11104
11105 template <typename T1, typename T2, typename T3, typename T4, typename T5,
11106     typename T6, typename T7, typename T8, typename T9, typename T10,
11107     typename T11, typename T12, typename T13, typename T14>
11108 class ValueArray14 {
11109  public:
11110   ValueArray14(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
11111       T10 v10, T11 v11, T12 v12, T13 v13, T14 v14) : v1_(v1), v2_(v2), v3_(v3),
11112       v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10),
11113       v11_(v11), v12_(v12), v13_(v13), v14_(v14) {}
11114
11115   template <typename T>
11116   operator ParamGenerator<T>() const {
11117     const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
11118         static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
11119         static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
11120         static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
11121         static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_)};
11122     return ValuesIn(array);
11123   }
11124
11125  private:
11126   // No implementation - assignment is unsupported.
11127   void operator=(const ValueArray14& other);
11128
11129   const T1 v1_;
11130   const T2 v2_;
11131   const T3 v3_;
11132   const T4 v4_;
11133   const T5 v5_;
11134   const T6 v6_;
11135   const T7 v7_;
11136   const T8 v8_;
11137   const T9 v9_;
11138   const T10 v10_;
11139   const T11 v11_;
11140   const T12 v12_;
11141   const T13 v13_;
11142   const T14 v14_;
11143 };
11144
11145 template <typename T1, typename T2, typename T3, typename T4, typename T5,
11146     typename T6, typename T7, typename T8, typename T9, typename T10,
11147     typename T11, typename T12, typename T13, typename T14, typename T15>
11148 class ValueArray15 {
11149  public:
11150   ValueArray15(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
11151       T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15) : v1_(v1), v2_(v2),
11152       v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10),
11153       v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15) {}
11154
11155   template <typename T>
11156   operator ParamGenerator<T>() const {
11157     const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
11158         static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
11159         static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
11160         static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
11161         static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
11162         static_cast<T>(v15_)};
11163     return ValuesIn(array);
11164   }
11165
11166  private:
11167   // No implementation - assignment is unsupported.
11168   void operator=(const ValueArray15& other);
11169
11170   const T1 v1_;
11171   const T2 v2_;
11172   const T3 v3_;
11173   const T4 v4_;
11174   const T5 v5_;
11175   const T6 v6_;
11176   const T7 v7_;
11177   const T8 v8_;
11178   const T9 v9_;
11179   const T10 v10_;
11180   const T11 v11_;
11181   const T12 v12_;
11182   const T13 v13_;
11183   const T14 v14_;
11184   const T15 v15_;
11185 };
11186
11187 template <typename T1, typename T2, typename T3, typename T4, typename T5,
11188     typename T6, typename T7, typename T8, typename T9, typename T10,
11189     typename T11, typename T12, typename T13, typename T14, typename T15,
11190     typename T16>
11191 class ValueArray16 {
11192  public:
11193   ValueArray16(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
11194       T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16) : v1_(v1),
11195       v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9),
11196       v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15),
11197       v16_(v16) {}
11198
11199   template <typename T>
11200   operator ParamGenerator<T>() const {
11201     const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
11202         static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
11203         static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
11204         static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
11205         static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
11206         static_cast<T>(v15_), static_cast<T>(v16_)};
11207     return ValuesIn(array);
11208   }
11209
11210  private:
11211   // No implementation - assignment is unsupported.
11212   void operator=(const ValueArray16& other);
11213
11214   const T1 v1_;
11215   const T2 v2_;
11216   const T3 v3_;
11217   const T4 v4_;
11218   const T5 v5_;
11219   const T6 v6_;
11220   const T7 v7_;
11221   const T8 v8_;
11222   const T9 v9_;
11223   const T10 v10_;
11224   const T11 v11_;
11225   const T12 v12_;
11226   const T13 v13_;
11227   const T14 v14_;
11228   const T15 v15_;
11229   const T16 v16_;
11230 };
11231
11232 template <typename T1, typename T2, typename T3, typename T4, typename T5,
11233     typename T6, typename T7, typename T8, typename T9, typename T10,
11234     typename T11, typename T12, typename T13, typename T14, typename T15,
11235     typename T16, typename T17>
11236 class ValueArray17 {
11237  public:
11238   ValueArray17(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
11239       T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16,
11240       T17 v17) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7),
11241       v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v14),
11242       v15_(v15), v16_(v16), v17_(v17) {}
11243
11244   template <typename T>
11245   operator ParamGenerator<T>() const {
11246     const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
11247         static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
11248         static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
11249         static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
11250         static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
11251         static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_)};
11252     return ValuesIn(array);
11253   }
11254
11255  private:
11256   // No implementation - assignment is unsupported.
11257   void operator=(const ValueArray17& other);
11258
11259   const T1 v1_;
11260   const T2 v2_;
11261   const T3 v3_;
11262   const T4 v4_;
11263   const T5 v5_;
11264   const T6 v6_;
11265   const T7 v7_;
11266   const T8 v8_;
11267   const T9 v9_;
11268   const T10 v10_;
11269   const T11 v11_;
11270   const T12 v12_;
11271   const T13 v13_;
11272   const T14 v14_;
11273   const T15 v15_;
11274   const T16 v16_;
11275   const T17 v17_;
11276 };
11277
11278 template <typename T1, typename T2, typename T3, typename T4, typename T5,
11279     typename T6, typename T7, typename T8, typename T9, typename T10,
11280     typename T11, typename T12, typename T13, typename T14, typename T15,
11281     typename T16, typename T17, typename T18>
11282 class ValueArray18 {
11283  public:
11284   ValueArray18(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
11285       T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
11286       T18 v18) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7),
11287       v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v14),
11288       v15_(v15), v16_(v16), v17_(v17), v18_(v18) {}
11289
11290   template <typename T>
11291   operator ParamGenerator<T>() const {
11292     const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
11293         static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
11294         static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
11295         static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
11296         static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
11297         static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
11298         static_cast<T>(v18_)};
11299     return ValuesIn(array);
11300   }
11301
11302  private:
11303   // No implementation - assignment is unsupported.
11304   void operator=(const ValueArray18& other);
11305
11306   const T1 v1_;
11307   const T2 v2_;
11308   const T3 v3_;
11309   const T4 v4_;
11310   const T5 v5_;
11311   const T6 v6_;
11312   const T7 v7_;
11313   const T8 v8_;
11314   const T9 v9_;
11315   const T10 v10_;
11316   const T11 v11_;
11317   const T12 v12_;
11318   const T13 v13_;
11319   const T14 v14_;
11320   const T15 v15_;
11321   const T16 v16_;
11322   const T17 v17_;
11323   const T18 v18_;
11324 };
11325
11326 template <typename T1, typename T2, typename T3, typename T4, typename T5,
11327     typename T6, typename T7, typename T8, typename T9, typename T10,
11328     typename T11, typename T12, typename T13, typename T14, typename T15,
11329     typename T16, typename T17, typename T18, typename T19>
11330 class ValueArray19 {
11331  public:
11332   ValueArray19(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
11333       T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
11334       T18 v18, T19 v19) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6),
11335       v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13),
11336       v14_(v14), v15_(v15), v16_(v16), v17_(v17), v18_(v18), v19_(v19) {}
11337
11338   template <typename T>
11339   operator ParamGenerator<T>() const {
11340     const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
11341         static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
11342         static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
11343         static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
11344         static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
11345         static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
11346         static_cast<T>(v18_), static_cast<T>(v19_)};
11347     return ValuesIn(array);
11348   }
11349
11350  private:
11351   // No implementation - assignment is unsupported.
11352   void operator=(const ValueArray19& other);
11353
11354   const T1 v1_;
11355   const T2 v2_;
11356   const T3 v3_;
11357   const T4 v4_;
11358   const T5 v5_;
11359   const T6 v6_;
11360   const T7 v7_;
11361   const T8 v8_;
11362   const T9 v9_;
11363   const T10 v10_;
11364   const T11 v11_;
11365   const T12 v12_;
11366   const T13 v13_;
11367   const T14 v14_;
11368   const T15 v15_;
11369   const T16 v16_;
11370   const T17 v17_;
11371   const T18 v18_;
11372   const T19 v19_;
11373 };
11374
11375 template <typename T1, typename T2, typename T3, typename T4, typename T5,
11376     typename T6, typename T7, typename T8, typename T9, typename T10,
11377     typename T11, typename T12, typename T13, typename T14, typename T15,
11378     typename T16, typename T17, typename T18, typename T19, typename T20>
11379 class ValueArray20 {
11380  public:
11381   ValueArray20(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
11382       T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
11383       T18 v18, T19 v19, T20 v20) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5),
11384       v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12),
11385       v13_(v13), v14_(v14), v15_(v15), v16_(v16), v17_(v17), v18_(v18),
11386       v19_(v19), v20_(v20) {}
11387
11388   template <typename T>
11389   operator ParamGenerator<T>() const {
11390     const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
11391         static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
11392         static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
11393         static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
11394         static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
11395         static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
11396         static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_)};
11397     return ValuesIn(array);
11398   }
11399
11400  private:
11401   // No implementation - assignment is unsupported.
11402   void operator=(const ValueArray20& other);
11403
11404   const T1 v1_;
11405   const T2 v2_;
11406   const T3 v3_;
11407   const T4 v4_;
11408   const T5 v5_;
11409   const T6 v6_;
11410   const T7 v7_;
11411   const T8 v8_;
11412   const T9 v9_;
11413   const T10 v10_;
11414   const T11 v11_;
11415   const T12 v12_;
11416   const T13 v13_;
11417   const T14 v14_;
11418   const T15 v15_;
11419   const T16 v16_;
11420   const T17 v17_;
11421   const T18 v18_;
11422   const T19 v19_;
11423   const T20 v20_;
11424 };
11425
11426 template <typename T1, typename T2, typename T3, typename T4, typename T5,
11427     typename T6, typename T7, typename T8, typename T9, typename T10,
11428     typename T11, typename T12, typename T13, typename T14, typename T15,
11429     typename T16, typename T17, typename T18, typename T19, typename T20,
11430     typename T21>
11431 class ValueArray21 {
11432  public:
11433   ValueArray21(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
11434       T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
11435       T18 v18, T19 v19, T20 v20, T21 v21) : v1_(v1), v2_(v2), v3_(v3), v4_(v4),
11436       v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11),
11437       v12_(v12), v13_(v13), v14_(v14), v15_(v15), v16_(v16), v17_(v17),
11438       v18_(v18), v19_(v19), v20_(v20), v21_(v21) {}
11439
11440   template <typename T>
11441   operator ParamGenerator<T>() const {
11442     const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
11443         static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
11444         static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
11445         static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
11446         static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
11447         static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
11448         static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
11449         static_cast<T>(v21_)};
11450     return ValuesIn(array);
11451   }
11452
11453  private:
11454   // No implementation - assignment is unsupported.
11455   void operator=(const ValueArray21& other);
11456
11457   const T1 v1_;
11458   const T2 v2_;
11459   const T3 v3_;
11460   const T4 v4_;
11461   const T5 v5_;
11462   const T6 v6_;
11463   const T7 v7_;
11464   const T8 v8_;
11465   const T9 v9_;
11466   const T10 v10_;
11467   const T11 v11_;
11468   const T12 v12_;
11469   const T13 v13_;
11470   const T14 v14_;
11471   const T15 v15_;
11472   const T16 v16_;
11473   const T17 v17_;
11474   const T18 v18_;
11475   const T19 v19_;
11476   const T20 v20_;
11477   const T21 v21_;
11478 };
11479
11480 template <typename T1, typename T2, typename T3, typename T4, typename T5,
11481     typename T6, typename T7, typename T8, typename T9, typename T10,
11482     typename T11, typename T12, typename T13, typename T14, typename T15,
11483     typename T16, typename T17, typename T18, typename T19, typename T20,
11484     typename T21, typename T22>
11485 class ValueArray22 {
11486  public:
11487   ValueArray22(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
11488       T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
11489       T18 v18, T19 v19, T20 v20, T21 v21, T22 v22) : v1_(v1), v2_(v2), v3_(v3),
11490       v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10),
11491       v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15), v16_(v16),
11492       v17_(v17), v18_(v18), v19_(v19), v20_(v20), v21_(v21), v22_(v22) {}
11493
11494   template <typename T>
11495   operator ParamGenerator<T>() const {
11496     const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
11497         static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
11498         static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
11499         static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
11500         static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
11501         static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
11502         static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
11503         static_cast<T>(v21_), static_cast<T>(v22_)};
11504     return ValuesIn(array);
11505   }
11506
11507  private:
11508   // No implementation - assignment is unsupported.
11509   void operator=(const ValueArray22& other);
11510
11511   const T1 v1_;
11512   const T2 v2_;
11513   const T3 v3_;
11514   const T4 v4_;
11515   const T5 v5_;
11516   const T6 v6_;
11517   const T7 v7_;
11518   const T8 v8_;
11519   const T9 v9_;
11520   const T10 v10_;
11521   const T11 v11_;
11522   const T12 v12_;
11523   const T13 v13_;
11524   const T14 v14_;
11525   const T15 v15_;
11526   const T16 v16_;
11527   const T17 v17_;
11528   const T18 v18_;
11529   const T19 v19_;
11530   const T20 v20_;
11531   const T21 v21_;
11532   const T22 v22_;
11533 };
11534
11535 template <typename T1, typename T2, typename T3, typename T4, typename T5,
11536     typename T6, typename T7, typename T8, typename T9, typename T10,
11537     typename T11, typename T12, typename T13, typename T14, typename T15,
11538     typename T16, typename T17, typename T18, typename T19, typename T20,
11539     typename T21, typename T22, typename T23>
11540 class ValueArray23 {
11541  public:
11542   ValueArray23(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
11543       T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
11544       T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23) : v1_(v1), v2_(v2),
11545       v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10),
11546       v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15), v16_(v16),
11547       v17_(v17), v18_(v18), v19_(v19), v20_(v20), v21_(v21), v22_(v22),
11548       v23_(v23) {}
11549
11550   template <typename T>
11551   operator ParamGenerator<T>() const {
11552     const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
11553         static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
11554         static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
11555         static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
11556         static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
11557         static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
11558         static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
11559         static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_)};
11560     return ValuesIn(array);
11561   }
11562
11563  private:
11564   // No implementation - assignment is unsupported.
11565   void operator=(const ValueArray23& other);
11566
11567   const T1 v1_;
11568   const T2 v2_;
11569   const T3 v3_;
11570   const T4 v4_;
11571   const T5 v5_;
11572   const T6 v6_;
11573   const T7 v7_;
11574   const T8 v8_;
11575   const T9 v9_;
11576   const T10 v10_;
11577   const T11 v11_;
11578   const T12 v12_;
11579   const T13 v13_;
11580   const T14 v14_;
11581   const T15 v15_;
11582   const T16 v16_;
11583   const T17 v17_;
11584   const T18 v18_;
11585   const T19 v19_;
11586   const T20 v20_;
11587   const T21 v21_;
11588   const T22 v22_;
11589   const T23 v23_;
11590 };
11591
11592 template <typename T1, typename T2, typename T3, typename T4, typename T5,
11593     typename T6, typename T7, typename T8, typename T9, typename T10,
11594     typename T11, typename T12, typename T13, typename T14, typename T15,
11595     typename T16, typename T17, typename T18, typename T19, typename T20,
11596     typename T21, typename T22, typename T23, typename T24>
11597 class ValueArray24 {
11598  public:
11599   ValueArray24(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
11600       T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
11601       T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24) : v1_(v1),
11602       v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9),
11603       v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15),
11604       v16_(v16), v17_(v17), v18_(v18), v19_(v19), v20_(v20), v21_(v21),
11605       v22_(v22), v23_(v23), v24_(v24) {}
11606
11607   template <typename T>
11608   operator ParamGenerator<T>() const {
11609     const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
11610         static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
11611         static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
11612         static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
11613         static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
11614         static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
11615         static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
11616         static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
11617         static_cast<T>(v24_)};
11618     return ValuesIn(array);
11619   }
11620
11621  private:
11622   // No implementation - assignment is unsupported.
11623   void operator=(const ValueArray24& other);
11624
11625   const T1 v1_;
11626   const T2 v2_;
11627   const T3 v3_;
11628   const T4 v4_;
11629   const T5 v5_;
11630   const T6 v6_;
11631   const T7 v7_;
11632   const T8 v8_;
11633   const T9 v9_;
11634   const T10 v10_;
11635   const T11 v11_;
11636   const T12 v12_;
11637   const T13 v13_;
11638   const T14 v14_;
11639   const T15 v15_;
11640   const T16 v16_;
11641   const T17 v17_;
11642   const T18 v18_;
11643   const T19 v19_;
11644   const T20 v20_;
11645   const T21 v21_;
11646   const T22 v22_;
11647   const T23 v23_;
11648   const T24 v24_;
11649 };
11650
11651 template <typename T1, typename T2, typename T3, typename T4, typename T5,
11652     typename T6, typename T7, typename T8, typename T9, typename T10,
11653     typename T11, typename T12, typename T13, typename T14, typename T15,
11654     typename T16, typename T17, typename T18, typename T19, typename T20,
11655     typename T21, typename T22, typename T23, typename T24, typename T25>
11656 class ValueArray25 {
11657  public:
11658   ValueArray25(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
11659       T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
11660       T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24,
11661       T25 v25) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7),
11662       v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v14),
11663       v15_(v15), v16_(v16), v17_(v17), v18_(v18), v19_(v19), v20_(v20),
11664       v21_(v21), v22_(v22), v23_(v23), v24_(v24), v25_(v25) {}
11665
11666   template <typename T>
11667   operator ParamGenerator<T>() const {
11668     const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
11669         static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
11670         static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
11671         static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
11672         static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
11673         static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
11674         static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
11675         static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
11676         static_cast<T>(v24_), static_cast<T>(v25_)};
11677     return ValuesIn(array);
11678   }
11679
11680  private:
11681   // No implementation - assignment is unsupported.
11682   void operator=(const ValueArray25& other);
11683
11684   const T1 v1_;
11685   const T2 v2_;
11686   const T3 v3_;
11687   const T4 v4_;
11688   const T5 v5_;
11689   const T6 v6_;
11690   const T7 v7_;
11691   const T8 v8_;
11692   const T9 v9_;
11693   const T10 v10_;
11694   const T11 v11_;
11695   const T12 v12_;
11696   const T13 v13_;
11697   const T14 v14_;
11698   const T15 v15_;
11699   const T16 v16_;
11700   const T17 v17_;
11701   const T18 v18_;
11702   const T19 v19_;
11703   const T20 v20_;
11704   const T21 v21_;
11705   const T22 v22_;
11706   const T23 v23_;
11707   const T24 v24_;
11708   const T25 v25_;
11709 };
11710
11711 template <typename T1, typename T2, typename T3, typename T4, typename T5,
11712     typename T6, typename T7, typename T8, typename T9, typename T10,
11713     typename T11, typename T12, typename T13, typename T14, typename T15,
11714     typename T16, typename T17, typename T18, typename T19, typename T20,
11715     typename T21, typename T22, typename T23, typename T24, typename T25,
11716     typename T26>
11717 class ValueArray26 {
11718  public:
11719   ValueArray26(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
11720       T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
11721       T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
11722       T26 v26) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7),
11723       v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v14),
11724       v15_(v15), v16_(v16), v17_(v17), v18_(v18), v19_(v19), v20_(v20),
11725       v21_(v21), v22_(v22), v23_(v23), v24_(v24), v25_(v25), v26_(v26) {}
11726
11727   template <typename T>
11728   operator ParamGenerator<T>() const {
11729     const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
11730         static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
11731         static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
11732         static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
11733         static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
11734         static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
11735         static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
11736         static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
11737         static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_)};
11738     return ValuesIn(array);
11739   }
11740
11741  private:
11742   // No implementation - assignment is unsupported.
11743   void operator=(const ValueArray26& other);
11744
11745   const T1 v1_;
11746   const T2 v2_;
11747   const T3 v3_;
11748   const T4 v4_;
11749   const T5 v5_;
11750   const T6 v6_;
11751   const T7 v7_;
11752   const T8 v8_;
11753   const T9 v9_;
11754   const T10 v10_;
11755   const T11 v11_;
11756   const T12 v12_;
11757   const T13 v13_;
11758   const T14 v14_;
11759   const T15 v15_;
11760   const T16 v16_;
11761   const T17 v17_;
11762   const T18 v18_;
11763   const T19 v19_;
11764   const T20 v20_;
11765   const T21 v21_;
11766   const T22 v22_;
11767   const T23 v23_;
11768   const T24 v24_;
11769   const T25 v25_;
11770   const T26 v26_;
11771 };
11772
11773 template <typename T1, typename T2, typename T3, typename T4, typename T5,
11774     typename T6, typename T7, typename T8, typename T9, typename T10,
11775     typename T11, typename T12, typename T13, typename T14, typename T15,
11776     typename T16, typename T17, typename T18, typename T19, typename T20,
11777     typename T21, typename T22, typename T23, typename T24, typename T25,
11778     typename T26, typename T27>
11779 class ValueArray27 {
11780  public:
11781   ValueArray27(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
11782       T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
11783       T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
11784       T26 v26, T27 v27) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6),
11785       v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13),
11786       v14_(v14), v15_(v15), v16_(v16), v17_(v17), v18_(v18), v19_(v19),
11787       v20_(v20), v21_(v21), v22_(v22), v23_(v23), v24_(v24), v25_(v25),
11788       v26_(v26), v27_(v27) {}
11789
11790   template <typename T>
11791   operator ParamGenerator<T>() const {
11792     const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
11793         static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
11794         static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
11795         static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
11796         static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
11797         static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
11798         static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
11799         static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
11800         static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),
11801         static_cast<T>(v27_)};
11802     return ValuesIn(array);
11803   }
11804
11805  private:
11806   // No implementation - assignment is unsupported.
11807   void operator=(const ValueArray27& other);
11808
11809   const T1 v1_;
11810   const T2 v2_;
11811   const T3 v3_;
11812   const T4 v4_;
11813   const T5 v5_;
11814   const T6 v6_;
11815   const T7 v7_;
11816   const T8 v8_;
11817   const T9 v9_;
11818   const T10 v10_;
11819   const T11 v11_;
11820   const T12 v12_;
11821   const T13 v13_;
11822   const T14 v14_;
11823   const T15 v15_;
11824   const T16 v16_;
11825   const T17 v17_;
11826   const T18 v18_;
11827   const T19 v19_;
11828   const T20 v20_;
11829   const T21 v21_;
11830   const T22 v22_;
11831   const T23 v23_;
11832   const T24 v24_;
11833   const T25 v25_;
11834   const T26 v26_;
11835   const T27 v27_;
11836 };
11837
11838 template <typename T1, typename T2, typename T3, typename T4, typename T5,
11839     typename T6, typename T7, typename T8, typename T9, typename T10,
11840     typename T11, typename T12, typename T13, typename T14, typename T15,
11841     typename T16, typename T17, typename T18, typename T19, typename T20,
11842     typename T21, typename T22, typename T23, typename T24, typename T25,
11843     typename T26, typename T27, typename T28>
11844 class ValueArray28 {
11845  public:
11846   ValueArray28(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
11847       T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
11848       T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
11849       T26 v26, T27 v27, T28 v28) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5),
11850       v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12),
11851       v13_(v13), v14_(v14), v15_(v15), v16_(v16), v17_(v17), v18_(v18),
11852       v19_(v19), v20_(v20), v21_(v21), v22_(v22), v23_(v23), v24_(v24),
11853       v25_(v25), v26_(v26), v27_(v27), v28_(v28) {}
11854
11855   template <typename T>
11856   operator ParamGenerator<T>() const {
11857     const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
11858         static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
11859         static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
11860         static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
11861         static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
11862         static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
11863         static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
11864         static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
11865         static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),
11866         static_cast<T>(v27_), static_cast<T>(v28_)};
11867     return ValuesIn(array);
11868   }
11869
11870  private:
11871   // No implementation - assignment is unsupported.
11872   void operator=(const ValueArray28& other);
11873
11874   const T1 v1_;
11875   const T2 v2_;
11876   const T3 v3_;
11877   const T4 v4_;
11878   const T5 v5_;
11879   const T6 v6_;
11880   const T7 v7_;
11881   const T8 v8_;
11882   const T9 v9_;
11883   const T10 v10_;
11884   const T11 v11_;
11885   const T12 v12_;
11886   const T13 v13_;
11887   const T14 v14_;
11888   const T15 v15_;
11889   const T16 v16_;
11890   const T17 v17_;
11891   const T18 v18_;
11892   const T19 v19_;
11893   const T20 v20_;
11894   const T21 v21_;
11895   const T22 v22_;
11896   const T23 v23_;
11897   const T24 v24_;
11898   const T25 v25_;
11899   const T26 v26_;
11900   const T27 v27_;
11901   const T28 v28_;
11902 };
11903
11904 template <typename T1, typename T2, typename T3, typename T4, typename T5,
11905     typename T6, typename T7, typename T8, typename T9, typename T10,
11906     typename T11, typename T12, typename T13, typename T14, typename T15,
11907     typename T16, typename T17, typename T18, typename T19, typename T20,
11908     typename T21, typename T22, typename T23, typename T24, typename T25,
11909     typename T26, typename T27, typename T28, typename T29>
11910 class ValueArray29 {
11911  public:
11912   ValueArray29(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
11913       T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
11914       T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
11915       T26 v26, T27 v27, T28 v28, T29 v29) : v1_(v1), v2_(v2), v3_(v3), v4_(v4),
11916       v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11),
11917       v12_(v12), v13_(v13), v14_(v14), v15_(v15), v16_(v16), v17_(v17),
11918       v18_(v18), v19_(v19), v20_(v20), v21_(v21), v22_(v22), v23_(v23),
11919       v24_(v24), v25_(v25), v26_(v26), v27_(v27), v28_(v28), v29_(v29) {}
11920
11921   template <typename T>
11922   operator ParamGenerator<T>() const {
11923     const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
11924         static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
11925         static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
11926         static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
11927         static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
11928         static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
11929         static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
11930         static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
11931         static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),
11932         static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_)};
11933     return ValuesIn(array);
11934   }
11935
11936  private:
11937   // No implementation - assignment is unsupported.
11938   void operator=(const ValueArray29& other);
11939
11940   const T1 v1_;
11941   const T2 v2_;
11942   const T3 v3_;
11943   const T4 v4_;
11944   const T5 v5_;
11945   const T6 v6_;
11946   const T7 v7_;
11947   const T8 v8_;
11948   const T9 v9_;
11949   const T10 v10_;
11950   const T11 v11_;
11951   const T12 v12_;
11952   const T13 v13_;
11953   const T14 v14_;
11954   const T15 v15_;
11955   const T16 v16_;
11956   const T17 v17_;
11957   const T18 v18_;
11958   const T19 v19_;
11959   const T20 v20_;
11960   const T21 v21_;
11961   const T22 v22_;
11962   const T23 v23_;
11963   const T24 v24_;
11964   const T25 v25_;
11965   const T26 v26_;
11966   const T27 v27_;
11967   const T28 v28_;
11968   const T29 v29_;
11969 };
11970
11971 template <typename T1, typename T2, typename T3, typename T4, typename T5,
11972     typename T6, typename T7, typename T8, typename T9, typename T10,
11973     typename T11, typename T12, typename T13, typename T14, typename T15,
11974     typename T16, typename T17, typename T18, typename T19, typename T20,
11975     typename T21, typename T22, typename T23, typename T24, typename T25,
11976     typename T26, typename T27, typename T28, typename T29, typename T30>
11977 class ValueArray30 {
11978  public:
11979   ValueArray30(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
11980       T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
11981       T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
11982       T26 v26, T27 v27, T28 v28, T29 v29, T30 v30) : v1_(v1), v2_(v2), v3_(v3),
11983       v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10),
11984       v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15), v16_(v16),
11985       v17_(v17), v18_(v18), v19_(v19), v20_(v20), v21_(v21), v22_(v22),
11986       v23_(v23), v24_(v24), v25_(v25), v26_(v26), v27_(v27), v28_(v28),
11987       v29_(v29), v30_(v30) {}
11988
11989   template <typename T>
11990   operator ParamGenerator<T>() const {
11991     const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
11992         static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
11993         static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
11994         static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
11995         static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
11996         static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
11997         static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
11998         static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
11999         static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),
12000         static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_),
12001         static_cast<T>(v30_)};
12002     return ValuesIn(array);
12003   }
12004
12005  private:
12006   // No implementation - assignment is unsupported.
12007   void operator=(const ValueArray30& other);
12008
12009   const T1 v1_;
12010   const T2 v2_;
12011   const T3 v3_;
12012   const T4 v4_;
12013   const T5 v5_;
12014   const T6 v6_;
12015   const T7 v7_;
12016   const T8 v8_;
12017   const T9 v9_;
12018   const T10 v10_;
12019   const T11 v11_;
12020   const T12 v12_;
12021   const T13 v13_;
12022   const T14 v14_;
12023   const T15 v15_;
12024   const T16 v16_;
12025   const T17 v17_;
12026   const T18 v18_;
12027   const T19 v19_;
12028   const T20 v20_;
12029   const T21 v21_;
12030   const T22 v22_;
12031   const T23 v23_;
12032   const T24 v24_;
12033   const T25 v25_;
12034   const T26 v26_;
12035   const T27 v27_;
12036   const T28 v28_;
12037   const T29 v29_;
12038   const T30 v30_;
12039 };
12040
12041 template <typename T1, typename T2, typename T3, typename T4, typename T5,
12042     typename T6, typename T7, typename T8, typename T9, typename T10,
12043     typename T11, typename T12, typename T13, typename T14, typename T15,
12044     typename T16, typename T17, typename T18, typename T19, typename T20,
12045     typename T21, typename T22, typename T23, typename T24, typename T25,
12046     typename T26, typename T27, typename T28, typename T29, typename T30,
12047     typename T31>
12048 class ValueArray31 {
12049  public:
12050   ValueArray31(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
12051       T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
12052       T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
12053       T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31) : v1_(v1), v2_(v2),
12054       v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10),
12055       v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15), v16_(v16),
12056       v17_(v17), v18_(v18), v19_(v19), v20_(v20), v21_(v21), v22_(v22),
12057       v23_(v23), v24_(v24), v25_(v25), v26_(v26), v27_(v27), v28_(v28),
12058       v29_(v29), v30_(v30), v31_(v31) {}
12059
12060   template <typename T>
12061   operator ParamGenerator<T>() const {
12062     const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
12063         static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
12064         static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
12065         static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
12066         static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
12067         static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
12068         static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
12069         static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
12070         static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),
12071         static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_),
12072         static_cast<T>(v30_), static_cast<T>(v31_)};
12073     return ValuesIn(array);
12074   }
12075
12076  private:
12077   // No implementation - assignment is unsupported.
12078   void operator=(const ValueArray31& other);
12079
12080   const T1 v1_;
12081   const T2 v2_;
12082   const T3 v3_;
12083   const T4 v4_;
12084   const T5 v5_;
12085   const T6 v6_;
12086   const T7 v7_;
12087   const T8 v8_;
12088   const T9 v9_;
12089   const T10 v10_;
12090   const T11 v11_;
12091   const T12 v12_;
12092   const T13 v13_;
12093   const T14 v14_;
12094   const T15 v15_;
12095   const T16 v16_;
12096   const T17 v17_;
12097   const T18 v18_;
12098   const T19 v19_;
12099   const T20 v20_;
12100   const T21 v21_;
12101   const T22 v22_;
12102   const T23 v23_;
12103   const T24 v24_;
12104   const T25 v25_;
12105   const T26 v26_;
12106   const T27 v27_;
12107   const T28 v28_;
12108   const T29 v29_;
12109   const T30 v30_;
12110   const T31 v31_;
12111 };
12112
12113 template <typename T1, typename T2, typename T3, typename T4, typename T5,
12114     typename T6, typename T7, typename T8, typename T9, typename T10,
12115     typename T11, typename T12, typename T13, typename T14, typename T15,
12116     typename T16, typename T17, typename T18, typename T19, typename T20,
12117     typename T21, typename T22, typename T23, typename T24, typename T25,
12118     typename T26, typename T27, typename T28, typename T29, typename T30,
12119     typename T31, typename T32>
12120 class ValueArray32 {
12121  public:
12122   ValueArray32(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
12123       T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
12124       T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
12125       T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32) : v1_(v1),
12126       v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9),
12127       v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15),
12128       v16_(v16), v17_(v17), v18_(v18), v19_(v19), v20_(v20), v21_(v21),
12129       v22_(v22), v23_(v23), v24_(v24), v25_(v25), v26_(v26), v27_(v27),
12130       v28_(v28), v29_(v29), v30_(v30), v31_(v31), v32_(v32) {}
12131
12132   template <typename T>
12133   operator ParamGenerator<T>() const {
12134     const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
12135         static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
12136         static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
12137         static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
12138         static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
12139         static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
12140         static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
12141         static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
12142         static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),
12143         static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_),
12144         static_cast<T>(v30_), static_cast<T>(v31_), static_cast<T>(v32_)};
12145     return ValuesIn(array);
12146   }
12147
12148  private:
12149   // No implementation - assignment is unsupported.
12150   void operator=(const ValueArray32& other);
12151
12152   const T1 v1_;
12153   const T2 v2_;
12154   const T3 v3_;
12155   const T4 v4_;
12156   const T5 v5_;
12157   const T6 v6_;
12158   const T7 v7_;
12159   const T8 v8_;
12160   const T9 v9_;
12161   const T10 v10_;
12162   const T11 v11_;
12163   const T12 v12_;
12164   const T13 v13_;
12165   const T14 v14_;
12166   const T15 v15_;
12167   const T16 v16_;
12168   const T17 v17_;
12169   const T18 v18_;
12170   const T19 v19_;
12171   const T20 v20_;
12172   const T21 v21_;
12173   const T22 v22_;
12174   const T23 v23_;
12175   const T24 v24_;
12176   const T25 v25_;
12177   const T26 v26_;
12178   const T27 v27_;
12179   const T28 v28_;
12180   const T29 v29_;
12181   const T30 v30_;
12182   const T31 v31_;
12183   const T32 v32_;
12184 };
12185
12186 template <typename T1, typename T2, typename T3, typename T4, typename T5,
12187     typename T6, typename T7, typename T8, typename T9, typename T10,
12188     typename T11, typename T12, typename T13, typename T14, typename T15,
12189     typename T16, typename T17, typename T18, typename T19, typename T20,
12190     typename T21, typename T22, typename T23, typename T24, typename T25,
12191     typename T26, typename T27, typename T28, typename T29, typename T30,
12192     typename T31, typename T32, typename T33>
12193 class ValueArray33 {
12194  public:
12195   ValueArray33(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
12196       T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
12197       T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
12198       T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32,
12199       T33 v33) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7),
12200       v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v14),
12201       v15_(v15), v16_(v16), v17_(v17), v18_(v18), v19_(v19), v20_(v20),
12202       v21_(v21), v22_(v22), v23_(v23), v24_(v24), v25_(v25), v26_(v26),
12203       v27_(v27), v28_(v28), v29_(v29), v30_(v30), v31_(v31), v32_(v32),
12204       v33_(v33) {}
12205
12206   template <typename T>
12207   operator ParamGenerator<T>() const {
12208     const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
12209         static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
12210         static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
12211         static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
12212         static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
12213         static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
12214         static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
12215         static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
12216         static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),
12217         static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_),
12218         static_cast<T>(v30_), static_cast<T>(v31_), static_cast<T>(v32_),
12219         static_cast<T>(v33_)};
12220     return ValuesIn(array);
12221   }
12222
12223  private:
12224   // No implementation - assignment is unsupported.
12225   void operator=(const ValueArray33& other);
12226
12227   const T1 v1_;
12228   const T2 v2_;
12229   const T3 v3_;
12230   const T4 v4_;
12231   const T5 v5_;
12232   const T6 v6_;
12233   const T7 v7_;
12234   const T8 v8_;
12235   const T9 v9_;
12236   const T10 v10_;
12237   const T11 v11_;
12238   const T12 v12_;
12239   const T13 v13_;
12240   const T14 v14_;
12241   const T15 v15_;
12242   const T16 v16_;
12243   const T17 v17_;
12244   const T18 v18_;
12245   const T19 v19_;
12246   const T20 v20_;
12247   const T21 v21_;
12248   const T22 v22_;
12249   const T23 v23_;
12250   const T24 v24_;
12251   const T25 v25_;
12252   const T26 v26_;
12253   const T27 v27_;
12254   const T28 v28_;
12255   const T29 v29_;
12256   const T30 v30_;
12257   const T31 v31_;
12258   const T32 v32_;
12259   const T33 v33_;
12260 };
12261
12262 template <typename T1, typename T2, typename T3, typename T4, typename T5,
12263     typename T6, typename T7, typename T8, typename T9, typename T10,
12264     typename T11, typename T12, typename T13, typename T14, typename T15,
12265     typename T16, typename T17, typename T18, typename T19, typename T20,
12266     typename T21, typename T22, typename T23, typename T24, typename T25,
12267     typename T26, typename T27, typename T28, typename T29, typename T30,
12268     typename T31, typename T32, typename T33, typename T34>
12269 class ValueArray34 {
12270  public:
12271   ValueArray34(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
12272       T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
12273       T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
12274       T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33,
12275       T34 v34) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7),
12276       v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v14),
12277       v15_(v15), v16_(v16), v17_(v17), v18_(v18), v19_(v19), v20_(v20),
12278       v21_(v21), v22_(v22), v23_(v23), v24_(v24), v25_(v25), v26_(v26),
12279       v27_(v27), v28_(v28), v29_(v29), v30_(v30), v31_(v31), v32_(v32),
12280       v33_(v33), v34_(v34) {}
12281
12282   template <typename T>
12283   operator ParamGenerator<T>() const {
12284     const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
12285         static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
12286         static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
12287         static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
12288         static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
12289         static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
12290         static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
12291         static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
12292         static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),
12293         static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_),
12294         static_cast<T>(v30_), static_cast<T>(v31_), static_cast<T>(v32_),
12295         static_cast<T>(v33_), static_cast<T>(v34_)};
12296     return ValuesIn(array);
12297   }
12298
12299  private:
12300   // No implementation - assignment is unsupported.
12301   void operator=(const ValueArray34& other);
12302
12303   const T1 v1_;
12304   const T2 v2_;
12305   const T3 v3_;
12306   const T4 v4_;
12307   const T5 v5_;
12308   const T6 v6_;
12309   const T7 v7_;
12310   const T8 v8_;
12311   const T9 v9_;
12312   const T10 v10_;
12313   const T11 v11_;
12314   const T12 v12_;
12315   const T13 v13_;
12316   const T14 v14_;
12317   const T15 v15_;
12318   const T16 v16_;
12319   const T17 v17_;
12320   const T18 v18_;
12321   const T19 v19_;
12322   const T20 v20_;
12323   const T21 v21_;
12324   const T22 v22_;
12325   const T23 v23_;
12326   const T24 v24_;
12327   const T25 v25_;
12328   const T26 v26_;
12329   const T27 v27_;
12330   const T28 v28_;
12331   const T29 v29_;
12332   const T30 v30_;
12333   const T31 v31_;
12334   const T32 v32_;
12335   const T33 v33_;
12336   const T34 v34_;
12337 };
12338
12339 template <typename T1, typename T2, typename T3, typename T4, typename T5,
12340     typename T6, typename T7, typename T8, typename T9, typename T10,
12341     typename T11, typename T12, typename T13, typename T14, typename T15,
12342     typename T16, typename T17, typename T18, typename T19, typename T20,
12343     typename T21, typename T22, typename T23, typename T24, typename T25,
12344     typename T26, typename T27, typename T28, typename T29, typename T30,
12345     typename T31, typename T32, typename T33, typename T34, typename T35>
12346 class ValueArray35 {
12347  public:
12348   ValueArray35(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
12349       T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
12350       T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
12351       T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33,
12352       T34 v34, T35 v35) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6),
12353       v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13),
12354       v14_(v14), v15_(v15), v16_(v16), v17_(v17), v18_(v18), v19_(v19),
12355       v20_(v20), v21_(v21), v22_(v22), v23_(v23), v24_(v24), v25_(v25),
12356       v26_(v26), v27_(v27), v28_(v28), v29_(v29), v30_(v30), v31_(v31),
12357       v32_(v32), v33_(v33), v34_(v34), v35_(v35) {}
12358
12359   template <typename T>
12360   operator ParamGenerator<T>() const {
12361     const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
12362         static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
12363         static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
12364         static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
12365         static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
12366         static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
12367         static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
12368         static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
12369         static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),
12370         static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_),
12371         static_cast<T>(v30_), static_cast<T>(v31_), static_cast<T>(v32_),
12372         static_cast<T>(v33_), static_cast<T>(v34_), static_cast<T>(v35_)};
12373     return ValuesIn(array);
12374   }
12375
12376  private:
12377   // No implementation - assignment is unsupported.
12378   void operator=(const ValueArray35& other);
12379
12380   const T1 v1_;
12381   const T2 v2_;
12382   const T3 v3_;
12383   const T4 v4_;
12384   const T5 v5_;
12385   const T6 v6_;
12386   const T7 v7_;
12387   const T8 v8_;
12388   const T9 v9_;
12389   const T10 v10_;
12390   const T11 v11_;
12391   const T12 v12_;
12392   const T13 v13_;
12393   const T14 v14_;
12394   const T15 v15_;
12395   const T16 v16_;
12396   const T17 v17_;
12397   const T18 v18_;
12398   const T19 v19_;
12399   const T20 v20_;
12400   const T21 v21_;
12401   const T22 v22_;
12402   const T23 v23_;
12403   const T24 v24_;
12404   const T25 v25_;
12405   const T26 v26_;
12406   const T27 v27_;
12407   const T28 v28_;
12408   const T29 v29_;
12409   const T30 v30_;
12410   const T31 v31_;
12411   const T32 v32_;
12412   const T33 v33_;
12413   const T34 v34_;
12414   const T35 v35_;
12415 };
12416
12417 template <typename T1, typename T2, typename T3, typename T4, typename T5,
12418     typename T6, typename T7, typename T8, typename T9, typename T10,
12419     typename T11, typename T12, typename T13, typename T14, typename T15,
12420     typename T16, typename T17, typename T18, typename T19, typename T20,
12421     typename T21, typename T22, typename T23, typename T24, typename T25,
12422     typename T26, typename T27, typename T28, typename T29, typename T30,
12423     typename T31, typename T32, typename T33, typename T34, typename T35,
12424     typename T36>
12425 class ValueArray36 {
12426  public:
12427   ValueArray36(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
12428       T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
12429       T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
12430       T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33,
12431       T34 v34, T35 v35, T36 v36) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5),
12432       v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12),
12433       v13_(v13), v14_(v14), v15_(v15), v16_(v16), v17_(v17), v18_(v18),
12434       v19_(v19), v20_(v20), v21_(v21), v22_(v22), v23_(v23), v24_(v24),
12435       v25_(v25), v26_(v26), v27_(v27), v28_(v28), v29_(v29), v30_(v30),
12436       v31_(v31), v32_(v32), v33_(v33), v34_(v34), v35_(v35), v36_(v36) {}
12437
12438   template <typename T>
12439   operator ParamGenerator<T>() const {
12440     const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
12441         static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
12442         static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
12443         static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
12444         static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
12445         static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
12446         static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
12447         static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
12448         static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),
12449         static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_),
12450         static_cast<T>(v30_), static_cast<T>(v31_), static_cast<T>(v32_),
12451         static_cast<T>(v33_), static_cast<T>(v34_), static_cast<T>(v35_),
12452         static_cast<T>(v36_)};
12453     return ValuesIn(array);
12454   }
12455
12456  private:
12457   // No implementation - assignment is unsupported.
12458   void operator=(const ValueArray36& other);
12459
12460   const T1 v1_;
12461   const T2 v2_;
12462   const T3 v3_;
12463   const T4 v4_;
12464   const T5 v5_;
12465   const T6 v6_;
12466   const T7 v7_;
12467   const T8 v8_;
12468   const T9 v9_;
12469   const T10 v10_;
12470   const T11 v11_;
12471   const T12 v12_;
12472   const T13 v13_;
12473   const T14 v14_;
12474   const T15 v15_;
12475   const T16 v16_;
12476   const T17 v17_;
12477   const T18 v18_;
12478   const T19 v19_;
12479   const T20 v20_;
12480   const T21 v21_;
12481   const T22 v22_;
12482   const T23 v23_;
12483   const T24 v24_;
12484   const T25 v25_;
12485   const T26 v26_;
12486   const T27 v27_;
12487   const T28 v28_;
12488   const T29 v29_;
12489   const T30 v30_;
12490   const T31 v31_;
12491   const T32 v32_;
12492   const T33 v33_;
12493   const T34 v34_;
12494   const T35 v35_;
12495   const T36 v36_;
12496 };
12497
12498 template <typename T1, typename T2, typename T3, typename T4, typename T5,
12499     typename T6, typename T7, typename T8, typename T9, typename T10,
12500     typename T11, typename T12, typename T13, typename T14, typename T15,
12501     typename T16, typename T17, typename T18, typename T19, typename T20,
12502     typename T21, typename T22, typename T23, typename T24, typename T25,
12503     typename T26, typename T27, typename T28, typename T29, typename T30,
12504     typename T31, typename T32, typename T33, typename T34, typename T35,
12505     typename T36, typename T37>
12506 class ValueArray37 {
12507  public:
12508   ValueArray37(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
12509       T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
12510       T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
12511       T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33,
12512       T34 v34, T35 v35, T36 v36, T37 v37) : v1_(v1), v2_(v2), v3_(v3), v4_(v4),
12513       v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11),
12514       v12_(v12), v13_(v13), v14_(v14), v15_(v15), v16_(v16), v17_(v17),
12515       v18_(v18), v19_(v19), v20_(v20), v21_(v21), v22_(v22), v23_(v23),
12516       v24_(v24), v25_(v25), v26_(v26), v27_(v27), v28_(v28), v29_(v29),
12517       v30_(v30), v31_(v31), v32_(v32), v33_(v33), v34_(v34), v35_(v35),
12518       v36_(v36), v37_(v37) {}
12519
12520   template <typename T>
12521   operator ParamGenerator<T>() const {
12522     const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
12523         static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
12524         static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
12525         static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
12526         static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
12527         static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
12528         static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
12529         static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
12530         static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),
12531         static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_),
12532         static_cast<T>(v30_), static_cast<T>(v31_), static_cast<T>(v32_),
12533         static_cast<T>(v33_), static_cast<T>(v34_), static_cast<T>(v35_),
12534         static_cast<T>(v36_), static_cast<T>(v37_)};
12535     return ValuesIn(array);
12536   }
12537
12538  private:
12539   // No implementation - assignment is unsupported.
12540   void operator=(const ValueArray37& other);
12541
12542   const T1 v1_;
12543   const T2 v2_;
12544   const T3 v3_;
12545   const T4 v4_;
12546   const T5 v5_;
12547   const T6 v6_;
12548   const T7 v7_;
12549   const T8 v8_;
12550   const T9 v9_;
12551   const T10 v10_;
12552   const T11 v11_;
12553   const T12 v12_;
12554   const T13 v13_;
12555   const T14 v14_;
12556   const T15 v15_;
12557   const T16 v16_;
12558   const T17 v17_;
12559   const T18 v18_;
12560   const T19 v19_;
12561   const T20 v20_;
12562   const T21 v21_;
12563   const T22 v22_;
12564   const T23 v23_;
12565   const T24 v24_;
12566   const T25 v25_;
12567   const T26 v26_;
12568   const T27 v27_;
12569   const T28 v28_;
12570   const T29 v29_;
12571   const T30 v30_;
12572   const T31 v31_;
12573   const T32 v32_;
12574   const T33 v33_;
12575   const T34 v34_;
12576   const T35 v35_;
12577   const T36 v36_;
12578   const T37 v37_;
12579 };
12580
12581 template <typename T1, typename T2, typename T3, typename T4, typename T5,
12582     typename T6, typename T7, typename T8, typename T9, typename T10,
12583     typename T11, typename T12, typename T13, typename T14, typename T15,
12584     typename T16, typename T17, typename T18, typename T19, typename T20,
12585     typename T21, typename T22, typename T23, typename T24, typename T25,
12586     typename T26, typename T27, typename T28, typename T29, typename T30,
12587     typename T31, typename T32, typename T33, typename T34, typename T35,
12588     typename T36, typename T37, typename T38>
12589 class ValueArray38 {
12590  public:
12591   ValueArray38(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
12592       T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
12593       T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
12594       T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33,
12595       T34 v34, T35 v35, T36 v36, T37 v37, T38 v38) : v1_(v1), v2_(v2), v3_(v3),
12596       v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10),
12597       v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15), v16_(v16),
12598       v17_(v17), v18_(v18), v19_(v19), v20_(v20), v21_(v21), v22_(v22),
12599       v23_(v23), v24_(v24), v25_(v25), v26_(v26), v27_(v27), v28_(v28),
12600       v29_(v29), v30_(v30), v31_(v31), v32_(v32), v33_(v33), v34_(v34),
12601       v35_(v35), v36_(v36), v37_(v37), v38_(v38) {}
12602
12603   template <typename T>
12604   operator ParamGenerator<T>() const {
12605     const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
12606         static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
12607         static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
12608         static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
12609         static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
12610         static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
12611         static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
12612         static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
12613         static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),
12614         static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_),
12615         static_cast<T>(v30_), static_cast<T>(v31_), static_cast<T>(v32_),
12616         static_cast<T>(v33_), static_cast<T>(v34_), static_cast<T>(v35_),
12617         static_cast<T>(v36_), static_cast<T>(v37_), static_cast<T>(v38_)};
12618     return ValuesIn(array);
12619   }
12620
12621  private:
12622   // No implementation - assignment is unsupported.
12623   void operator=(const ValueArray38& other);
12624
12625   const T1 v1_;
12626   const T2 v2_;
12627   const T3 v3_;
12628   const T4 v4_;
12629   const T5 v5_;
12630   const T6 v6_;
12631   const T7 v7_;
12632   const T8 v8_;
12633   const T9 v9_;
12634   const T10 v10_;
12635   const T11 v11_;
12636   const T12 v12_;
12637   const T13 v13_;
12638   const T14 v14_;
12639   const T15 v15_;
12640   const T16 v16_;
12641   const T17 v17_;
12642   const T18 v18_;
12643   const T19 v19_;
12644   const T20 v20_;
12645   const T21 v21_;
12646   const T22 v22_;
12647   const T23 v23_;
12648   const T24 v24_;
12649   const T25 v25_;
12650   const T26 v26_;
12651   const T27 v27_;
12652   const T28 v28_;
12653   const T29 v29_;
12654   const T30 v30_;
12655   const T31 v31_;
12656   const T32 v32_;
12657   const T33 v33_;
12658   const T34 v34_;
12659   const T35 v35_;
12660   const T36 v36_;
12661   const T37 v37_;
12662   const T38 v38_;
12663 };
12664
12665 template <typename T1, typename T2, typename T3, typename T4, typename T5,
12666     typename T6, typename T7, typename T8, typename T9, typename T10,
12667     typename T11, typename T12, typename T13, typename T14, typename T15,
12668     typename T16, typename T17, typename T18, typename T19, typename T20,
12669     typename T21, typename T22, typename T23, typename T24, typename T25,
12670     typename T26, typename T27, typename T28, typename T29, typename T30,
12671     typename T31, typename T32, typename T33, typename T34, typename T35,
12672     typename T36, typename T37, typename T38, typename T39>
12673 class ValueArray39 {
12674  public:
12675   ValueArray39(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
12676       T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
12677       T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
12678       T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33,
12679       T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39) : v1_(v1), v2_(v2),
12680       v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10),
12681       v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15), v16_(v16),
12682       v17_(v17), v18_(v18), v19_(v19), v20_(v20), v21_(v21), v22_(v22),
12683       v23_(v23), v24_(v24), v25_(v25), v26_(v26), v27_(v27), v28_(v28),
12684       v29_(v29), v30_(v30), v31_(v31), v32_(v32), v33_(v33), v34_(v34),
12685       v35_(v35), v36_(v36), v37_(v37), v38_(v38), v39_(v39) {}
12686
12687   template <typename T>
12688   operator ParamGenerator<T>() const {
12689     const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
12690         static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
12691         static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
12692         static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
12693         static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
12694         static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
12695         static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
12696         static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
12697         static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),
12698         static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_),
12699         static_cast<T>(v30_), static_cast<T>(v31_), static_cast<T>(v32_),
12700         static_cast<T>(v33_), static_cast<T>(v34_), static_cast<T>(v35_),
12701         static_cast<T>(v36_), static_cast<T>(v37_), static_cast<T>(v38_),
12702         static_cast<T>(v39_)};
12703     return ValuesIn(array);
12704   }
12705
12706  private:
12707   // No implementation - assignment is unsupported.
12708   void operator=(const ValueArray39& other);
12709
12710   const T1 v1_;
12711   const T2 v2_;
12712   const T3 v3_;
12713   const T4 v4_;
12714   const T5 v5_;
12715   const T6 v6_;
12716   const T7 v7_;
12717   const T8 v8_;
12718   const T9 v9_;
12719   const T10 v10_;
12720   const T11 v11_;
12721   const T12 v12_;
12722   const T13 v13_;
12723   const T14 v14_;
12724   const T15 v15_;
12725   const T16 v16_;
12726   const T17 v17_;
12727   const T18 v18_;
12728   const T19 v19_;
12729   const T20 v20_;
12730   const T21 v21_;
12731   const T22 v22_;
12732   const T23 v23_;
12733   const T24 v24_;
12734   const T25 v25_;
12735   const T26 v26_;
12736   const T27 v27_;
12737   const T28 v28_;
12738   const T29 v29_;
12739   const T30 v30_;
12740   const T31 v31_;
12741   const T32 v32_;
12742   const T33 v33_;
12743   const T34 v34_;
12744   const T35 v35_;
12745   const T36 v36_;
12746   const T37 v37_;
12747   const T38 v38_;
12748   const T39 v39_;
12749 };
12750
12751 template <typename T1, typename T2, typename T3, typename T4, typename T5,
12752     typename T6, typename T7, typename T8, typename T9, typename T10,
12753     typename T11, typename T12, typename T13, typename T14, typename T15,
12754     typename T16, typename T17, typename T18, typename T19, typename T20,
12755     typename T21, typename T22, typename T23, typename T24, typename T25,
12756     typename T26, typename T27, typename T28, typename T29, typename T30,
12757     typename T31, typename T32, typename T33, typename T34, typename T35,
12758     typename T36, typename T37, typename T38, typename T39, typename T40>
12759 class ValueArray40 {
12760  public:
12761   ValueArray40(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
12762       T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
12763       T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
12764       T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33,
12765       T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39, T40 v40) : v1_(v1),
12766       v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9),
12767       v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15),
12768       v16_(v16), v17_(v17), v18_(v18), v19_(v19), v20_(v20), v21_(v21),
12769       v22_(v22), v23_(v23), v24_(v24), v25_(v25), v26_(v26), v27_(v27),
12770       v28_(v28), v29_(v29), v30_(v30), v31_(v31), v32_(v32), v33_(v33),
12771       v34_(v34), v35_(v35), v36_(v36), v37_(v37), v38_(v38), v39_(v39),
12772       v40_(v40) {}
12773
12774   template <typename T>
12775   operator ParamGenerator<T>() const {
12776     const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
12777         static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
12778         static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
12779         static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
12780         static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
12781         static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
12782         static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
12783         static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
12784         static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),
12785         static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_),
12786         static_cast<T>(v30_), static_cast<T>(v31_), static_cast<T>(v32_),
12787         static_cast<T>(v33_), static_cast<T>(v34_), static_cast<T>(v35_),
12788         static_cast<T>(v36_), static_cast<T>(v37_), static_cast<T>(v38_),
12789         static_cast<T>(v39_), static_cast<T>(v40_)};
12790     return ValuesIn(array);
12791   }
12792
12793  private:
12794   // No implementation - assignment is unsupported.
12795   void operator=(const ValueArray40& other);
12796
12797   const T1 v1_;
12798   const T2 v2_;
12799   const T3 v3_;
12800   const T4 v4_;
12801   const T5 v5_;
12802   const T6 v6_;
12803   const T7 v7_;
12804   const T8 v8_;
12805   const T9 v9_;
12806   const T10 v10_;
12807   const T11 v11_;
12808   const T12 v12_;
12809   const T13 v13_;
12810   const T14 v14_;
12811   const T15 v15_;
12812   const T16 v16_;
12813   const T17 v17_;
12814   const T18 v18_;
12815   const T19 v19_;
12816   const T20 v20_;
12817   const T21 v21_;
12818   const T22 v22_;
12819   const T23 v23_;
12820   const T24 v24_;
12821   const T25 v25_;
12822   const T26 v26_;
12823   const T27 v27_;
12824   const T28 v28_;
12825   const T29 v29_;
12826   const T30 v30_;
12827   const T31 v31_;
12828   const T32 v32_;
12829   const T33 v33_;
12830   const T34 v34_;
12831   const T35 v35_;
12832   const T36 v36_;
12833   const T37 v37_;
12834   const T38 v38_;
12835   const T39 v39_;
12836   const T40 v40_;
12837 };
12838
12839 template <typename T1, typename T2, typename T3, typename T4, typename T5,
12840     typename T6, typename T7, typename T8, typename T9, typename T10,
12841     typename T11, typename T12, typename T13, typename T14, typename T15,
12842     typename T16, typename T17, typename T18, typename T19, typename T20,
12843     typename T21, typename T22, typename T23, typename T24, typename T25,
12844     typename T26, typename T27, typename T28, typename T29, typename T30,
12845     typename T31, typename T32, typename T33, typename T34, typename T35,
12846     typename T36, typename T37, typename T38, typename T39, typename T40,
12847     typename T41>
12848 class ValueArray41 {
12849  public:
12850   ValueArray41(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
12851       T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
12852       T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
12853       T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33,
12854       T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39, T40 v40,
12855       T41 v41) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7),
12856       v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v14),
12857       v15_(v15), v16_(v16), v17_(v17), v18_(v18), v19_(v19), v20_(v20),
12858       v21_(v21), v22_(v22), v23_(v23), v24_(v24), v25_(v25), v26_(v26),
12859       v27_(v27), v28_(v28), v29_(v29), v30_(v30), v31_(v31), v32_(v32),
12860       v33_(v33), v34_(v34), v35_(v35), v36_(v36), v37_(v37), v38_(v38),
12861       v39_(v39), v40_(v40), v41_(v41) {}
12862
12863   template <typename T>
12864   operator ParamGenerator<T>() const {
12865     const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
12866         static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
12867         static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
12868         static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
12869         static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
12870         static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
12871         static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
12872         static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
12873         static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),
12874         static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_),
12875         static_cast<T>(v30_), static_cast<T>(v31_), static_cast<T>(v32_),
12876         static_cast<T>(v33_), static_cast<T>(v34_), static_cast<T>(v35_),
12877         static_cast<T>(v36_), static_cast<T>(v37_), static_cast<T>(v38_),
12878         static_cast<T>(v39_), static_cast<T>(v40_), static_cast<T>(v41_)};
12879     return ValuesIn(array);
12880   }
12881
12882  private:
12883   // No implementation - assignment is unsupported.
12884   void operator=(const ValueArray41& other);
12885
12886   const T1 v1_;
12887   const T2 v2_;
12888   const T3 v3_;
12889   const T4 v4_;
12890   const T5 v5_;
12891   const T6 v6_;
12892   const T7 v7_;
12893   const T8 v8_;
12894   const T9 v9_;
12895   const T10 v10_;
12896   const T11 v11_;
12897   const T12 v12_;
12898   const T13 v13_;
12899   const T14 v14_;
12900   const T15 v15_;
12901   const T16 v16_;
12902   const T17 v17_;
12903   const T18 v18_;
12904   const T19 v19_;
12905   const T20 v20_;
12906   const T21 v21_;
12907   const T22 v22_;
12908   const T23 v23_;
12909   const T24 v24_;
12910   const T25 v25_;
12911   const T26 v26_;
12912   const T27 v27_;
12913   const T28 v28_;
12914   const T29 v29_;
12915   const T30 v30_;
12916   const T31 v31_;
12917   const T32 v32_;
12918   const T33 v33_;
12919   const T34 v34_;
12920   const T35 v35_;
12921   const T36 v36_;
12922   const T37 v37_;
12923   const T38 v38_;
12924   const T39 v39_;
12925   const T40 v40_;
12926   const T41 v41_;
12927 };
12928
12929 template <typename T1, typename T2, typename T3, typename T4, typename T5,
12930     typename T6, typename T7, typename T8, typename T9, typename T10,
12931     typename T11, typename T12, typename T13, typename T14, typename T15,
12932     typename T16, typename T17, typename T18, typename T19, typename T20,
12933     typename T21, typename T22, typename T23, typename T24, typename T25,
12934     typename T26, typename T27, typename T28, typename T29, typename T30,
12935     typename T31, typename T32, typename T33, typename T34, typename T35,
12936     typename T36, typename T37, typename T38, typename T39, typename T40,
12937     typename T41, typename T42>
12938 class ValueArray42 {
12939  public:
12940   ValueArray42(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
12941       T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
12942       T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
12943       T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33,
12944       T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39, T40 v40, T41 v41,
12945       T42 v42) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7),
12946       v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v14),
12947       v15_(v15), v16_(v16), v17_(v17), v18_(v18), v19_(v19), v20_(v20),
12948       v21_(v21), v22_(v22), v23_(v23), v24_(v24), v25_(v25), v26_(v26),
12949       v27_(v27), v28_(v28), v29_(v29), v30_(v30), v31_(v31), v32_(v32),
12950       v33_(v33), v34_(v34), v35_(v35), v36_(v36), v37_(v37), v38_(v38),
12951       v39_(v39), v40_(v40), v41_(v41), v42_(v42) {}
12952
12953   template <typename T>
12954   operator ParamGenerator<T>() const {
12955     const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
12956         static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
12957         static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
12958         static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
12959         static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
12960         static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
12961         static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
12962         static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
12963         static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),
12964         static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_),
12965         static_cast<T>(v30_), static_cast<T>(v31_), static_cast<T>(v32_),
12966         static_cast<T>(v33_), static_cast<T>(v34_), static_cast<T>(v35_),
12967         static_cast<T>(v36_), static_cast<T>(v37_), static_cast<T>(v38_),
12968         static_cast<T>(v39_), static_cast<T>(v40_), static_cast<T>(v41_),
12969         static_cast<T>(v42_)};
12970     return ValuesIn(array);
12971   }
12972
12973  private:
12974   // No implementation - assignment is unsupported.
12975   void operator=(const ValueArray42& other);
12976
12977   const T1 v1_;
12978   const T2 v2_;
12979   const T3 v3_;
12980   const T4 v4_;
12981   const T5 v5_;
12982   const T6 v6_;
12983   const T7 v7_;
12984   const T8 v8_;
12985   const T9 v9_;
12986   const T10 v10_;
12987   const T11 v11_;
12988   const T12 v12_;
12989   const T13 v13_;
12990   const T14 v14_;
12991   const T15 v15_;
12992   const T16 v16_;
12993   const T17 v17_;
12994   const T18 v18_;
12995   const T19 v19_;
12996   const T20 v20_;
12997   const T21 v21_;
12998   const T22 v22_;
12999   const T23 v23_;
13000   const T24 v24_;
13001   const T25 v25_;
13002   const T26 v26_;
13003   const T27 v27_;
13004   const T28 v28_;
13005   const T29 v29_;
13006   const T30 v30_;
13007   const T31 v31_;
13008   const T32 v32_;
13009   const T33 v33_;
13010   const T34 v34_;
13011   const T35 v35_;
13012   const T36 v36_;
13013   const T37 v37_;
13014   const T38 v38_;
13015   const T39 v39_;
13016   const T40 v40_;
13017   const T41 v41_;
13018   const T42 v42_;
13019 };
13020
13021 template <typename T1, typename T2, typename T3, typename T4, typename T5,
13022     typename T6, typename T7, typename T8, typename T9, typename T10,
13023     typename T11, typename T12, typename T13, typename T14, typename T15,
13024     typename T16, typename T17, typename T18, typename T19, typename T20,
13025     typename T21, typename T22, typename T23, typename T24, typename T25,
13026     typename T26, typename T27, typename T28, typename T29, typename T30,
13027     typename T31, typename T32, typename T33, typename T34, typename T35,
13028     typename T36, typename T37, typename T38, typename T39, typename T40,
13029     typename T41, typename T42, typename T43>
13030 class ValueArray43 {
13031  public:
13032   ValueArray43(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
13033       T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
13034       T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
13035       T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33,
13036       T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39, T40 v40, T41 v41,
13037       T42 v42, T43 v43) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6),
13038       v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13),
13039       v14_(v14), v15_(v15), v16_(v16), v17_(v17), v18_(v18), v19_(v19),
13040       v20_(v20), v21_(v21), v22_(v22), v23_(v23), v24_(v24), v25_(v25),
13041       v26_(v26), v27_(v27), v28_(v28), v29_(v29), v30_(v30), v31_(v31),
13042       v32_(v32), v33_(v33), v34_(v34), v35_(v35), v36_(v36), v37_(v37),
13043       v38_(v38), v39_(v39), v40_(v40), v41_(v41), v42_(v42), v43_(v43) {}
13044
13045   template <typename T>
13046   operator ParamGenerator<T>() const {
13047     const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
13048         static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
13049         static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
13050         static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
13051         static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
13052         static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
13053         static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
13054         static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
13055         static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),
13056         static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_),
13057         static_cast<T>(v30_), static_cast<T>(v31_), static_cast<T>(v32_),
13058         static_cast<T>(v33_), static_cast<T>(v34_), static_cast<T>(v35_),
13059         static_cast<T>(v36_), static_cast<T>(v37_), static_cast<T>(v38_),
13060         static_cast<T>(v39_), static_cast<T>(v40_), static_cast<T>(v41_),
13061         static_cast<T>(v42_), static_cast<T>(v43_)};
13062     return ValuesIn(array);
13063   }
13064
13065  private:
13066   // No implementation - assignment is unsupported.
13067   void operator=(const ValueArray43& other);
13068
13069   const T1 v1_;
13070   const T2 v2_;
13071   const T3 v3_;
13072   const T4 v4_;
13073   const T5 v5_;
13074   const T6 v6_;
13075   const T7 v7_;
13076   const T8 v8_;
13077   const T9 v9_;
13078   const T10 v10_;
13079   const T11 v11_;
13080   const T12 v12_;
13081   const T13 v13_;
13082   const T14 v14_;
13083   const T15 v15_;
13084   const T16 v16_;
13085   const T17 v17_;
13086   const T18 v18_;
13087   const T19 v19_;
13088   const T20 v20_;
13089   const T21 v21_;
13090   const T22 v22_;
13091   const T23 v23_;
13092   const T24 v24_;
13093   const T25 v25_;
13094   const T26 v26_;
13095   const T27 v27_;
13096   const T28 v28_;
13097   const T29 v29_;
13098   const T30 v30_;
13099   const T31 v31_;
13100   const T32 v32_;
13101   const T33 v33_;
13102   const T34 v34_;
13103   const T35 v35_;
13104   const T36 v36_;
13105   const T37 v37_;
13106   const T38 v38_;
13107   const T39 v39_;
13108   const T40 v40_;
13109   const T41 v41_;
13110   const T42 v42_;
13111   const T43 v43_;
13112 };
13113
13114 template <typename T1, typename T2, typename T3, typename T4, typename T5,
13115     typename T6, typename T7, typename T8, typename T9, typename T10,
13116     typename T11, typename T12, typename T13, typename T14, typename T15,
13117     typename T16, typename T17, typename T18, typename T19, typename T20,
13118     typename T21, typename T22, typename T23, typename T24, typename T25,
13119     typename T26, typename T27, typename T28, typename T29, typename T30,
13120     typename T31, typename T32, typename T33, typename T34, typename T35,
13121     typename T36, typename T37, typename T38, typename T39, typename T40,
13122     typename T41, typename T42, typename T43, typename T44>
13123 class ValueArray44 {
13124  public:
13125   ValueArray44(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
13126       T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
13127       T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
13128       T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33,
13129       T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39, T40 v40, T41 v41,
13130       T42 v42, T43 v43, T44 v44) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5),
13131       v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12),
13132       v13_(v13), v14_(v14), v15_(v15), v16_(v16), v17_(v17), v18_(v18),
13133       v19_(v19), v20_(v20), v21_(v21), v22_(v22), v23_(v23), v24_(v24),
13134       v25_(v25), v26_(v26), v27_(v27), v28_(v28), v29_(v29), v30_(v30),
13135       v31_(v31), v32_(v32), v33_(v33), v34_(v34), v35_(v35), v36_(v36),
13136       v37_(v37), v38_(v38), v39_(v39), v40_(v40), v41_(v41), v42_(v42),
13137       v43_(v43), v44_(v44) {}
13138
13139   template <typename T>
13140   operator ParamGenerator<T>() const {
13141     const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
13142         static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
13143         static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
13144         static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
13145         static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
13146         static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
13147         static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
13148         static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
13149         static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),
13150         static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_),
13151         static_cast<T>(v30_), static_cast<T>(v31_), static_cast<T>(v32_),
13152         static_cast<T>(v33_), static_cast<T>(v34_), static_cast<T>(v35_),
13153         static_cast<T>(v36_), static_cast<T>(v37_), static_cast<T>(v38_),
13154         static_cast<T>(v39_), static_cast<T>(v40_), static_cast<T>(v41_),
13155         static_cast<T>(v42_), static_cast<T>(v43_), static_cast<T>(v44_)};
13156     return ValuesIn(array);
13157   }
13158
13159  private:
13160   // No implementation - assignment is unsupported.
13161   void operator=(const ValueArray44& other);
13162
13163   const T1 v1_;
13164   const T2 v2_;
13165   const T3 v3_;
13166   const T4 v4_;
13167   const T5 v5_;
13168   const T6 v6_;
13169   const T7 v7_;
13170   const T8 v8_;
13171   const T9 v9_;
13172   const T10 v10_;
13173   const T11 v11_;
13174   const T12 v12_;
13175   const T13 v13_;
13176   const T14 v14_;
13177   const T15 v15_;
13178   const T16 v16_;
13179   const T17 v17_;
13180   const T18 v18_;
13181   const T19 v19_;
13182   const T20 v20_;
13183   const T21 v21_;
13184   const T22 v22_;
13185   const T23 v23_;
13186   const T24 v24_;
13187   const T25 v25_;
13188   const T26 v26_;
13189   const T27 v27_;
13190   const T28 v28_;
13191   const T29 v29_;
13192   const T30 v30_;
13193   const T31 v31_;
13194   const T32 v32_;
13195   const T33 v33_;
13196   const T34 v34_;
13197   const T35 v35_;
13198   const T36 v36_;
13199   const T37 v37_;
13200   const T38 v38_;
13201   const T39 v39_;
13202   const T40 v40_;
13203   const T41 v41_;
13204   const T42 v42_;
13205   const T43 v43_;
13206   const T44 v44_;
13207 };
13208
13209 template <typename T1, typename T2, typename T3, typename T4, typename T5,
13210     typename T6, typename T7, typename T8, typename T9, typename T10,
13211     typename T11, typename T12, typename T13, typename T14, typename T15,
13212     typename T16, typename T17, typename T18, typename T19, typename T20,
13213     typename T21, typename T22, typename T23, typename T24, typename T25,
13214     typename T26, typename T27, typename T28, typename T29, typename T30,
13215     typename T31, typename T32, typename T33, typename T34, typename T35,
13216     typename T36, typename T37, typename T38, typename T39, typename T40,
13217     typename T41, typename T42, typename T43, typename T44, typename T45>
13218 class ValueArray45 {
13219  public:
13220   ValueArray45(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
13221       T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
13222       T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
13223       T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33,
13224       T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39, T40 v40, T41 v41,
13225       T42 v42, T43 v43, T44 v44, T45 v45) : v1_(v1), v2_(v2), v3_(v3), v4_(v4),
13226       v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11),
13227       v12_(v12), v13_(v13), v14_(v14), v15_(v15), v16_(v16), v17_(v17),
13228       v18_(v18), v19_(v19), v20_(v20), v21_(v21), v22_(v22), v23_(v23),
13229       v24_(v24), v25_(v25), v26_(v26), v27_(v27), v28_(v28), v29_(v29),
13230       v30_(v30), v31_(v31), v32_(v32), v33_(v33), v34_(v34), v35_(v35),
13231       v36_(v36), v37_(v37), v38_(v38), v39_(v39), v40_(v40), v41_(v41),
13232       v42_(v42), v43_(v43), v44_(v44), v45_(v45) {}
13233
13234   template <typename T>
13235   operator ParamGenerator<T>() const {
13236     const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
13237         static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
13238         static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
13239         static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
13240         static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
13241         static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
13242         static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
13243         static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
13244         static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),
13245         static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_),
13246         static_cast<T>(v30_), static_cast<T>(v31_), static_cast<T>(v32_),
13247         static_cast<T>(v33_), static_cast<T>(v34_), static_cast<T>(v35_),
13248         static_cast<T>(v36_), static_cast<T>(v37_), static_cast<T>(v38_),
13249         static_cast<T>(v39_), static_cast<T>(v40_), static_cast<T>(v41_),
13250         static_cast<T>(v42_), static_cast<T>(v43_), static_cast<T>(v44_),
13251         static_cast<T>(v45_)};
13252     return ValuesIn(array);
13253   }
13254
13255  private:
13256   // No implementation - assignment is unsupported.
13257   void operator=(const ValueArray45& other);
13258
13259   const T1 v1_;
13260   const T2 v2_;
13261   const T3 v3_;
13262   const T4 v4_;
13263   const T5 v5_;
13264   const T6 v6_;
13265   const T7 v7_;
13266   const T8 v8_;
13267   const T9 v9_;
13268   const T10 v10_;
13269   const T11 v11_;
13270   const T12 v12_;
13271   const T13 v13_;
13272   const T14 v14_;
13273   const T15 v15_;
13274   const T16 v16_;
13275   const T17 v17_;
13276   const T18 v18_;
13277   const T19 v19_;
13278   const T20 v20_;
13279   const T21 v21_;
13280   const T22 v22_;
13281   const T23 v23_;
13282   const T24 v24_;
13283   const T25 v25_;
13284   const T26 v26_;
13285   const T27 v27_;
13286   const T28 v28_;
13287   const T29 v29_;
13288   const T30 v30_;
13289   const T31 v31_;
13290   const T32 v32_;
13291   const T33 v33_;
13292   const T34 v34_;
13293   const T35 v35_;
13294   const T36 v36_;
13295   const T37 v37_;
13296   const T38 v38_;
13297   const T39 v39_;
13298   const T40 v40_;
13299   const T41 v41_;
13300   const T42 v42_;
13301   const T43 v43_;
13302   const T44 v44_;
13303   const T45 v45_;
13304 };
13305
13306 template <typename T1, typename T2, typename T3, typename T4, typename T5,
13307     typename T6, typename T7, typename T8, typename T9, typename T10,
13308     typename T11, typename T12, typename T13, typename T14, typename T15,
13309     typename T16, typename T17, typename T18, typename T19, typename T20,
13310     typename T21, typename T22, typename T23, typename T24, typename T25,
13311     typename T26, typename T27, typename T28, typename T29, typename T30,
13312     typename T31, typename T32, typename T33, typename T34, typename T35,
13313     typename T36, typename T37, typename T38, typename T39, typename T40,
13314     typename T41, typename T42, typename T43, typename T44, typename T45,
13315     typename T46>
13316 class ValueArray46 {
13317  public:
13318   ValueArray46(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
13319       T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
13320       T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
13321       T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33,
13322       T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39, T40 v40, T41 v41,
13323       T42 v42, T43 v43, T44 v44, T45 v45, T46 v46) : v1_(v1), v2_(v2), v3_(v3),
13324       v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10),
13325       v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15), v16_(v16),
13326       v17_(v17), v18_(v18), v19_(v19), v20_(v20), v21_(v21), v22_(v22),
13327       v23_(v23), v24_(v24), v25_(v25), v26_(v26), v27_(v27), v28_(v28),
13328       v29_(v29), v30_(v30), v31_(v31), v32_(v32), v33_(v33), v34_(v34),
13329       v35_(v35), v36_(v36), v37_(v37), v38_(v38), v39_(v39), v40_(v40),
13330       v41_(v41), v42_(v42), v43_(v43), v44_(v44), v45_(v45), v46_(v46) {}
13331
13332   template <typename T>
13333   operator ParamGenerator<T>() const {
13334     const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
13335         static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
13336         static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
13337         static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
13338         static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
13339         static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
13340         static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
13341         static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
13342         static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),
13343         static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_),
13344         static_cast<T>(v30_), static_cast<T>(v31_), static_cast<T>(v32_),
13345         static_cast<T>(v33_), static_cast<T>(v34_), static_cast<T>(v35_),
13346         static_cast<T>(v36_), static_cast<T>(v37_), static_cast<T>(v38_),
13347         static_cast<T>(v39_), static_cast<T>(v40_), static_cast<T>(v41_),
13348         static_cast<T>(v42_), static_cast<T>(v43_), static_cast<T>(v44_),
13349         static_cast<T>(v45_), static_cast<T>(v46_)};
13350     return ValuesIn(array);
13351   }
13352
13353  private:
13354   // No implementation - assignment is unsupported.
13355   void operator=(const ValueArray46& other);
13356
13357   const T1 v1_;
13358   const T2 v2_;
13359   const T3 v3_;
13360   const T4 v4_;
13361   const T5 v5_;
13362   const T6 v6_;
13363   const T7 v7_;
13364   const T8 v8_;
13365   const T9 v9_;
13366   const T10 v10_;
13367   const T11 v11_;
13368   const T12 v12_;
13369   const T13 v13_;
13370   const T14 v14_;
13371   const T15 v15_;
13372   const T16 v16_;
13373   const T17 v17_;
13374   const T18 v18_;
13375   const T19 v19_;
13376   const T20 v20_;
13377   const T21 v21_;
13378   const T22 v22_;
13379   const T23 v23_;
13380   const T24 v24_;
13381   const T25 v25_;
13382   const T26 v26_;
13383   const T27 v27_;
13384   const T28 v28_;
13385   const T29 v29_;
13386   const T30 v30_;
13387   const T31 v31_;
13388   const T32 v32_;
13389   const T33 v33_;
13390   const T34 v34_;
13391   const T35 v35_;
13392   const T36 v36_;
13393   const T37 v37_;
13394   const T38 v38_;
13395   const T39 v39_;
13396   const T40 v40_;
13397   const T41 v41_;
13398   const T42 v42_;
13399   const T43 v43_;
13400   const T44 v44_;
13401   const T45 v45_;
13402   const T46 v46_;
13403 };
13404
13405 template <typename T1, typename T2, typename T3, typename T4, typename T5,
13406     typename T6, typename T7, typename T8, typename T9, typename T10,
13407     typename T11, typename T12, typename T13, typename T14, typename T15,
13408     typename T16, typename T17, typename T18, typename T19, typename T20,
13409     typename T21, typename T22, typename T23, typename T24, typename T25,
13410     typename T26, typename T27, typename T28, typename T29, typename T30,
13411     typename T31, typename T32, typename T33, typename T34, typename T35,
13412     typename T36, typename T37, typename T38, typename T39, typename T40,
13413     typename T41, typename T42, typename T43, typename T44, typename T45,
13414     typename T46, typename T47>
13415 class ValueArray47 {
13416  public:
13417   ValueArray47(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
13418       T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
13419       T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
13420       T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33,
13421       T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39, T40 v40, T41 v41,
13422       T42 v42, T43 v43, T44 v44, T45 v45, T46 v46, T47 v47) : v1_(v1), v2_(v2),
13423       v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10),
13424       v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15), v16_(v16),
13425       v17_(v17), v18_(v18), v19_(v19), v20_(v20), v21_(v21), v22_(v22),
13426       v23_(v23), v24_(v24), v25_(v25), v26_(v26), v27_(v27), v28_(v28),
13427       v29_(v29), v30_(v30), v31_(v31), v32_(v32), v33_(v33), v34_(v34),
13428       v35_(v35), v36_(v36), v37_(v37), v38_(v38), v39_(v39), v40_(v40),
13429       v41_(v41), v42_(v42), v43_(v43), v44_(v44), v45_(v45), v46_(v46),
13430       v47_(v47) {}
13431
13432   template <typename T>
13433   operator ParamGenerator<T>() const {
13434     const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
13435         static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
13436         static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
13437         static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
13438         static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
13439         static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
13440         static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
13441         static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
13442         static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),
13443         static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_),
13444         static_cast<T>(v30_), static_cast<T>(v31_), static_cast<T>(v32_),
13445         static_cast<T>(v33_), static_cast<T>(v34_), static_cast<T>(v35_),
13446         static_cast<T>(v36_), static_cast<T>(v37_), static_cast<T>(v38_),
13447         static_cast<T>(v39_), static_cast<T>(v40_), static_cast<T>(v41_),
13448         static_cast<T>(v42_), static_cast<T>(v43_), static_cast<T>(v44_),
13449         static_cast<T>(v45_), static_cast<T>(v46_), static_cast<T>(v47_)};
13450     return ValuesIn(array);
13451   }
13452
13453  private:
13454   // No implementation - assignment is unsupported.
13455   void operator=(const ValueArray47& other);
13456
13457   const T1 v1_;
13458   const T2 v2_;
13459   const T3 v3_;
13460   const T4 v4_;
13461   const T5 v5_;
13462   const T6 v6_;
13463   const T7 v7_;
13464   const T8 v8_;
13465   const T9 v9_;
13466   const T10 v10_;
13467   const T11 v11_;
13468   const T12 v12_;
13469   const T13 v13_;
13470   const T14 v14_;
13471   const T15 v15_;
13472   const T16 v16_;
13473   const T17 v17_;
13474   const T18 v18_;
13475   const T19 v19_;
13476   const T20 v20_;
13477   const T21 v21_;
13478   const T22 v22_;
13479   const T23 v23_;
13480   const T24 v24_;
13481   const T25 v25_;
13482   const T26 v26_;
13483   const T27 v27_;
13484   const T28 v28_;
13485   const T29 v29_;
13486   const T30 v30_;
13487   const T31 v31_;
13488   const T32 v32_;
13489   const T33 v33_;
13490   const T34 v34_;
13491   const T35 v35_;
13492   const T36 v36_;
13493   const T37 v37_;
13494   const T38 v38_;
13495   const T39 v39_;
13496   const T40 v40_;
13497   const T41 v41_;
13498   const T42 v42_;
13499   const T43 v43_;
13500   const T44 v44_;
13501   const T45 v45_;
13502   const T46 v46_;
13503   const T47 v47_;
13504 };
13505
13506 template <typename T1, typename T2, typename T3, typename T4, typename T5,
13507     typename T6, typename T7, typename T8, typename T9, typename T10,
13508     typename T11, typename T12, typename T13, typename T14, typename T15,
13509     typename T16, typename T17, typename T18, typename T19, typename T20,
13510     typename T21, typename T22, typename T23, typename T24, typename T25,
13511     typename T26, typename T27, typename T28, typename T29, typename T30,
13512     typename T31, typename T32, typename T33, typename T34, typename T35,
13513     typename T36, typename T37, typename T38, typename T39, typename T40,
13514     typename T41, typename T42, typename T43, typename T44, typename T45,
13515     typename T46, typename T47, typename T48>
13516 class ValueArray48 {
13517  public:
13518   ValueArray48(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
13519       T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
13520       T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
13521       T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33,
13522       T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39, T40 v40, T41 v41,
13523       T42 v42, T43 v43, T44 v44, T45 v45, T46 v46, T47 v47, T48 v48) : v1_(v1),
13524       v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9),
13525       v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15),
13526       v16_(v16), v17_(v17), v18_(v18), v19_(v19), v20_(v20), v21_(v21),
13527       v22_(v22), v23_(v23), v24_(v24), v25_(v25), v26_(v26), v27_(v27),
13528       v28_(v28), v29_(v29), v30_(v30), v31_(v31), v32_(v32), v33_(v33),
13529       v34_(v34), v35_(v35), v36_(v36), v37_(v37), v38_(v38), v39_(v39),
13530       v40_(v40), v41_(v41), v42_(v42), v43_(v43), v44_(v44), v45_(v45),
13531       v46_(v46), v47_(v47), v48_(v48) {}
13532
13533   template <typename T>
13534   operator ParamGenerator<T>() const {
13535     const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
13536         static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
13537         static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
13538         static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
13539         static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
13540         static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
13541         static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
13542         static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
13543         static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),
13544         static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_),
13545         static_cast<T>(v30_), static_cast<T>(v31_), static_cast<T>(v32_),
13546         static_cast<T>(v33_), static_cast<T>(v34_), static_cast<T>(v35_),
13547         static_cast<T>(v36_), static_cast<T>(v37_), static_cast<T>(v38_),
13548         static_cast<T>(v39_), static_cast<T>(v40_), static_cast<T>(v41_),
13549         static_cast<T>(v42_), static_cast<T>(v43_), static_cast<T>(v44_),
13550         static_cast<T>(v45_), static_cast<T>(v46_), static_cast<T>(v47_),
13551         static_cast<T>(v48_)};
13552     return ValuesIn(array);
13553   }
13554
13555  private:
13556   // No implementation - assignment is unsupported.
13557   void operator=(const ValueArray48& other);
13558
13559   const T1 v1_;
13560   const T2 v2_;
13561   const T3 v3_;
13562   const T4 v4_;
13563   const T5 v5_;
13564   const T6 v6_;
13565   const T7 v7_;
13566   const T8 v8_;
13567   const T9 v9_;
13568   const T10 v10_;
13569   const T11 v11_;
13570   const T12 v12_;
13571   const T13 v13_;
13572   const T14 v14_;
13573   const T15 v15_;
13574   const T16 v16_;
13575   const T17 v17_;
13576   const T18 v18_;
13577   const T19 v19_;
13578   const T20 v20_;
13579   const T21 v21_;
13580   const T22 v22_;
13581   const T23 v23_;
13582   const T24 v24_;
13583   const T25 v25_;
13584   const T26 v26_;
13585   const T27 v27_;
13586   const T28 v28_;
13587   const T29 v29_;
13588   const T30 v30_;
13589   const T31 v31_;
13590   const T32 v32_;
13591   const T33 v33_;
13592   const T34 v34_;
13593   const T35 v35_;
13594   const T36 v36_;
13595   const T37 v37_;
13596   const T38 v38_;
13597   const T39 v39_;
13598   const T40 v40_;
13599   const T41 v41_;
13600   const T42 v42_;
13601   const T43 v43_;
13602   const T44 v44_;
13603   const T45 v45_;
13604   const T46 v46_;
13605   const T47 v47_;
13606   const T48 v48_;
13607 };
13608
13609 template <typename T1, typename T2, typename T3, typename T4, typename T5,
13610     typename T6, typename T7, typename T8, typename T9, typename T10,
13611     typename T11, typename T12, typename T13, typename T14, typename T15,
13612     typename T16, typename T17, typename T18, typename T19, typename T20,
13613     typename T21, typename T22, typename T23, typename T24, typename T25,
13614     typename T26, typename T27, typename T28, typename T29, typename T30,
13615     typename T31, typename T32, typename T33, typename T34, typename T35,
13616     typename T36, typename T37, typename T38, typename T39, typename T40,
13617     typename T41, typename T42, typename T43, typename T44, typename T45,
13618     typename T46, typename T47, typename T48, typename T49>
13619 class ValueArray49 {
13620  public:
13621   ValueArray49(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
13622       T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
13623       T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
13624       T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33,
13625       T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39, T40 v40, T41 v41,
13626       T42 v42, T43 v43, T44 v44, T45 v45, T46 v46, T47 v47, T48 v48,
13627       T49 v49) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7),
13628       v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v14),
13629       v15_(v15), v16_(v16), v17_(v17), v18_(v18), v19_(v19), v20_(v20),
13630       v21_(v21), v22_(v22), v23_(v23), v24_(v24), v25_(v25), v26_(v26),
13631       v27_(v27), v28_(v28), v29_(v29), v30_(v30), v31_(v31), v32_(v32),
13632       v33_(v33), v34_(v34), v35_(v35), v36_(v36), v37_(v37), v38_(v38),
13633       v39_(v39), v40_(v40), v41_(v41), v42_(v42), v43_(v43), v44_(v44),
13634       v45_(v45), v46_(v46), v47_(v47), v48_(v48), v49_(v49) {}
13635
13636   template <typename T>
13637   operator ParamGenerator<T>() const {
13638     const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
13639         static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
13640         static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
13641         static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
13642         static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
13643         static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
13644         static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
13645         static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
13646         static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),
13647         static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_),
13648         static_cast<T>(v30_), static_cast<T>(v31_), static_cast<T>(v32_),
13649         static_cast<T>(v33_), static_cast<T>(v34_), static_cast<T>(v35_),
13650         static_cast<T>(v36_), static_cast<T>(v37_), static_cast<T>(v38_),
13651         static_cast<T>(v39_), static_cast<T>(v40_), static_cast<T>(v41_),
13652         static_cast<T>(v42_), static_cast<T>(v43_), static_cast<T>(v44_),
13653         static_cast<T>(v45_), static_cast<T>(v46_), static_cast<T>(v47_),
13654         static_cast<T>(v48_), static_cast<T>(v49_)};
13655     return ValuesIn(array);
13656   }
13657
13658  private:
13659   // No implementation - assignment is unsupported.
13660   void operator=(const ValueArray49& other);
13661
13662   const T1 v1_;
13663   const T2 v2_;
13664   const T3 v3_;
13665   const T4 v4_;
13666   const T5 v5_;
13667   const T6 v6_;
13668   const T7 v7_;
13669   const T8 v8_;
13670   const T9 v9_;
13671   const T10 v10_;
13672   const T11 v11_;
13673   const T12 v12_;
13674   const T13 v13_;
13675   const T14 v14_;
13676   const T15 v15_;
13677   const T16 v16_;
13678   const T17 v17_;
13679   const T18 v18_;
13680   const T19 v19_;
13681   const T20 v20_;
13682   const T21 v21_;
13683   const T22 v22_;
13684   const T23 v23_;
13685   const T24 v24_;
13686   const T25 v25_;
13687   const T26 v26_;
13688   const T27 v27_;
13689   const T28 v28_;
13690   const T29 v29_;
13691   const T30 v30_;
13692   const T31 v31_;
13693   const T32 v32_;
13694   const T33 v33_;
13695   const T34 v34_;
13696   const T35 v35_;
13697   const T36 v36_;
13698   const T37 v37_;
13699   const T38 v38_;
13700   const T39 v39_;
13701   const T40 v40_;
13702   const T41 v41_;
13703   const T42 v42_;
13704   const T43 v43_;
13705   const T44 v44_;
13706   const T45 v45_;
13707   const T46 v46_;
13708   const T47 v47_;
13709   const T48 v48_;
13710   const T49 v49_;
13711 };
13712
13713 template <typename T1, typename T2, typename T3, typename T4, typename T5,
13714     typename T6, typename T7, typename T8, typename T9, typename T10,
13715     typename T11, typename T12, typename T13, typename T14, typename T15,
13716     typename T16, typename T17, typename T18, typename T19, typename T20,
13717     typename T21, typename T22, typename T23, typename T24, typename T25,
13718     typename T26, typename T27, typename T28, typename T29, typename T30,
13719     typename T31, typename T32, typename T33, typename T34, typename T35,
13720     typename T36, typename T37, typename T38, typename T39, typename T40,
13721     typename T41, typename T42, typename T43, typename T44, typename T45,
13722     typename T46, typename T47, typename T48, typename T49, typename T50>
13723 class ValueArray50 {
13724  public:
13725   ValueArray50(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
13726       T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
13727       T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
13728       T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33,
13729       T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39, T40 v40, T41 v41,
13730       T42 v42, T43 v43, T44 v44, T45 v45, T46 v46, T47 v47, T48 v48, T49 v49,
13731       T50 v50) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7),
13732       v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v14),
13733       v15_(v15), v16_(v16), v17_(v17), v18_(v18), v19_(v19), v20_(v20),
13734       v21_(v21), v22_(v22), v23_(v23), v24_(v24), v25_(v25), v26_(v26),
13735       v27_(v27), v28_(v28), v29_(v29), v30_(v30), v31_(v31), v32_(v32),
13736       v33_(v33), v34_(v34), v35_(v35), v36_(v36), v37_(v37), v38_(v38),
13737       v39_(v39), v40_(v40), v41_(v41), v42_(v42), v43_(v43), v44_(v44),
13738       v45_(v45), v46_(v46), v47_(v47), v48_(v48), v49_(v49), v50_(v50) {}
13739
13740   template <typename T>
13741   operator ParamGenerator<T>() const {
13742     const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
13743         static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
13744         static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
13745         static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
13746         static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
13747         static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
13748         static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
13749         static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
13750         static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),
13751         static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_),
13752         static_cast<T>(v30_), static_cast<T>(v31_), static_cast<T>(v32_),
13753         static_cast<T>(v33_), static_cast<T>(v34_), static_cast<T>(v35_),
13754         static_cast<T>(v36_), static_cast<T>(v37_), static_cast<T>(v38_),
13755         static_cast<T>(v39_), static_cast<T>(v40_), static_cast<T>(v41_),
13756         static_cast<T>(v42_), static_cast<T>(v43_), static_cast<T>(v44_),
13757         static_cast<T>(v45_), static_cast<T>(v46_), static_cast<T>(v47_),
13758         static_cast<T>(v48_), static_cast<T>(v49_), static_cast<T>(v50_)};
13759     return ValuesIn(array);
13760   }
13761
13762  private:
13763   // No implementation - assignment is unsupported.
13764   void operator=(const ValueArray50& other);
13765
13766   const T1 v1_;
13767   const T2 v2_;
13768   const T3 v3_;
13769   const T4 v4_;
13770   const T5 v5_;
13771   const T6 v6_;
13772   const T7 v7_;
13773   const T8 v8_;
13774   const T9 v9_;
13775   const T10 v10_;
13776   const T11 v11_;
13777   const T12 v12_;
13778   const T13 v13_;
13779   const T14 v14_;
13780   const T15 v15_;
13781   const T16 v16_;
13782   const T17 v17_;
13783   const T18 v18_;
13784   const T19 v19_;
13785   const T20 v20_;
13786   const T21 v21_;
13787   const T22 v22_;
13788   const T23 v23_;
13789   const T24 v24_;
13790   const T25 v25_;
13791   const T26 v26_;
13792   const T27 v27_;
13793   const T28 v28_;
13794   const T29 v29_;
13795   const T30 v30_;
13796   const T31 v31_;
13797   const T32 v32_;
13798   const T33 v33_;
13799   const T34 v34_;
13800   const T35 v35_;
13801   const T36 v36_;
13802   const T37 v37_;
13803   const T38 v38_;
13804   const T39 v39_;
13805   const T40 v40_;
13806   const T41 v41_;
13807   const T42 v42_;
13808   const T43 v43_;
13809   const T44 v44_;
13810   const T45 v45_;
13811   const T46 v46_;
13812   const T47 v47_;
13813   const T48 v48_;
13814   const T49 v49_;
13815   const T50 v50_;
13816 };
13817
13818 # if GTEST_HAS_COMBINE
13819 // INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.
13820 //
13821 // Generates values from the Cartesian product of values produced
13822 // by the argument generators.
13823 //
13824 template <typename T1, typename T2>
13825 class CartesianProductGenerator2
13826     : public ParamGeneratorInterface< ::std::tr1::tuple<T1, T2> > {
13827  public:
13828   typedef ::std::tr1::tuple<T1, T2> ParamType;
13829
13830   CartesianProductGenerator2(const ParamGenerator<T1>& g1,
13831       const ParamGenerator<T2>& g2)
13832       : g1_(g1), g2_(g2) {}
13833   virtual ~CartesianProductGenerator2() {}
13834
13835   virtual ParamIteratorInterface<ParamType>* Begin() const {
13836     return new Iterator(this, g1_, g1_.begin(), g2_, g2_.begin());
13837   }
13838   virtual ParamIteratorInterface<ParamType>* End() const {
13839     return new Iterator(this, g1_, g1_.end(), g2_, g2_.end());
13840   }
13841
13842  private:
13843   class Iterator : public ParamIteratorInterface<ParamType> {
13844    public:
13845     Iterator(const ParamGeneratorInterface<ParamType>* base,
13846       const ParamGenerator<T1>& g1,
13847       const typename ParamGenerator<T1>::iterator& current1,
13848       const ParamGenerator<T2>& g2,
13849       const typename ParamGenerator<T2>::iterator& current2)
13850         : base_(base),
13851           begin1_(g1.begin()), end1_(g1.end()), current1_(current1),
13852           begin2_(g2.begin()), end2_(g2.end()), current2_(current2)    {
13853       ComputeCurrentValue();
13854     }
13855     virtual ~Iterator() {}
13856
13857     virtual const ParamGeneratorInterface<ParamType>* BaseGenerator() const {
13858       return base_;
13859     }
13860     // Advance should not be called on beyond-of-range iterators
13861     // so no component iterators must be beyond end of range, either.
13862     virtual void Advance() {
13863       assert(!AtEnd());
13864       ++current2_;
13865       if (current2_ == end2_) {
13866         current2_ = begin2_;
13867         ++current1_;
13868       }
13869       ComputeCurrentValue();
13870     }
13871     virtual ParamIteratorInterface<ParamType>* Clone() const {
13872       return new Iterator(*this);
13873     }
13874     virtual const ParamType* Current() const { return &current_value_; }
13875     virtual bool Equals(const ParamIteratorInterface<ParamType>& other) const {
13876       // Having the same base generator guarantees that the other
13877       // iterator is of the same type and we can downcast.
13878       GTEST_CHECK_(BaseGenerator() == other.BaseGenerator())
13879           << "The program attempted to compare iterators "
13880           << "from different generators." << std::endl;
13881       const Iterator* typed_other =
13882           CheckedDowncastToActualType<const Iterator>(&other);
13883       // We must report iterators equal if they both point beyond their
13884       // respective ranges. That can happen in a variety of fashions,
13885       // so we have to consult AtEnd().
13886       return (AtEnd() && typed_other->AtEnd()) ||
13887          (
13888           current1_ == typed_other->current1_ &&
13889           current2_ == typed_other->current2_);
13890     }
13891
13892    private:
13893     Iterator(const Iterator& other)
13894         : base_(other.base_),
13895         begin1_(other.begin1_),
13896         end1_(other.end1_),
13897         current1_(other.current1_),
13898         begin2_(other.begin2_),
13899         end2_(other.end2_),
13900         current2_(other.current2_) {
13901       ComputeCurrentValue();
13902     }
13903
13904     void ComputeCurrentValue() {
13905       if (!AtEnd())
13906         current_value_ = ParamType(*current1_, *current2_);
13907     }
13908     bool AtEnd() const {
13909       // We must report iterator past the end of the range when either of the
13910       // component iterators has reached the end of its range.
13911       return
13912           current1_ == end1_ ||
13913           current2_ == end2_;
13914     }
13915
13916     // No implementation - assignment is unsupported.
13917     void operator=(const Iterator& other);
13918
13919     const ParamGeneratorInterface<ParamType>* const base_;
13920     // begin[i]_ and end[i]_ define the i-th range that Iterator traverses.
13921     // current[i]_ is the actual traversing iterator.
13922     const typename ParamGenerator<T1>::iterator begin1_;
13923     const typename ParamGenerator<T1>::iterator end1_;
13924     typename ParamGenerator<T1>::iterator current1_;
13925     const typename ParamGenerator<T2>::iterator begin2_;
13926     const typename ParamGenerator<T2>::iterator end2_;
13927     typename ParamGenerator<T2>::iterator current2_;
13928     ParamType current_value_;
13929   };  // class CartesianProductGenerator2::Iterator
13930
13931   // No implementation - assignment is unsupported.
13932   void operator=(const CartesianProductGenerator2& other);
13933
13934   const ParamGenerator<T1> g1_;
13935   const ParamGenerator<T2> g2_;
13936 };  // class CartesianProductGenerator2
13937
13938
13939 template <typename T1, typename T2, typename T3>
13940 class CartesianProductGenerator3
13941     : public ParamGeneratorInterface< ::std::tr1::tuple<T1, T2, T3> > {
13942  public:
13943   typedef ::std::tr1::tuple<T1, T2, T3> ParamType;
13944
13945   CartesianProductGenerator3(const ParamGenerator<T1>& g1,
13946       const ParamGenerator<T2>& g2, const ParamGenerator<T3>& g3)
13947       : g1_(g1), g2_(g2), g3_(g3) {}
13948   virtual ~CartesianProductGenerator3() {}
13949
13950   virtual ParamIteratorInterface<ParamType>* Begin() const {
13951     return new Iterator(this, g1_, g1_.begin(), g2_, g2_.begin(), g3_,
13952         g3_.begin());
13953   }
13954   virtual ParamIteratorInterface<ParamType>* End() const {
13955     return new Iterator(this, g1_, g1_.end(), g2_, g2_.end(), g3_, g3_.end());
13956   }
13957
13958  private:
13959   class Iterator : public ParamIteratorInterface<ParamType> {
13960    public:
13961     Iterator(const ParamGeneratorInterface<ParamType>* base,
13962       const ParamGenerator<T1>& g1,
13963       const typename ParamGenerator<T1>::iterator& current1,
13964       const ParamGenerator<T2>& g2,
13965       const typename ParamGenerator<T2>::iterator& current2,
13966       const ParamGenerator<T3>& g3,
13967       const typename ParamGenerator<T3>::iterator& current3)
13968         : base_(base),
13969           begin1_(g1.begin()), end1_(g1.end()), current1_(current1),
13970           begin2_(g2.begin()), end2_(g2.end()), current2_(current2),
13971           begin3_(g3.begin()), end3_(g3.end()), current3_(current3)    {
13972       ComputeCurrentValue();
13973     }
13974     virtual ~Iterator() {}
13975
13976     virtual const ParamGeneratorInterface<ParamType>* BaseGenerator() const {
13977       return base_;
13978     }
13979     // Advance should not be called on beyond-of-range iterators
13980     // so no component iterators must be beyond end of range, either.
13981     virtual void Advance() {
13982       assert(!AtEnd());
13983       ++current3_;
13984       if (current3_ == end3_) {
13985         current3_ = begin3_;
13986         ++current2_;
13987       }
13988       if (current2_ == end2_) {
13989         current2_ = begin2_;
13990         ++current1_;
13991       }
13992       ComputeCurrentValue();
13993     }
13994     virtual ParamIteratorInterface<ParamType>* Clone() const {
13995       return new Iterator(*this);
13996     }
13997     virtual const ParamType* Current() const { return &current_value_; }
13998     virtual bool Equals(const ParamIteratorInterface<ParamType>& other) const {
13999       // Having the same base generator guarantees that the other
14000       // iterator is of the same type and we can downcast.
14001       GTEST_CHECK_(BaseGenerator() == other.BaseGenerator())
14002           << "The program attempted to compare iterators "
14003           << "from different generators." << std::endl;
14004       const Iterator* typed_other =
14005           CheckedDowncastToActualType<const Iterator>(&other);
14006       // We must report iterators equal if they both point beyond their
14007       // respective ranges. That can happen in a variety of fashions,
14008       // so we have to consult AtEnd().
14009       return (AtEnd() && typed_other->AtEnd()) ||
14010          (
14011           current1_ == typed_other->current1_ &&
14012           current2_ == typed_other->current2_ &&
14013           current3_ == typed_other->current3_);
14014     }
14015
14016    private:
14017     Iterator(const Iterator& other)
14018         : base_(other.base_),
14019         begin1_(other.begin1_),
14020         end1_(other.end1_),
14021         current1_(other.current1_),
14022         begin2_(other.begin2_),
14023         end2_(other.end2_),
14024         current2_(other.current2_),
14025         begin3_(other.begin3_),
14026         end3_(other.end3_),
14027         current3_(other.current3_) {
14028       ComputeCurrentValue();
14029     }
14030
14031     void ComputeCurrentValue() {
14032       if (!AtEnd())
14033         current_value_ = ParamType(*current1_, *current2_, *current3_);
14034     }
14035     bool AtEnd() const {
14036       // We must report iterator past the end of the range when either of the
14037       // component iterators has reached the end of its range.
14038       return
14039           current1_ == end1_ ||
14040           current2_ == end2_ ||
14041           current3_ == end3_;
14042     }
14043
14044     // No implementation - assignment is unsupported.
14045     void operator=(const Iterator& other);
14046
14047     const ParamGeneratorInterface<ParamType>* const base_;
14048     // begin[i]_ and end[i]_ define the i-th range that Iterator traverses.
14049     // current[i]_ is the actual traversing iterator.
14050     const typename ParamGenerator<T1>::iterator begin1_;
14051     const typename ParamGenerator<T1>::iterator end1_;
14052     typename ParamGenerator<T1>::iterator current1_;
14053     const typename ParamGenerator<T2>::iterator begin2_;
14054     const typename ParamGenerator<T2>::iterator end2_;
14055     typename ParamGenerator<T2>::iterator current2_;
14056     const typename ParamGenerator<T3>::iterator begin3_;
14057     const typename ParamGenerator<T3>::iterator end3_;
14058     typename ParamGenerator<T3>::iterator current3_;
14059     ParamType current_value_;
14060   };  // class CartesianProductGenerator3::Iterator
14061
14062   // No implementation - assignment is unsupported.
14063   void operator=(const CartesianProductGenerator3& other);
14064
14065   const ParamGenerator<T1> g1_;
14066   const ParamGenerator<T2> g2_;
14067   const ParamGenerator<T3> g3_;
14068 };  // class CartesianProductGenerator3
14069
14070
14071 template <typename T1, typename T2, typename T3, typename T4>
14072 class CartesianProductGenerator4
14073     : public ParamGeneratorInterface< ::std::tr1::tuple<T1, T2, T3, T4> > {
14074  public:
14075   typedef ::std::tr1::tuple<T1, T2, T3, T4> ParamType;
14076
14077   CartesianProductGenerator4(const ParamGenerator<T1>& g1,
14078       const ParamGenerator<T2>& g2, const ParamGenerator<T3>& g3,
14079       const ParamGenerator<T4>& g4)
14080       : g1_(g1), g2_(g2), g3_(g3), g4_(g4) {}
14081   virtual ~CartesianProductGenerator4() {}
14082
14083   virtual ParamIteratorInterface<ParamType>* Begin() const {
14084     return new Iterator(this, g1_, g1_.begin(), g2_, g2_.begin(), g3_,
14085         g3_.begin(), g4_, g4_.begin());
14086   }
14087   virtual ParamIteratorInterface<ParamType>* End() const {
14088     return new Iterator(this, g1_, g1_.end(), g2_, g2_.end(), g3_, g3_.end(),
14089         g4_, g4_.end());
14090   }
14091
14092  private:
14093   class Iterator : public ParamIteratorInterface<ParamType> {
14094    public:
14095     Iterator(const ParamGeneratorInterface<ParamType>* base,
14096       const ParamGenerator<T1>& g1,
14097       const typename ParamGenerator<T1>::iterator& current1,
14098       const ParamGenerator<T2>& g2,
14099       const typename ParamGenerator<T2>::iterator& current2,
14100       const ParamGenerator<T3>& g3,
14101       const typename ParamGenerator<T3>::iterator& current3,
14102       const ParamGenerator<T4>& g4,
14103       const typename ParamGenerator<T4>::iterator& current4)
14104         : base_(base),
14105           begin1_(g1.begin()), end1_(g1.end()), current1_(current1),
14106           begin2_(g2.begin()), end2_(g2.end()), current2_(current2),
14107           begin3_(g3.begin()), end3_(g3.end()), current3_(current3),
14108           begin4_(g4.begin()), end4_(g4.end()), current4_(current4)    {
14109       ComputeCurrentValue();
14110     }
14111     virtual ~Iterator() {}
14112
14113     virtual const ParamGeneratorInterface<ParamType>* BaseGenerator() const {
14114       return base_;
14115     }
14116     // Advance should not be called on beyond-of-range iterators
14117     // so no component iterators must be beyond end of range, either.
14118     virtual void Advance() {
14119       assert(!AtEnd());
14120       ++current4_;
14121       if (current4_ == end4_) {
14122         current4_ = begin4_;
14123         ++current3_;
14124       }
14125       if (current3_ == end3_) {
14126         current3_ = begin3_;
14127         ++current2_;
14128       }
14129       if (current2_ == end2_) {
14130         current2_ = begin2_;
14131         ++current1_;
14132       }
14133       ComputeCurrentValue();
14134     }
14135     virtual ParamIteratorInterface<ParamType>* Clone() const {
14136       return new Iterator(*this);
14137     }
14138     virtual const ParamType* Current() const { return &current_value_; }
14139     virtual bool Equals(const ParamIteratorInterface<ParamType>& other) const {
14140       // Having the same base generator guarantees that the other
14141       // iterator is of the same type and we can downcast.
14142       GTEST_CHECK_(BaseGenerator() == other.BaseGenerator())
14143           << "The program attempted to compare iterators "
14144           << "from different generators." << std::endl;
14145       const Iterator* typed_other =
14146           CheckedDowncastToActualType<const Iterator>(&other);
14147       // We must report iterators equal if they both point beyond their
14148       // respective ranges. That can happen in a variety of fashions,
14149       // so we have to consult AtEnd().
14150       return (AtEnd() && typed_other->AtEnd()) ||
14151          (
14152           current1_ == typed_other->current1_ &&
14153           current2_ == typed_other->current2_ &&
14154           current3_ == typed_other->current3_ &&
14155           current4_ == typed_other->current4_);
14156     }
14157
14158    private:
14159     Iterator(const Iterator& other)
14160         : base_(other.base_),
14161         begin1_(other.begin1_),
14162         end1_(other.end1_),
14163         current1_(other.current1_),
14164         begin2_(other.begin2_),
14165         end2_(other.end2_),
14166         current2_(other.current2_),
14167         begin3_(other.begin3_),
14168         end3_(other.end3_),
14169         current3_(other.current3_),
14170         begin4_(other.begin4_),
14171         end4_(other.end4_),
14172         current4_(other.current4_) {
14173       ComputeCurrentValue();
14174     }
14175
14176     void ComputeCurrentValue() {
14177       if (!AtEnd())
14178         current_value_ = ParamType(*current1_, *current2_, *current3_,
14179             *current4_);
14180     }
14181     bool AtEnd() const {
14182       // We must report iterator past the end of the range when either of the
14183       // component iterators has reached the end of its range.
14184       return
14185           current1_ == end1_ ||
14186           current2_ == end2_ ||
14187           current3_ == end3_ ||
14188           current4_ == end4_;
14189     }
14190
14191     // No implementation - assignment is unsupported.
14192     void operator=(const Iterator& other);
14193
14194     const ParamGeneratorInterface<ParamType>* const base_;
14195     // begin[i]_ and end[i]_ define the i-th range that Iterator traverses.
14196     // current[i]_ is the actual traversing iterator.
14197     const typename ParamGenerator<T1>::iterator begin1_;
14198     const typename ParamGenerator<T1>::iterator end1_;
14199     typename ParamGenerator<T1>::iterator current1_;
14200     const typename ParamGenerator<T2>::iterator begin2_;
14201     const typename ParamGenerator<T2>::iterator end2_;
14202     typename ParamGenerator<T2>::iterator current2_;
14203     const typename ParamGenerator<T3>::iterator begin3_;
14204     const typename ParamGenerator<T3>::iterator end3_;
14205     typename ParamGenerator<T3>::iterator current3_;
14206     const typename ParamGenerator<T4>::iterator begin4_;
14207     const typename ParamGenerator<T4>::iterator end4_;
14208     typename ParamGenerator<T4>::iterator current4_;
14209     ParamType current_value_;
14210   };  // class CartesianProductGenerator4::Iterator
14211
14212   // No implementation - assignment is unsupported.
14213   void operator=(const CartesianProductGenerator4& other);
14214
14215   const ParamGenerator<T1> g1_;
14216   const ParamGenerator<T2> g2_;
14217   const ParamGenerator<T3> g3_;
14218   const ParamGenerator<T4> g4_;
14219 };  // class CartesianProductGenerator4
14220
14221
14222 template <typename T1, typename T2, typename T3, typename T4, typename T5>
14223 class CartesianProductGenerator5
14224     : public ParamGeneratorInterface< ::std::tr1::tuple<T1, T2, T3, T4, T5> > {
14225  public:
14226   typedef ::std::tr1::tuple<T1, T2, T3, T4, T5> ParamType;
14227
14228   CartesianProductGenerator5(const ParamGenerator<T1>& g1,
14229       const ParamGenerator<T2>& g2, const ParamGenerator<T3>& g3,
14230       const ParamGenerator<T4>& g4, const ParamGenerator<T5>& g5)
14231       : g1_(g1), g2_(g2), g3_(g3), g4_(g4), g5_(g5) {}
14232   virtual ~CartesianProductGenerator5() {}
14233
14234   virtual ParamIteratorInterface<ParamType>* Begin() const {
14235     return new Iterator(this, g1_, g1_.begin(), g2_, g2_.begin(), g3_,
14236         g3_.begin(), g4_, g4_.begin(), g5_, g5_.begin());
14237   }
14238   virtual ParamIteratorInterface<ParamType>* End() const {
14239     return new Iterator(this, g1_, g1_.end(), g2_, g2_.end(), g3_, g3_.end(),
14240         g4_, g4_.end(), g5_, g5_.end());
14241   }
14242
14243  private:
14244   class Iterator : public ParamIteratorInterface<ParamType> {
14245    public:
14246     Iterator(const ParamGeneratorInterface<ParamType>* base,
14247       const ParamGenerator<T1>& g1,
14248       const typename ParamGenerator<T1>::iterator& current1,
14249       const ParamGenerator<T2>& g2,
14250       const typename ParamGenerator<T2>::iterator& current2,
14251       const ParamGenerator<T3>& g3,
14252       const typename ParamGenerator<T3>::iterator& current3,
14253       const ParamGenerator<T4>& g4,
14254       const typename ParamGenerator<T4>::iterator& current4,
14255       const ParamGenerator<T5>& g5,
14256       const typename ParamGenerator<T5>::iterator& current5)
14257         : base_(base),
14258           begin1_(g1.begin()), end1_(g1.end()), current1_(current1),
14259           begin2_(g2.begin()), end2_(g2.end()), current2_(current2),
14260           begin3_(g3.begin()), end3_(g3.end()), current3_(current3),
14261           begin4_(g4.begin()), end4_(g4.end()), current4_(current4),
14262           begin5_(g5.begin()), end5_(g5.end()), current5_(current5)    {
14263       ComputeCurrentValue();
14264     }
14265     virtual ~Iterator() {}
14266
14267     virtual const ParamGeneratorInterface<ParamType>* BaseGenerator() const {
14268       return base_;
14269     }
14270     // Advance should not be called on beyond-of-range iterators
14271     // so no component iterators must be beyond end of range, either.
14272     virtual void Advance() {
14273       assert(!AtEnd());
14274       ++current5_;
14275       if (current5_ == end5_) {
14276         current5_ = begin5_;
14277         ++current4_;
14278       }
14279       if (current4_ == end4_) {
14280         current4_ = begin4_;
14281         ++current3_;
14282       }
14283       if (current3_ == end3_) {
14284         current3_ = begin3_;
14285         ++current2_;
14286       }
14287       if (current2_ == end2_) {
14288         current2_ = begin2_;
14289         ++current1_;
14290       }
14291       ComputeCurrentValue();
14292     }
14293     virtual ParamIteratorInterface<ParamType>* Clone() const {
14294       return new Iterator(*this);
14295     }
14296     virtual const ParamType* Current() const { return &current_value_; }
14297     virtual bool Equals(const ParamIteratorInterface<ParamType>& other) const {
14298       // Having the same base generator guarantees that the other
14299       // iterator is of the same type and we can downcast.
14300       GTEST_CHECK_(BaseGenerator() == other.BaseGenerator())
14301           << "The program attempted to compare iterators "
14302           << "from different generators." << std::endl;
14303       const Iterator* typed_other =
14304           CheckedDowncastToActualType<const Iterator>(&other);
14305       // We must report iterators equal if they both point beyond their
14306       // respective ranges. That can happen in a variety of fashions,
14307       // so we have to consult AtEnd().
14308       return (AtEnd() && typed_other->AtEnd()) ||
14309          (
14310           current1_ == typed_other->current1_ &&
14311           current2_ == typed_other->current2_ &&
14312           current3_ == typed_other->current3_ &&
14313           current4_ == typed_other->current4_ &&
14314           current5_ == typed_other->current5_);
14315     }
14316
14317    private:
14318     Iterator(const Iterator& other)
14319         : base_(other.base_),
14320         begin1_(other.begin1_),
14321         end1_(other.end1_),
14322         current1_(other.current1_),
14323         begin2_(other.begin2_),
14324         end2_(other.end2_),
14325         current2_(other.current2_),
14326         begin3_(other.begin3_),
14327         end3_(other.end3_),
14328         current3_(other.current3_),
14329         begin4_(other.begin4_),
14330         end4_(other.end4_),
14331         current4_(other.current4_),
14332         begin5_(other.begin5_),
14333         end5_(other.end5_),
14334         current5_(other.current5_) {
14335       ComputeCurrentValue();
14336     }
14337
14338     void ComputeCurrentValue() {
14339       if (!AtEnd())
14340         current_value_ = ParamType(*current1_, *current2_, *current3_,
14341             *current4_, *current5_);
14342     }
14343     bool AtEnd() const {
14344       // We must report iterator past the end of the range when either of the
14345       // component iterators has reached the end of its range.
14346       return
14347           current1_ == end1_ ||
14348           current2_ == end2_ ||
14349           current3_ == end3_ ||
14350           current4_ == end4_ ||
14351           current5_ == end5_;
14352     }
14353
14354     // No implementation - assignment is unsupported.
14355     void operator=(const Iterator& other);
14356
14357     const ParamGeneratorInterface<ParamType>* const base_;
14358     // begin[i]_ and end[i]_ define the i-th range that Iterator traverses.
14359     // current[i]_ is the actual traversing iterator.
14360     const typename ParamGenerator<T1>::iterator begin1_;
14361     const typename ParamGenerator<T1>::iterator end1_;
14362     typename ParamGenerator<T1>::iterator current1_;
14363     const typename ParamGenerator<T2>::iterator begin2_;
14364     const typename ParamGenerator<T2>::iterator end2_;
14365     typename ParamGenerator<T2>::iterator current2_;
14366     const typename ParamGenerator<T3>::iterator begin3_;
14367     const typename ParamGenerator<T3>::iterator end3_;
14368     typename ParamGenerator<T3>::iterator current3_;
14369     const typename ParamGenerator<T4>::iterator begin4_;
14370     const typename ParamGenerator<T4>::iterator end4_;
14371     typename ParamGenerator<T4>::iterator current4_;
14372     const typename ParamGenerator<T5>::iterator begin5_;
14373     const typename ParamGenerator<T5>::iterator end5_;
14374     typename ParamGenerator<T5>::iterator current5_;
14375     ParamType current_value_;
14376   };  // class CartesianProductGenerator5::Iterator
14377
14378   // No implementation - assignment is unsupported.
14379   void operator=(const CartesianProductGenerator5& other);
14380
14381   const ParamGenerator<T1> g1_;
14382   const ParamGenerator<T2> g2_;
14383   const ParamGenerator<T3> g3_;
14384   const ParamGenerator<T4> g4_;
14385   const ParamGenerator<T5> g5_;
14386 };  // class CartesianProductGenerator5
14387
14388
14389 template <typename T1, typename T2, typename T3, typename T4, typename T5,
14390     typename T6>
14391 class CartesianProductGenerator6
14392     : public ParamGeneratorInterface< ::std::tr1::tuple<T1, T2, T3, T4, T5,
14393         T6> > {
14394  public:
14395   typedef ::std::tr1::tuple<T1, T2, T3, T4, T5, T6> ParamType;
14396
14397   CartesianProductGenerator6(const ParamGenerator<T1>& g1,
14398       const ParamGenerator<T2>& g2, const ParamGenerator<T3>& g3,
14399       const ParamGenerator<T4>& g4, const ParamGenerator<T5>& g5,
14400       const ParamGenerator<T6>& g6)
14401       : g1_(g1), g2_(g2), g3_(g3), g4_(g4), g5_(g5), g6_(g6) {}
14402   virtual ~CartesianProductGenerator6() {}
14403
14404   virtual ParamIteratorInterface<ParamType>* Begin() const {
14405     return new Iterator(this, g1_, g1_.begin(), g2_, g2_.begin(), g3_,
14406         g3_.begin(), g4_, g4_.begin(), g5_, g5_.begin(), g6_, g6_.begin());
14407   }
14408   virtual ParamIteratorInterface<ParamType>* End() const {
14409     return new Iterator(this, g1_, g1_.end(), g2_, g2_.end(), g3_, g3_.end(),
14410         g4_, g4_.end(), g5_, g5_.end(), g6_, g6_.end());
14411   }
14412
14413  private:
14414   class Iterator : public ParamIteratorInterface<ParamType> {
14415    public:
14416     Iterator(const ParamGeneratorInterface<ParamType>* base,
14417       const ParamGenerator<T1>& g1,
14418       const typename ParamGenerator<T1>::iterator& current1,
14419       const ParamGenerator<T2>& g2,
14420       const typename ParamGenerator<T2>::iterator& current2,
14421       const ParamGenerator<T3>& g3,
14422       const typename ParamGenerator<T3>::iterator& current3,
14423       const ParamGenerator<T4>& g4,
14424       const typename ParamGenerator<T4>::iterator& current4,
14425       const ParamGenerator<T5>& g5,
14426       const typename ParamGenerator<T5>::iterator& current5,
14427       const ParamGenerator<T6>& g6,
14428       const typename ParamGenerator<T6>::iterator& current6)
14429         : base_(base),
14430           begin1_(g1.begin()), end1_(g1.end()), current1_(current1),
14431           begin2_(g2.begin()), end2_(g2.end()), current2_(current2),
14432           begin3_(g3.begin()), end3_(g3.end()), current3_(current3),
14433           begin4_(g4.begin()), end4_(g4.end()), current4_(current4),
14434           begin5_(g5.begin()), end5_(g5.end()), current5_(current5),
14435           begin6_(g6.begin()), end6_(g6.end()), current6_(current6)    {
14436       ComputeCurrentValue();
14437     }
14438     virtual ~Iterator() {}
14439
14440     virtual const ParamGeneratorInterface<ParamType>* BaseGenerator() const {
14441       return base_;
14442     }
14443     // Advance should not be called on beyond-of-range iterators
14444     // so no component iterators must be beyond end of range, either.
14445     virtual void Advance() {
14446       assert(!AtEnd());
14447       ++current6_;
14448       if (current6_ == end6_) {
14449         current6_ = begin6_;
14450         ++current5_;
14451       }
14452       if (current5_ == end5_) {
14453         current5_ = begin5_;
14454         ++current4_;
14455       }
14456       if (current4_ == end4_) {
14457         current4_ = begin4_;
14458         ++current3_;
14459       }
14460       if (current3_ == end3_) {
14461         current3_ = begin3_;
14462         ++current2_;
14463       }
14464       if (current2_ == end2_) {
14465         current2_ = begin2_;
14466         ++current1_;
14467       }
14468       ComputeCurrentValue();
14469     }
14470     virtual ParamIteratorInterface<ParamType>* Clone() const {
14471       return new Iterator(*this);
14472     }
14473     virtual const ParamType* Current() const { return &current_value_; }
14474     virtual bool Equals(const ParamIteratorInterface<ParamType>& other) const {
14475       // Having the same base generator guarantees that the other
14476       // iterator is of the same type and we can downcast.
14477       GTEST_CHECK_(BaseGenerator() == other.BaseGenerator())
14478           << "The program attempted to compare iterators "
14479           << "from different generators." << std::endl;
14480       const Iterator* typed_other =
14481           CheckedDowncastToActualType<const Iterator>(&other);
14482       // We must report iterators equal if they both point beyond their
14483       // respective ranges. That can happen in a variety of fashions,
14484       // so we have to consult AtEnd().
14485       return (AtEnd() && typed_other->AtEnd()) ||
14486          (
14487           current1_ == typed_other->current1_ &&
14488           current2_ == typed_other->current2_ &&
14489           current3_ == typed_other->current3_ &&
14490           current4_ == typed_other->current4_ &&
14491           current5_ == typed_other->current5_ &&
14492           current6_ == typed_other->current6_);
14493     }
14494
14495    private:
14496     Iterator(const Iterator& other)
14497         : base_(other.base_),
14498         begin1_(other.begin1_),
14499         end1_(other.end1_),
14500         current1_(other.current1_),
14501         begin2_(other.begin2_),
14502         end2_(other.end2_),
14503         current2_(other.current2_),
14504         begin3_(other.begin3_),
14505         end3_(other.end3_),
14506         current3_(other.current3_),
14507         begin4_(other.begin4_),
14508         end4_(other.end4_),
14509         current4_(other.current4_),
14510         begin5_(other.begin5_),
14511         end5_(other.end5_),
14512         current5_(other.current5_),
14513         begin6_(other.begin6_),
14514         end6_(other.end6_),
14515         current6_(other.current6_) {
14516       ComputeCurrentValue();
14517     }
14518
14519     void ComputeCurrentValue() {
14520       if (!AtEnd())
14521         current_value_ = ParamType(*current1_, *current2_, *current3_,
14522             *current4_, *current5_, *current6_);
14523     }
14524     bool AtEnd() const {
14525       // We must report iterator past the end of the range when either of the
14526       // component iterators has reached the end of its range.
14527       return
14528           current1_ == end1_ ||
14529           current2_ == end2_ ||
14530           current3_ == end3_ ||
14531           current4_ == end4_ ||
14532           current5_ == end5_ ||
14533           current6_ == end6_;
14534     }
14535
14536     // No implementation - assignment is unsupported.
14537     void operator=(const Iterator& other);
14538
14539     const ParamGeneratorInterface<ParamType>* const base_;
14540     // begin[i]_ and end[i]_ define the i-th range that Iterator traverses.
14541     // current[i]_ is the actual traversing iterator.
14542     const typename ParamGenerator<T1>::iterator begin1_;
14543     const typename ParamGenerator<T1>::iterator end1_;
14544     typename ParamGenerator<T1>::iterator current1_;
14545     const typename ParamGenerator<T2>::iterator begin2_;
14546     const typename ParamGenerator<T2>::iterator end2_;
14547     typename ParamGenerator<T2>::iterator current2_;
14548     const typename ParamGenerator<T3>::iterator begin3_;
14549     const typename ParamGenerator<T3>::iterator end3_;
14550     typename ParamGenerator<T3>::iterator current3_;
14551     const typename ParamGenerator<T4>::iterator begin4_;
14552     const typename ParamGenerator<T4>::iterator end4_;
14553     typename ParamGenerator<T4>::iterator current4_;
14554     const typename ParamGenerator<T5>::iterator begin5_;
14555     const typename ParamGenerator<T5>::iterator end5_;
14556     typename ParamGenerator<T5>::iterator current5_;
14557     const typename ParamGenerator<T6>::iterator begin6_;
14558     const typename ParamGenerator<T6>::iterator end6_;
14559     typename ParamGenerator<T6>::iterator current6_;
14560     ParamType current_value_;
14561   };  // class CartesianProductGenerator6::Iterator
14562
14563   // No implementation - assignment is unsupported.
14564   void operator=(const CartesianProductGenerator6& other);
14565
14566   const ParamGenerator<T1> g1_;
14567   const ParamGenerator<T2> g2_;
14568   const ParamGenerator<T3> g3_;
14569   const ParamGenerator<T4> g4_;
14570   const ParamGenerator<T5> g5_;
14571   const ParamGenerator<T6> g6_;
14572 };  // class CartesianProductGenerator6
14573
14574
14575 template <typename T1, typename T2, typename T3, typename T4, typename T5,
14576     typename T6, typename T7>
14577 class CartesianProductGenerator7
14578     : public ParamGeneratorInterface< ::std::tr1::tuple<T1, T2, T3, T4, T5, T6,
14579         T7> > {
14580  public:
14581   typedef ::std::tr1::tuple<T1, T2, T3, T4, T5, T6, T7> ParamType;
14582
14583   CartesianProductGenerator7(const ParamGenerator<T1>& g1,
14584       const ParamGenerator<T2>& g2, const ParamGenerator<T3>& g3,
14585       const ParamGenerator<T4>& g4, const ParamGenerator<T5>& g5,
14586       const ParamGenerator<T6>& g6, const ParamGenerator<T7>& g7)
14587       : g1_(g1), g2_(g2), g3_(g3), g4_(g4), g5_(g5), g6_(g6), g7_(g7) {}
14588   virtual ~CartesianProductGenerator7() {}
14589
14590   virtual ParamIteratorInterface<ParamType>* Begin() const {
14591     return new Iterator(this, g1_, g1_.begin(), g2_, g2_.begin(), g3_,
14592         g3_.begin(), g4_, g4_.begin(), g5_, g5_.begin(), g6_, g6_.begin(), g7_,
14593         g7_.begin());
14594   }
14595   virtual ParamIteratorInterface<ParamType>* End() const {
14596     return new Iterator(this, g1_, g1_.end(), g2_, g2_.end(), g3_, g3_.end(),
14597         g4_, g4_.end(), g5_, g5_.end(), g6_, g6_.end(), g7_, g7_.end());
14598   }
14599
14600  private:
14601   class Iterator : public ParamIteratorInterface<ParamType> {
14602    public:
14603     Iterator(const ParamGeneratorInterface<ParamType>* base,
14604       const ParamGenerator<T1>& g1,
14605       const typename ParamGenerator<T1>::iterator& current1,
14606       const ParamGenerator<T2>& g2,
14607       const typename ParamGenerator<T2>::iterator& current2,
14608       const ParamGenerator<T3>& g3,
14609       const typename ParamGenerator<T3>::iterator& current3,
14610       const ParamGenerator<T4>& g4,
14611       const typename ParamGenerator<T4>::iterator& current4,
14612       const ParamGenerator<T5>& g5,
14613       const typename ParamGenerator<T5>::iterator& current5,
14614       const ParamGenerator<T6>& g6,
14615       const typename ParamGenerator<T6>::iterator& current6,
14616       const ParamGenerator<T7>& g7,
14617       const typename ParamGenerator<T7>::iterator& current7)
14618         : base_(base),
14619           begin1_(g1.begin()), end1_(g1.end()), current1_(current1),
14620           begin2_(g2.begin()), end2_(g2.end()), current2_(current2),
14621           begin3_(g3.begin()), end3_(g3.end()), current3_(current3),
14622           begin4_(g4.begin()), end4_(g4.end()), current4_(current4),
14623           begin5_(g5.begin()), end5_(g5.end()), current5_(current5),
14624           begin6_(g6.begin()), end6_(g6.end()), current6_(current6),
14625           begin7_(g7.begin()), end7_(g7.end()), current7_(current7)    {
14626       ComputeCurrentValue();
14627     }
14628     virtual ~Iterator() {}
14629
14630     virtual const ParamGeneratorInterface<ParamType>* BaseGenerator() const {
14631       return base_;
14632     }
14633     // Advance should not be called on beyond-of-range iterators
14634     // so no component iterators must be beyond end of range, either.
14635     virtual void Advance() {
14636       assert(!AtEnd());
14637       ++current7_;
14638       if (current7_ == end7_) {
14639         current7_ = begin7_;
14640         ++current6_;
14641       }
14642       if (current6_ == end6_) {
14643         current6_ = begin6_;
14644         ++current5_;
14645       }
14646       if (current5_ == end5_) {
14647         current5_ = begin5_;
14648         ++current4_;
14649       }
14650       if (current4_ == end4_) {
14651         current4_ = begin4_;
14652         ++current3_;
14653       }
14654       if (current3_ == end3_) {
14655         current3_ = begin3_;
14656         ++current2_;
14657       }
14658       if (current2_ == end2_) {
14659         current2_ = begin2_;
14660         ++current1_;
14661       }
14662       ComputeCurrentValue();
14663     }
14664     virtual ParamIteratorInterface<ParamType>* Clone() const {
14665       return new Iterator(*this);
14666     }
14667     virtual const ParamType* Current() const { return &current_value_; }
14668     virtual bool Equals(const ParamIteratorInterface<ParamType>& other) const {
14669       // Having the same base generator guarantees that the other
14670       // iterator is of the same type and we can downcast.
14671       GTEST_CHECK_(BaseGenerator() == other.BaseGenerator())
14672           << "The program attempted to compare iterators "
14673           << "from different generators." << std::endl;
14674       const Iterator* typed_other =
14675           CheckedDowncastToActualType<const Iterator>(&other);
14676       // We must report iterators equal if they both point beyond their
14677       // respective ranges. That can happen in a variety of fashions,
14678       // so we have to consult AtEnd().
14679       return (AtEnd() && typed_other->AtEnd()) ||
14680          (
14681           current1_ == typed_other->current1_ &&
14682           current2_ == typed_other->current2_ &&
14683           current3_ == typed_other->current3_ &&
14684           current4_ == typed_other->current4_ &&
14685           current5_ == typed_other->current5_ &&
14686           current6_ == typed_other->current6_ &&
14687           current7_ == typed_other->current7_);
14688     }
14689
14690    private:
14691     Iterator(const Iterator& other)
14692         : base_(other.base_),
14693         begin1_(other.begin1_),
14694         end1_(other.end1_),
14695         current1_(other.current1_),
14696         begin2_(other.begin2_),
14697         end2_(other.end2_),
14698         current2_(other.current2_),
14699         begin3_(other.begin3_),
14700         end3_(other.end3_),
14701         current3_(other.current3_),
14702         begin4_(other.begin4_),
14703         end4_(other.end4_),
14704         current4_(other.current4_),
14705         begin5_(other.begin5_),
14706         end5_(other.end5_),
14707         current5_(other.current5_),
14708         begin6_(other.begin6_),
14709         end6_(other.end6_),
14710         current6_(other.current6_),
14711         begin7_(other.begin7_),
14712         end7_(other.end7_),
14713         current7_(other.current7_) {
14714       ComputeCurrentValue();
14715     }
14716
14717     void ComputeCurrentValue() {
14718       if (!AtEnd())
14719         current_value_ = ParamType(*current1_, *current2_, *current3_,
14720             *current4_, *current5_, *current6_, *current7_);
14721     }
14722     bool AtEnd() const {
14723       // We must report iterator past the end of the range when either of the
14724       // component iterators has reached the end of its range.
14725       return
14726           current1_ == end1_ ||
14727           current2_ == end2_ ||
14728           current3_ == end3_ ||
14729           current4_ == end4_ ||
14730           current5_ == end5_ ||
14731           current6_ == end6_ ||
14732           current7_ == end7_;
14733     }
14734
14735     // No implementation - assignment is unsupported.
14736     void operator=(const Iterator& other);
14737
14738     const ParamGeneratorInterface<ParamType>* const base_;
14739     // begin[i]_ and end[i]_ define the i-th range that Iterator traverses.
14740     // current[i]_ is the actual traversing iterator.
14741     const typename ParamGenerator<T1>::iterator begin1_;
14742     const typename ParamGenerator<T1>::iterator end1_;
14743     typename ParamGenerator<T1>::iterator current1_;
14744     const typename ParamGenerator<T2>::iterator begin2_;
14745     const typename ParamGenerator<T2>::iterator end2_;
14746     typename ParamGenerator<T2>::iterator current2_;
14747     const typename ParamGenerator<T3>::iterator begin3_;
14748     const typename ParamGenerator<T3>::iterator end3_;
14749     typename ParamGenerator<T3>::iterator current3_;
14750     const typename ParamGenerator<T4>::iterator begin4_;
14751     const typename ParamGenerator<T4>::iterator end4_;
14752     typename ParamGenerator<T4>::iterator current4_;
14753     const typename ParamGenerator<T5>::iterator begin5_;
14754     const typename ParamGenerator<T5>::iterator end5_;
14755     typename ParamGenerator<T5>::iterator current5_;
14756     const typename ParamGenerator<T6>::iterator begin6_;
14757     const typename ParamGenerator<T6>::iterator end6_;
14758     typename ParamGenerator<T6>::iterator current6_;
14759     const typename ParamGenerator<T7>::iterator begin7_;
14760     const typename ParamGenerator<T7>::iterator end7_;
14761     typename ParamGenerator<T7>::iterator current7_;
14762     ParamType current_value_;
14763   };  // class CartesianProductGenerator7::Iterator
14764
14765   // No implementation - assignment is unsupported.
14766   void operator=(const CartesianProductGenerator7& other);
14767
14768   const ParamGenerator<T1> g1_;
14769   const ParamGenerator<T2> g2_;
14770   const ParamGenerator<T3> g3_;
14771   const ParamGenerator<T4> g4_;
14772   const ParamGenerator<T5> g5_;
14773   const ParamGenerator<T6> g6_;
14774   const ParamGenerator<T7> g7_;
14775 };  // class CartesianProductGenerator7
14776
14777
14778 template <typename T1, typename T2, typename T3, typename T4, typename T5,
14779     typename T6, typename T7, typename T8>
14780 class CartesianProductGenerator8
14781     : public ParamGeneratorInterface< ::std::tr1::tuple<T1, T2, T3, T4, T5, T6,
14782         T7, T8> > {
14783  public:
14784   typedef ::std::tr1::tuple<T1, T2, T3, T4, T5, T6, T7, T8> ParamType;
14785
14786   CartesianProductGenerator8(const ParamGenerator<T1>& g1,
14787       const ParamGenerator<T2>& g2, const ParamGenerator<T3>& g3,
14788       const ParamGenerator<T4>& g4, const ParamGenerator<T5>& g5,
14789       const ParamGenerator<T6>& g6, const ParamGenerator<T7>& g7,
14790       const ParamGenerator<T8>& g8)
14791       : g1_(g1), g2_(g2), g3_(g3), g4_(g4), g5_(g5), g6_(g6), g7_(g7),
14792           g8_(g8) {}
14793   virtual ~CartesianProductGenerator8() {}
14794
14795   virtual ParamIteratorInterface<ParamType>* Begin() const {
14796     return new Iterator(this, g1_, g1_.begin(), g2_, g2_.begin(), g3_,
14797         g3_.begin(), g4_, g4_.begin(), g5_, g5_.begin(), g6_, g6_.begin(), g7_,
14798         g7_.begin(), g8_, g8_.begin());
14799   }
14800   virtual ParamIteratorInterface<ParamType>* End() const {
14801     return new Iterator(this, g1_, g1_.end(), g2_, g2_.end(), g3_, g3_.end(),
14802         g4_, g4_.end(), g5_, g5_.end(), g6_, g6_.end(), g7_, g7_.end(), g8_,
14803         g8_.end());
14804   }
14805
14806  private:
14807   class Iterator : public ParamIteratorInterface<ParamType> {
14808    public:
14809     Iterator(const ParamGeneratorInterface<ParamType>* base,
14810       const ParamGenerator<T1>& g1,
14811       const typename ParamGenerator<T1>::iterator& current1,
14812       const ParamGenerator<T2>& g2,
14813       const typename ParamGenerator<T2>::iterator& current2,
14814       const ParamGenerator<T3>& g3,
14815       const typename ParamGenerator<T3>::iterator& current3,
14816       const ParamGenerator<T4>& g4,
14817       const typename ParamGenerator<T4>::iterator& current4,
14818       const ParamGenerator<T5>& g5,
14819       const typename ParamGenerator<T5>::iterator& current5,
14820       const ParamGenerator<T6>& g6,
14821       const typename ParamGenerator<T6>::iterator& current6,
14822       const ParamGenerator<T7>& g7,
14823       const typename ParamGenerator<T7>::iterator& current7,
14824       const ParamGenerator<T8>& g8,
14825       const typename ParamGenerator<T8>::iterator& current8)
14826         : base_(base),
14827           begin1_(g1.begin()), end1_(g1.end()), current1_(current1),
14828           begin2_(g2.begin()), end2_(g2.end()), current2_(current2),
14829           begin3_(g3.begin()), end3_(g3.end()), current3_(current3),
14830           begin4_(g4.begin()), end4_(g4.end()), current4_(current4),
14831           begin5_(g5.begin()), end5_(g5.end()), current5_(current5),
14832           begin6_(g6.begin()), end6_(g6.end()), current6_(current6),
14833           begin7_(g7.begin()), end7_(g7.end()), current7_(current7),
14834           begin8_(g8.begin()), end8_(g8.end()), current8_(current8)    {
14835       ComputeCurrentValue();
14836     }
14837     virtual ~Iterator() {}
14838
14839     virtual const ParamGeneratorInterface<ParamType>* BaseGenerator() const {
14840       return base_;
14841     }
14842     // Advance should not be called on beyond-of-range iterators
14843     // so no component iterators must be beyond end of range, either.
14844     virtual void Advance() {
14845       assert(!AtEnd());
14846       ++current8_;
14847       if (current8_ == end8_) {
14848         current8_ = begin8_;
14849         ++current7_;
14850       }
14851       if (current7_ == end7_) {
14852         current7_ = begin7_;
14853         ++current6_;
14854       }
14855       if (current6_ == end6_) {
14856         current6_ = begin6_;
14857         ++current5_;
14858       }
14859       if (current5_ == end5_) {
14860         current5_ = begin5_;
14861         ++current4_;
14862       }
14863       if (current4_ == end4_) {
14864         current4_ = begin4_;
14865         ++current3_;
14866       }
14867       if (current3_ == end3_) {
14868         current3_ = begin3_;
14869         ++current2_;
14870       }
14871       if (current2_ == end2_) {
14872         current2_ = begin2_;
14873         ++current1_;
14874       }
14875       ComputeCurrentValue();
14876     }
14877     virtual ParamIteratorInterface<ParamType>* Clone() const {
14878       return new Iterator(*this);
14879     }
14880     virtual const ParamType* Current() const { return &current_value_; }
14881     virtual bool Equals(const ParamIteratorInterface<ParamType>& other) const {
14882       // Having the same base generator guarantees that the other
14883       // iterator is of the same type and we can downcast.
14884       GTEST_CHECK_(BaseGenerator() == other.BaseGenerator())
14885           << "The program attempted to compare iterators "
14886           << "from different generators." << std::endl;
14887       const Iterator* typed_other =
14888           CheckedDowncastToActualType<const Iterator>(&other);
14889       // We must report iterators equal if they both point beyond their
14890       // respective ranges. That can happen in a variety of fashions,
14891       // so we have to consult AtEnd().
14892       return (AtEnd() && typed_other->AtEnd()) ||
14893          (
14894           current1_ == typed_other->current1_ &&
14895           current2_ == typed_other->current2_ &&
14896           current3_ == typed_other->current3_ &&
14897           current4_ == typed_other->current4_ &&
14898           current5_ == typed_other->current5_ &&
14899           current6_ == typed_other->current6_ &&
14900           current7_ == typed_other->current7_ &&
14901           current8_ == typed_other->current8_);
14902     }
14903
14904    private:
14905     Iterator(const Iterator& other)
14906         : base_(other.base_),
14907         begin1_(other.begin1_),
14908         end1_(other.end1_),
14909         current1_(other.current1_),
14910         begin2_(other.begin2_),
14911         end2_(other.end2_),
14912         current2_(other.current2_),
14913         begin3_(other.begin3_),
14914         end3_(other.end3_),
14915         current3_(other.current3_),
14916         begin4_(other.begin4_),
14917         end4_(other.end4_),
14918         current4_(other.current4_),
14919         begin5_(other.begin5_),
14920         end5_(other.end5_),
14921         current5_(other.current5_),
14922         begin6_(other.begin6_),
14923         end6_(other.end6_),
14924         current6_(other.current6_),
14925         begin7_(other.begin7_),
14926         end7_(other.end7_),
14927         current7_(other.current7_),
14928         begin8_(other.begin8_),
14929         end8_(other.end8_),
14930         current8_(other.current8_) {
14931       ComputeCurrentValue();
14932     }
14933
14934     void ComputeCurrentValue() {
14935       if (!AtEnd())
14936         current_value_ = ParamType(*current1_, *current2_, *current3_,
14937             *current4_, *current5_, *current6_, *current7_, *current8_);
14938     }
14939     bool AtEnd() const {
14940       // We must report iterator past the end of the range when either of the
14941       // component iterators has reached the end of its range.
14942       return
14943           current1_ == end1_ ||
14944           current2_ == end2_ ||
14945           current3_ == end3_ ||
14946           current4_ == end4_ ||
14947           current5_ == end5_ ||
14948           current6_ == end6_ ||
14949           current7_ == end7_ ||
14950           current8_ == end8_;
14951     }
14952
14953     // No implementation - assignment is unsupported.
14954     void operator=(const Iterator& other);
14955
14956     const ParamGeneratorInterface<ParamType>* const base_;
14957     // begin[i]_ and end[i]_ define the i-th range that Iterator traverses.
14958     // current[i]_ is the actual traversing iterator.
14959     const typename ParamGenerator<T1>::iterator begin1_;
14960     const typename ParamGenerator<T1>::iterator end1_;
14961     typename ParamGenerator<T1>::iterator current1_;
14962     const typename ParamGenerator<T2>::iterator begin2_;
14963     const typename ParamGenerator<T2>::iterator end2_;
14964     typename ParamGenerator<T2>::iterator current2_;
14965     const typename ParamGenerator<T3>::iterator begin3_;
14966     const typename ParamGenerator<T3>::iterator end3_;
14967     typename ParamGenerator<T3>::iterator current3_;
14968     const typename ParamGenerator<T4>::iterator begin4_;
14969     const typename ParamGenerator<T4>::iterator end4_;
14970     typename ParamGenerator<T4>::iterator current4_;
14971     const typename ParamGenerator<T5>::iterator begin5_;
14972     const typename ParamGenerator<T5>::iterator end5_;
14973     typename ParamGenerator<T5>::iterator current5_;
14974     const typename ParamGenerator<T6>::iterator begin6_;
14975     const typename ParamGenerator<T6>::iterator end6_;
14976     typename ParamGenerator<T6>::iterator current6_;
14977     const typename ParamGenerator<T7>::iterator begin7_;
14978     const typename ParamGenerator<T7>::iterator end7_;
14979     typename ParamGenerator<T7>::iterator current7_;
14980     const typename ParamGenerator<T8>::iterator begin8_;
14981     const typename ParamGenerator<T8>::iterator end8_;
14982     typename ParamGenerator<T8>::iterator current8_;
14983     ParamType current_value_;
14984   };  // class CartesianProductGenerator8::Iterator
14985
14986   // No implementation - assignment is unsupported.
14987   void operator=(const CartesianProductGenerator8& other);
14988
14989   const ParamGenerator<T1> g1_;
14990   const ParamGenerator<T2> g2_;
14991   const ParamGenerator<T3> g3_;
14992   const ParamGenerator<T4> g4_;
14993   const ParamGenerator<T5> g5_;
14994   const ParamGenerator<T6> g6_;
14995   const ParamGenerator<T7> g7_;
14996   const ParamGenerator<T8> g8_;
14997 };  // class CartesianProductGenerator8
14998
14999
15000 template <typename T1, typename T2, typename T3, typename T4, typename T5,
15001     typename T6, typename T7, typename T8, typename T9>
15002 class CartesianProductGenerator9
15003     : public ParamGeneratorInterface< ::std::tr1::tuple<T1, T2, T3, T4, T5, T6,
15004         T7, T8, T9> > {
15005  public:
15006   typedef ::std::tr1::tuple<T1, T2, T3, T4, T5, T6, T7, T8, T9> ParamType;
15007
15008   CartesianProductGenerator9(const ParamGenerator<T1>& g1,
15009       const ParamGenerator<T2>& g2, const ParamGenerator<T3>& g3,
15010       const ParamGenerator<T4>& g4, const ParamGenerator<T5>& g5,
15011       const ParamGenerator<T6>& g6, const ParamGenerator<T7>& g7,
15012       const ParamGenerator<T8>& g8, const ParamGenerator<T9>& g9)
15013       : g1_(g1), g2_(g2), g3_(g3), g4_(g4), g5_(g5), g6_(g6), g7_(g7), g8_(g8),
15014           g9_(g9) {}
15015   virtual ~CartesianProductGenerator9() {}
15016
15017   virtual ParamIteratorInterface<ParamType>* Begin() const {
15018     return new Iterator(this, g1_, g1_.begin(), g2_, g2_.begin(), g3_,
15019         g3_.begin(), g4_, g4_.begin(), g5_, g5_.begin(), g6_, g6_.begin(), g7_,
15020         g7_.begin(), g8_, g8_.begin(), g9_, g9_.begin());
15021   }
15022   virtual ParamIteratorInterface<ParamType>* End() const {
15023     return new Iterator(this, g1_, g1_.end(), g2_, g2_.end(), g3_, g3_.end(),
15024         g4_, g4_.end(), g5_, g5_.end(), g6_, g6_.end(), g7_, g7_.end(), g8_,
15025         g8_.end(), g9_, g9_.end());
15026   }
15027
15028  private:
15029   class Iterator : public ParamIteratorInterface<ParamType> {
15030    public:
15031     Iterator(const ParamGeneratorInterface<ParamType>* base,
15032       const ParamGenerator<T1>& g1,
15033       const typename ParamGenerator<T1>::iterator& current1,
15034       const ParamGenerator<T2>& g2,
15035       const typename ParamGenerator<T2>::iterator& current2,
15036       const ParamGenerator<T3>& g3,
15037       const typename ParamGenerator<T3>::iterator& current3,
15038       const ParamGenerator<T4>& g4,
15039       const typename ParamGenerator<T4>::iterator& current4,
15040       const ParamGenerator<T5>& g5,
15041       const typename ParamGenerator<T5>::iterator& current5,
15042       const ParamGenerator<T6>& g6,
15043       const typename ParamGenerator<T6>::iterator& current6,
15044       const ParamGenerator<T7>& g7,
15045       const typename ParamGenerator<T7>::iterator& current7,
15046       const ParamGenerator<T8>& g8,
15047       const typename ParamGenerator<T8>::iterator& current8,
15048       const ParamGenerator<T9>& g9,
15049       const typename ParamGenerator<T9>::iterator& current9)
15050         : base_(base),
15051           begin1_(g1.begin()), end1_(g1.end()), current1_(current1),
15052           begin2_(g2.begin()), end2_(g2.end()), current2_(current2),
15053           begin3_(g3.begin()), end3_(g3.end()), current3_(current3),
15054           begin4_(g4.begin()), end4_(g4.end()), current4_(current4),
15055           begin5_(g5.begin()), end5_(g5.end()), current5_(current5),
15056           begin6_(g6.begin()), end6_(g6.end()), current6_(current6),
15057           begin7_(g7.begin()), end7_(g7.end()), current7_(current7),
15058           begin8_(g8.begin()), end8_(g8.end()), current8_(current8),
15059           begin9_(g9.begin()), end9_(g9.end()), current9_(current9)    {
15060       ComputeCurrentValue();
15061     }
15062     virtual ~Iterator() {}
15063
15064     virtual const ParamGeneratorInterface<ParamType>* BaseGenerator() const {
15065       return base_;
15066     }
15067     // Advance should not be called on beyond-of-range iterators
15068     // so no component iterators must be beyond end of range, either.
15069     virtual void Advance() {
15070       assert(!AtEnd());
15071       ++current9_;
15072       if (current9_ == end9_) {
15073         current9_ = begin9_;
15074         ++current8_;
15075       }
15076       if (current8_ == end8_) {
15077         current8_ = begin8_;
15078         ++current7_;
15079       }
15080       if (current7_ == end7_) {
15081         current7_ = begin7_;
15082         ++current6_;
15083       }
15084       if (current6_ == end6_) {
15085         current6_ = begin6_;
15086         ++current5_;
15087       }
15088       if (current5_ == end5_) {
15089         current5_ = begin5_;
15090         ++current4_;
15091       }
15092       if (current4_ == end4_) {
15093         current4_ = begin4_;
15094         ++current3_;
15095       }
15096       if (current3_ == end3_) {
15097         current3_ = begin3_;
15098         ++current2_;
15099       }
15100       if (current2_ == end2_) {
15101         current2_ = begin2_;
15102         ++current1_;
15103       }
15104       ComputeCurrentValue();
15105     }
15106     virtual ParamIteratorInterface<ParamType>* Clone() const {
15107       return new Iterator(*this);
15108     }
15109     virtual const ParamType* Current() const { return &current_value_; }
15110     virtual bool Equals(const ParamIteratorInterface<ParamType>& other) const {
15111       // Having the same base generator guarantees that the other
15112       // iterator is of the same type and we can downcast.
15113       GTEST_CHECK_(BaseGenerator() == other.BaseGenerator())
15114           << "The program attempted to compare iterators "
15115           << "from different generators." << std::endl;
15116       const Iterator* typed_other =
15117           CheckedDowncastToActualType<const Iterator>(&other);
15118       // We must report iterators equal if they both point beyond their
15119       // respective ranges. That can happen in a variety of fashions,
15120       // so we have to consult AtEnd().
15121       return (AtEnd() && typed_other->AtEnd()) ||
15122          (
15123           current1_ == typed_other->current1_ &&
15124           current2_ == typed_other->current2_ &&
15125           current3_ == typed_other->current3_ &&
15126           current4_ == typed_other->current4_ &&
15127           current5_ == typed_other->current5_ &&
15128           current6_ == typed_other->current6_ &&
15129           current7_ == typed_other->current7_ &&
15130           current8_ == typed_other->current8_ &&
15131           current9_ == typed_other->current9_);
15132     }
15133
15134    private:
15135     Iterator(const Iterator& other)
15136         : base_(other.base_),
15137         begin1_(other.begin1_),
15138         end1_(other.end1_),
15139         current1_(other.current1_),
15140         begin2_(other.begin2_),
15141         end2_(other.end2_),
15142         current2_(other.current2_),
15143         begin3_(other.begin3_),
15144         end3_(other.end3_),
15145         current3_(other.current3_),
15146         begin4_(other.begin4_),
15147         end4_(other.end4_),
15148         current4_(other.current4_),
15149         begin5_(other.begin5_),
15150         end5_(other.end5_),
15151         current5_(other.current5_),
15152         begin6_(other.begin6_),
15153         end6_(other.end6_),
15154         current6_(other.current6_),
15155         begin7_(other.begin7_),
15156         end7_(other.end7_),
15157         current7_(other.current7_),
15158         begin8_(other.begin8_),
15159         end8_(other.end8_),
15160         current8_(other.current8_),
15161         begin9_(other.begin9_),
15162         end9_(other.end9_),
15163         current9_(other.current9_) {
15164       ComputeCurrentValue();
15165     }
15166
15167     void ComputeCurrentValue() {
15168       if (!AtEnd())
15169         current_value_ = ParamType(*current1_, *current2_, *current3_,
15170             *current4_, *current5_, *current6_, *current7_, *current8_,
15171             *current9_);
15172     }
15173     bool AtEnd() const {
15174       // We must report iterator past the end of the range when either of the
15175       // component iterators has reached the end of its range.
15176       return
15177           current1_ == end1_ ||
15178           current2_ == end2_ ||
15179           current3_ == end3_ ||
15180           current4_ == end4_ ||
15181           current5_ == end5_ ||
15182           current6_ == end6_ ||
15183           current7_ == end7_ ||
15184           current8_ == end8_ ||
15185           current9_ == end9_;
15186     }
15187
15188     // No implementation - assignment is unsupported.
15189     void operator=(const Iterator& other);
15190
15191     const ParamGeneratorInterface<ParamType>* const base_;
15192     // begin[i]_ and end[i]_ define the i-th range that Iterator traverses.
15193     // current[i]_ is the actual traversing iterator.
15194     const typename ParamGenerator<T1>::iterator begin1_;
15195     const typename ParamGenerator<T1>::iterator end1_;
15196     typename ParamGenerator<T1>::iterator current1_;
15197     const typename ParamGenerator<T2>::iterator begin2_;
15198     const typename ParamGenerator<T2>::iterator end2_;
15199     typename ParamGenerator<T2>::iterator current2_;
15200     const typename ParamGenerator<T3>::iterator begin3_;
15201     const typename ParamGenerator<T3>::iterator end3_;
15202     typename ParamGenerator<T3>::iterator current3_;
15203     const typename ParamGenerator<T4>::iterator begin4_;
15204     const typename ParamGenerator<T4>::iterator end4_;
15205     typename ParamGenerator<T4>::iterator current4_;
15206     const typename ParamGenerator<T5>::iterator begin5_;
15207     const typename ParamGenerator<T5>::iterator end5_;
15208     typename ParamGenerator<T5>::iterator current5_;
15209     const typename ParamGenerator<T6>::iterator begin6_;
15210     const typename ParamGenerator<T6>::iterator end6_;
15211     typename ParamGenerator<T6>::iterator current6_;
15212     const typename ParamGenerator<T7>::iterator begin7_;
15213     const typename ParamGenerator<T7>::iterator end7_;
15214     typename ParamGenerator<T7>::iterator current7_;
15215     const typename ParamGenerator<T8>::iterator begin8_;
15216     const typename ParamGenerator<T8>::iterator end8_;
15217     typename ParamGenerator<T8>::iterator current8_;
15218     const typename ParamGenerator<T9>::iterator begin9_;
15219     const typename ParamGenerator<T9>::iterator end9_;
15220     typename ParamGenerator<T9>::iterator current9_;
15221     ParamType current_value_;
15222   };  // class CartesianProductGenerator9::Iterator
15223
15224   // No implementation - assignment is unsupported.
15225   void operator=(const CartesianProductGenerator9& other);
15226
15227   const ParamGenerator<T1> g1_;
15228   const ParamGenerator<T2> g2_;
15229   const ParamGenerator<T3> g3_;
15230   const ParamGenerator<T4> g4_;
15231   const ParamGenerator<T5> g5_;
15232   const ParamGenerator<T6> g6_;
15233   const ParamGenerator<T7> g7_;
15234   const ParamGenerator<T8> g8_;
15235   const ParamGenerator<T9> g9_;
15236 };  // class CartesianProductGenerator9
15237
15238
15239 template <typename T1, typename T2, typename T3, typename T4, typename T5,
15240     typename T6, typename T7, typename T8, typename T9, typename T10>
15241 class CartesianProductGenerator10
15242     : public ParamGeneratorInterface< ::std::tr1::tuple<T1, T2, T3, T4, T5, T6,
15243         T7, T8, T9, T10> > {
15244  public:
15245   typedef ::std::tr1::tuple<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> ParamType;
15246
15247   CartesianProductGenerator10(const ParamGenerator<T1>& g1,
15248       const ParamGenerator<T2>& g2, const ParamGenerator<T3>& g3,
15249       const ParamGenerator<T4>& g4, const ParamGenerator<T5>& g5,
15250       const ParamGenerator<T6>& g6, const ParamGenerator<T7>& g7,
15251       const ParamGenerator<T8>& g8, const ParamGenerator<T9>& g9,
15252       const ParamGenerator<T10>& g10)
15253       : g1_(g1), g2_(g2), g3_(g3), g4_(g4), g5_(g5), g6_(g6), g7_(g7), g8_(g8),
15254           g9_(g9), g10_(g10) {}
15255   virtual ~CartesianProductGenerator10() {}
15256
15257   virtual ParamIteratorInterface<ParamType>* Begin() const {
15258     return new Iterator(this, g1_, g1_.begin(), g2_, g2_.begin(), g3_,
15259         g3_.begin(), g4_, g4_.begin(), g5_, g5_.begin(), g6_, g6_.begin(), g7_,
15260         g7_.begin(), g8_, g8_.begin(), g9_, g9_.begin(), g10_, g10_.begin());
15261   }
15262   virtual ParamIteratorInterface<ParamType>* End() const {
15263     return new Iterator(this, g1_, g1_.end(), g2_, g2_.end(), g3_, g3_.end(),
15264         g4_, g4_.end(), g5_, g5_.end(), g6_, g6_.end(), g7_, g7_.end(), g8_,
15265         g8_.end(), g9_, g9_.end(), g10_, g10_.end());
15266   }
15267
15268  private:
15269   class Iterator : public ParamIteratorInterface<ParamType> {
15270    public:
15271     Iterator(const ParamGeneratorInterface<ParamType>* base,
15272       const ParamGenerator<T1>& g1,
15273       const typename ParamGenerator<T1>::iterator& current1,
15274       const ParamGenerator<T2>& g2,
15275       const typename ParamGenerator<T2>::iterator& current2,
15276       const ParamGenerator<T3>& g3,
15277       const typename ParamGenerator<T3>::iterator& current3,
15278       const ParamGenerator<T4>& g4,
15279       const typename ParamGenerator<T4>::iterator& current4,
15280       const ParamGenerator<T5>& g5,
15281       const typename ParamGenerator<T5>::iterator& current5,
15282       const ParamGenerator<T6>& g6,
15283       const typename ParamGenerator<T6>::iterator& current6,
15284       const ParamGenerator<T7>& g7,
15285       const typename ParamGenerator<T7>::iterator& current7,
15286       const ParamGenerator<T8>& g8,
15287       const typename ParamGenerator<T8>::iterator& current8,
15288       const ParamGenerator<T9>& g9,
15289       const typename ParamGenerator<T9>::iterator& current9,
15290       const ParamGenerator<T10>& g10,
15291       const typename ParamGenerator<T10>::iterator& current10)
15292         : base_(base),
15293           begin1_(g1.begin()), end1_(g1.end()), current1_(current1),
15294           begin2_(g2.begin()), end2_(g2.end()), current2_(current2),
15295           begin3_(g3.begin()), end3_(g3.end()), current3_(current3),
15296           begin4_(g4.begin()), end4_(g4.end()), current4_(current4),
15297           begin5_(g5.begin()), end5_(g5.end()), current5_(current5),
15298           begin6_(g6.begin()), end6_(g6.end()), current6_(current6),
15299           begin7_(g7.begin()), end7_(g7.end()), current7_(current7),
15300           begin8_(g8.begin()), end8_(g8.end()), current8_(current8),
15301           begin9_(g9.begin()), end9_(g9.end()), current9_(current9),
15302           begin10_(g10.begin()), end10_(g10.end()), current10_(current10)    {
15303       ComputeCurrentValue();
15304     }
15305     virtual ~Iterator() {}
15306
15307     virtual const ParamGeneratorInterface<ParamType>* BaseGenerator() const {
15308       return base_;
15309     }
15310     // Advance should not be called on beyond-of-range iterators
15311     // so no component iterators must be beyond end of range, either.
15312     virtual void Advance() {
15313       assert(!AtEnd());
15314       ++current10_;
15315       if (current10_ == end10_) {
15316         current10_ = begin10_;
15317         ++current9_;
15318       }
15319       if (current9_ == end9_) {
15320         current9_ = begin9_;
15321         ++current8_;
15322       }
15323       if (current8_ == end8_) {
15324         current8_ = begin8_;
15325         ++current7_;
15326       }
15327       if (current7_ == end7_) {
15328         current7_ = begin7_;
15329         ++current6_;
15330       }
15331       if (current6_ == end6_) {
15332         current6_ = begin6_;
15333         ++current5_;
15334       }
15335       if (current5_ == end5_) {
15336         current5_ = begin5_;
15337         ++current4_;
15338       }
15339       if (current4_ == end4_) {
15340         current4_ = begin4_;
15341         ++current3_;
15342       }
15343       if (current3_ == end3_) {
15344         current3_ = begin3_;
15345         ++current2_;
15346       }
15347       if (current2_ == end2_) {
15348         current2_ = begin2_;
15349         ++current1_;
15350       }
15351       ComputeCurrentValue();
15352     }
15353     virtual ParamIteratorInterface<ParamType>* Clone() const {
15354       return new Iterator(*this);
15355     }
15356     virtual const ParamType* Current() const { return &current_value_; }
15357     virtual bool Equals(const ParamIteratorInterface<ParamType>& other) const {
15358       // Having the same base generator guarantees that the other
15359       // iterator is of the same type and we can downcast.
15360       GTEST_CHECK_(BaseGenerator() == other.BaseGenerator())
15361           << "The program attempted to compare iterators "
15362           << "from different generators." << std::endl;
15363       const Iterator* typed_other =
15364           CheckedDowncastToActualType<const Iterator>(&other);
15365       // We must report iterators equal if they both point beyond their
15366       // respective ranges. That can happen in a variety of fashions,
15367       // so we have to consult AtEnd().
15368       return (AtEnd() && typed_other->AtEnd()) ||
15369          (
15370           current1_ == typed_other->current1_ &&
15371           current2_ == typed_other->current2_ &&
15372           current3_ == typed_other->current3_ &&
15373           current4_ == typed_other->current4_ &&
15374           current5_ == typed_other->current5_ &&
15375           current6_ == typed_other->current6_ &&
15376           current7_ == typed_other->current7_ &&
15377           current8_ == typed_other->current8_ &&
15378           current9_ == typed_other->current9_ &&
15379           current10_ == typed_other->current10_);
15380     }
15381
15382    private:
15383     Iterator(const Iterator& other)
15384         : base_(other.base_),
15385         begin1_(other.begin1_),
15386         end1_(other.end1_),
15387         current1_(other.current1_),
15388         begin2_(other.begin2_),
15389         end2_(other.end2_),
15390         current2_(other.current2_),
15391         begin3_(other.begin3_),
15392         end3_(other.end3_),
15393         current3_(other.current3_),
15394         begin4_(other.begin4_),
15395         end4_(other.end4_),
15396         current4_(other.current4_),
15397         begin5_(other.begin5_),
15398         end5_(other.end5_),
15399         current5_(other.current5_),
15400         begin6_(other.begin6_),
15401         end6_(other.end6_),
15402         current6_(other.current6_),
15403         begin7_(other.begin7_),
15404         end7_(other.end7_),
15405         current7_(other.current7_),
15406         begin8_(other.begin8_),
15407         end8_(other.end8_),
15408         current8_(other.current8_),
15409         begin9_(other.begin9_),
15410         end9_(other.end9_),
15411         current9_(other.current9_),
15412         begin10_(other.begin10_),
15413         end10_(other.end10_),
15414         current10_(other.current10_) {
15415       ComputeCurrentValue();
15416     }
15417
15418     void ComputeCurrentValue() {
15419       if (!AtEnd())
15420         current_value_ = ParamType(*current1_, *current2_, *current3_,
15421             *current4_, *current5_, *current6_, *current7_, *current8_,
15422             *current9_, *current10_);
15423     }
15424     bool AtEnd() const {
15425       // We must report iterator past the end of the range when either of the
15426       // component iterators has reached the end of its range.
15427       return
15428           current1_ == end1_ ||
15429           current2_ == end2_ ||
15430           current3_ == end3_ ||
15431           current4_ == end4_ ||
15432           current5_ == end5_ ||
15433           current6_ == end6_ ||
15434           current7_ == end7_ ||
15435           current8_ == end8_ ||
15436           current9_ == end9_ ||
15437           current10_ == end10_;
15438     }
15439
15440     // No implementation - assignment is unsupported.
15441     void operator=(const Iterator& other);
15442
15443     const ParamGeneratorInterface<ParamType>* const base_;
15444     // begin[i]_ and end[i]_ define the i-th range that Iterator traverses.
15445     // current[i]_ is the actual traversing iterator.
15446     const typename ParamGenerator<T1>::iterator begin1_;
15447     const typename ParamGenerator<T1>::iterator end1_;
15448     typename ParamGenerator<T1>::iterator current1_;
15449     const typename ParamGenerator<T2>::iterator begin2_;
15450     const typename ParamGenerator<T2>::iterator end2_;
15451     typename ParamGenerator<T2>::iterator current2_;
15452     const typename ParamGenerator<T3>::iterator begin3_;
15453     const typename ParamGenerator<T3>::iterator end3_;
15454     typename ParamGenerator<T3>::iterator current3_;
15455     const typename ParamGenerator<T4>::iterator begin4_;
15456     const typename ParamGenerator<T4>::iterator end4_;
15457     typename ParamGenerator<T4>::iterator current4_;
15458     const typename ParamGenerator<T5>::iterator begin5_;
15459     const typename ParamGenerator<T5>::iterator end5_;
15460     typename ParamGenerator<T5>::iterator current5_;
15461     const typename ParamGenerator<T6>::iterator begin6_;
15462     const typename ParamGenerator<T6>::iterator end6_;
15463     typename ParamGenerator<T6>::iterator current6_;
15464     const typename ParamGenerator<T7>::iterator begin7_;
15465     const typename ParamGenerator<T7>::iterator end7_;
15466     typename ParamGenerator<T7>::iterator current7_;
15467     const typename ParamGenerator<T8>::iterator begin8_;
15468     const typename ParamGenerator<T8>::iterator end8_;
15469     typename ParamGenerator<T8>::iterator current8_;
15470     const typename ParamGenerator<T9>::iterator begin9_;
15471     const typename ParamGenerator<T9>::iterator end9_;
15472     typename ParamGenerator<T9>::iterator current9_;
15473     const typename ParamGenerator<T10>::iterator begin10_;
15474     const typename ParamGenerator<T10>::iterator end10_;
15475     typename ParamGenerator<T10>::iterator current10_;
15476     ParamType current_value_;
15477   };  // class CartesianProductGenerator10::Iterator
15478
15479   // No implementation - assignment is unsupported.
15480   void operator=(const CartesianProductGenerator10& other);
15481
15482   const ParamGenerator<T1> g1_;
15483   const ParamGenerator<T2> g2_;
15484   const ParamGenerator<T3> g3_;
15485   const ParamGenerator<T4> g4_;
15486   const ParamGenerator<T5> g5_;
15487   const ParamGenerator<T6> g6_;
15488   const ParamGenerator<T7> g7_;
15489   const ParamGenerator<T8> g8_;
15490   const ParamGenerator<T9> g9_;
15491   const ParamGenerator<T10> g10_;
15492 };  // class CartesianProductGenerator10
15493
15494
15495 // INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.
15496 //
15497 // Helper classes providing Combine() with polymorphic features. They allow
15498 // casting CartesianProductGeneratorN<T> to ParamGenerator<U> if T is
15499 // convertible to U.
15500 //
15501 template <class Generator1, class Generator2>
15502 class CartesianProductHolder2 {
15503  public:
15504 CartesianProductHolder2(const Generator1& g1, const Generator2& g2)
15505       : g1_(g1), g2_(g2) {}
15506   template <typename T1, typename T2>
15507   operator ParamGenerator< ::std::tr1::tuple<T1, T2> >() const {
15508     return ParamGenerator< ::std::tr1::tuple<T1, T2> >(
15509         new CartesianProductGenerator2<T1, T2>(
15510         static_cast<ParamGenerator<T1> >(g1_),
15511         static_cast<ParamGenerator<T2> >(g2_)));
15512   }
15513
15514  private:
15515   // No implementation - assignment is unsupported.
15516   void operator=(const CartesianProductHolder2& other);
15517
15518   const Generator1 g1_;
15519   const Generator2 g2_;
15520 };  // class CartesianProductHolder2
15521
15522 template <class Generator1, class Generator2, class Generator3>
15523 class CartesianProductHolder3 {
15524  public:
15525 CartesianProductHolder3(const Generator1& g1, const Generator2& g2,
15526     const Generator3& g3)
15527       : g1_(g1), g2_(g2), g3_(g3) {}
15528   template <typename T1, typename T2, typename T3>
15529   operator ParamGenerator< ::std::tr1::tuple<T1, T2, T3> >() const {
15530     return ParamGenerator< ::std::tr1::tuple<T1, T2, T3> >(
15531         new CartesianProductGenerator3<T1, T2, T3>(
15532         static_cast<ParamGenerator<T1> >(g1_),
15533         static_cast<ParamGenerator<T2> >(g2_),
15534         static_cast<ParamGenerator<T3> >(g3_)));
15535   }
15536
15537  private:
15538   // No implementation - assignment is unsupported.
15539   void operator=(const CartesianProductHolder3& other);
15540
15541   const Generator1 g1_;
15542   const Generator2 g2_;
15543   const Generator3 g3_;
15544 };  // class CartesianProductHolder3
15545
15546 template <class Generator1, class Generator2, class Generator3,
15547     class Generator4>
15548 class CartesianProductHolder4 {
15549  public:
15550 CartesianProductHolder4(const Generator1& g1, const Generator2& g2,
15551     const Generator3& g3, const Generator4& g4)
15552       : g1_(g1), g2_(g2), g3_(g3), g4_(g4) {}
15553   template <typename T1, typename T2, typename T3, typename T4>
15554   operator ParamGenerator< ::std::tr1::tuple<T1, T2, T3, T4> >() const {
15555     return ParamGenerator< ::std::tr1::tuple<T1, T2, T3, T4> >(
15556         new CartesianProductGenerator4<T1, T2, T3, T4>(
15557         static_cast<ParamGenerator<T1> >(g1_),
15558         static_cast<ParamGenerator<T2> >(g2_),
15559         static_cast<ParamGenerator<T3> >(g3_),
15560         static_cast<ParamGenerator<T4> >(g4_)));
15561   }
15562
15563  private:
15564   // No implementation - assignment is unsupported.
15565   void operator=(const CartesianProductHolder4& other);
15566
15567   const Generator1 g1_;
15568   const Generator2 g2_;
15569   const Generator3 g3_;
15570   const Generator4 g4_;
15571 };  // class CartesianProductHolder4
15572
15573 template <class Generator1, class Generator2, class Generator3,
15574     class Generator4, class Generator5>
15575 class CartesianProductHolder5 {
15576  public:
15577 CartesianProductHolder5(const Generator1& g1, const Generator2& g2,
15578     const Generator3& g3, const Generator4& g4, const Generator5& g5)
15579       : g1_(g1), g2_(g2), g3_(g3), g4_(g4), g5_(g5) {}
15580   template <typename T1, typename T2, typename T3, typename T4, typename T5>
15581   operator ParamGenerator< ::std::tr1::tuple<T1, T2, T3, T4, T5> >() const {
15582     return ParamGenerator< ::std::tr1::tuple<T1, T2, T3, T4, T5> >(
15583         new CartesianProductGenerator5<T1, T2, T3, T4, T5>(
15584         static_cast<ParamGenerator<T1> >(g1_),
15585         static_cast<ParamGenerator<T2> >(g2_),
15586         static_cast<ParamGenerator<T3> >(g3_),
15587         static_cast<ParamGenerator<T4> >(g4_),
15588         static_cast<ParamGenerator<T5> >(g5_)));
15589   }
15590
15591  private:
15592   // No implementation - assignment is unsupported.
15593   void operator=(const CartesianProductHolder5& other);
15594
15595   const Generator1 g1_;
15596   const Generator2 g2_;
15597   const Generator3 g3_;
15598   const Generator4 g4_;
15599   const Generator5 g5_;
15600 };  // class CartesianProductHolder5
15601
15602 template <class Generator1, class Generator2, class Generator3,
15603     class Generator4, class Generator5, class Generator6>
15604 class CartesianProductHolder6 {
15605  public:
15606 CartesianProductHolder6(const Generator1& g1, const Generator2& g2,
15607     const Generator3& g3, const Generator4& g4, const Generator5& g5,
15608     const Generator6& g6)
15609       : g1_(g1), g2_(g2), g3_(g3), g4_(g4), g5_(g5), g6_(g6) {}
15610   template <typename T1, typename T2, typename T3, typename T4, typename T5,
15611       typename T6>
15612   operator ParamGenerator< ::std::tr1::tuple<T1, T2, T3, T4, T5, T6> >() const {
15613     return ParamGenerator< ::std::tr1::tuple<T1, T2, T3, T4, T5, T6> >(
15614         new CartesianProductGenerator6<T1, T2, T3, T4, T5, T6>(
15615         static_cast<ParamGenerator<T1> >(g1_),
15616         static_cast<ParamGenerator<T2> >(g2_),
15617         static_cast<ParamGenerator<T3> >(g3_),
15618         static_cast<ParamGenerator<T4> >(g4_),
15619         static_cast<ParamGenerator<T5> >(g5_),
15620         static_cast<ParamGenerator<T6> >(g6_)));
15621   }
15622
15623  private:
15624   // No implementation - assignment is unsupported.
15625   void operator=(const CartesianProductHolder6& other);
15626
15627   const Generator1 g1_;
15628   const Generator2 g2_;
15629   const Generator3 g3_;
15630   const Generator4 g4_;
15631   const Generator5 g5_;
15632   const Generator6 g6_;
15633 };  // class CartesianProductHolder6
15634
15635 template <class Generator1, class Generator2, class Generator3,
15636     class Generator4, class Generator5, class Generator6, class Generator7>
15637 class CartesianProductHolder7 {
15638  public:
15639 CartesianProductHolder7(const Generator1& g1, const Generator2& g2,
15640     const Generator3& g3, const Generator4& g4, const Generator5& g5,
15641     const Generator6& g6, const Generator7& g7)
15642       : g1_(g1), g2_(g2), g3_(g3), g4_(g4), g5_(g5), g6_(g6), g7_(g7) {}
15643   template <typename T1, typename T2, typename T3, typename T4, typename T5,
15644       typename T6, typename T7>
15645   operator ParamGenerator< ::std::tr1::tuple<T1, T2, T3, T4, T5, T6,
15646       T7> >() const {
15647     return ParamGenerator< ::std::tr1::tuple<T1, T2, T3, T4, T5, T6, T7> >(
15648         new CartesianProductGenerator7<T1, T2, T3, T4, T5, T6, T7>(
15649         static_cast<ParamGenerator<T1> >(g1_),
15650         static_cast<ParamGenerator<T2> >(g2_),
15651         static_cast<ParamGenerator<T3> >(g3_),
15652         static_cast<ParamGenerator<T4> >(g4_),
15653         static_cast<ParamGenerator<T5> >(g5_),
15654         static_cast<ParamGenerator<T6> >(g6_),
15655         static_cast<ParamGenerator<T7> >(g7_)));
15656   }
15657
15658  private:
15659   // No implementation - assignment is unsupported.
15660   void operator=(const CartesianProductHolder7& other);
15661
15662   const Generator1 g1_;
15663   const Generator2 g2_;
15664   const Generator3 g3_;
15665   const Generator4 g4_;
15666   const Generator5 g5_;
15667   const Generator6 g6_;
15668   const Generator7 g7_;
15669 };  // class CartesianProductHolder7
15670
15671 template <class Generator1, class Generator2, class Generator3,
15672     class Generator4, class Generator5, class Generator6, class Generator7,
15673     class Generator8>
15674 class CartesianProductHolder8 {
15675  public:
15676 CartesianProductHolder8(const Generator1& g1, const Generator2& g2,
15677     const Generator3& g3, const Generator4& g4, const Generator5& g5,
15678     const Generator6& g6, const Generator7& g7, const Generator8& g8)
15679       : g1_(g1), g2_(g2), g3_(g3), g4_(g4), g5_(g5), g6_(g6), g7_(g7),
15680           g8_(g8) {}
15681   template <typename T1, typename T2, typename T3, typename T4, typename T5,
15682       typename T6, typename T7, typename T8>
15683   operator ParamGenerator< ::std::tr1::tuple<T1, T2, T3, T4, T5, T6, T7,
15684       T8> >() const {
15685     return ParamGenerator< ::std::tr1::tuple<T1, T2, T3, T4, T5, T6, T7, T8> >(
15686         new CartesianProductGenerator8<T1, T2, T3, T4, T5, T6, T7, T8>(
15687         static_cast<ParamGenerator<T1> >(g1_),
15688         static_cast<ParamGenerator<T2> >(g2_),
15689         static_cast<ParamGenerator<T3> >(g3_),
15690         static_cast<ParamGenerator<T4> >(g4_),
15691         static_cast<ParamGenerator<T5> >(g5_),
15692         static_cast<ParamGenerator<T6> >(g6_),
15693         static_cast<ParamGenerator<T7> >(g7_),
15694         static_cast<ParamGenerator<T8> >(g8_)));
15695   }
15696
15697  private:
15698   // No implementation - assignment is unsupported.
15699   void operator=(const CartesianProductHolder8& other);
15700
15701   const Generator1 g1_;
15702   const Generator2 g2_;
15703   const Generator3 g3_;
15704   const Generator4 g4_;
15705   const Generator5 g5_;
15706   const Generator6 g6_;
15707   const Generator7 g7_;
15708   const Generator8 g8_;
15709 };  // class CartesianProductHolder8
15710
15711 template <class Generator1, class Generator2, class Generator3,
15712     class Generator4, class Generator5, class Generator6, class Generator7,
15713     class Generator8, class Generator9>
15714 class CartesianProductHolder9 {
15715  public:
15716 CartesianProductHolder9(const Generator1& g1, const Generator2& g2,
15717     const Generator3& g3, const Generator4& g4, const Generator5& g5,
15718     const Generator6& g6, const Generator7& g7, const Generator8& g8,
15719     const Generator9& g9)
15720       : g1_(g1), g2_(g2), g3_(g3), g4_(g4), g5_(g5), g6_(g6), g7_(g7), g8_(g8),
15721           g9_(g9) {}
15722   template <typename T1, typename T2, typename T3, typename T4, typename T5,
15723       typename T6, typename T7, typename T8, typename T9>
15724   operator ParamGenerator< ::std::tr1::tuple<T1, T2, T3, T4, T5, T6, T7, T8,
15725       T9> >() const {
15726     return ParamGenerator< ::std::tr1::tuple<T1, T2, T3, T4, T5, T6, T7, T8,
15727         T9> >(
15728         new CartesianProductGenerator9<T1, T2, T3, T4, T5, T6, T7, T8, T9>(
15729         static_cast<ParamGenerator<T1> >(g1_),
15730         static_cast<ParamGenerator<T2> >(g2_),
15731         static_cast<ParamGenerator<T3> >(g3_),
15732         static_cast<ParamGenerator<T4> >(g4_),
15733         static_cast<ParamGenerator<T5> >(g5_),
15734         static_cast<ParamGenerator<T6> >(g6_),
15735         static_cast<ParamGenerator<T7> >(g7_),
15736         static_cast<ParamGenerator<T8> >(g8_),
15737         static_cast<ParamGenerator<T9> >(g9_)));
15738   }
15739
15740  private:
15741   // No implementation - assignment is unsupported.
15742   void operator=(const CartesianProductHolder9& other);
15743
15744   const Generator1 g1_;
15745   const Generator2 g2_;
15746   const Generator3 g3_;
15747   const Generator4 g4_;
15748   const Generator5 g5_;
15749   const Generator6 g6_;
15750   const Generator7 g7_;
15751   const Generator8 g8_;
15752   const Generator9 g9_;
15753 };  // class CartesianProductHolder9
15754
15755 template <class Generator1, class Generator2, class Generator3,
15756     class Generator4, class Generator5, class Generator6, class Generator7,
15757     class Generator8, class Generator9, class Generator10>
15758 class CartesianProductHolder10 {
15759  public:
15760 CartesianProductHolder10(const Generator1& g1, const Generator2& g2,
15761     const Generator3& g3, const Generator4& g4, const Generator5& g5,
15762     const Generator6& g6, const Generator7& g7, const Generator8& g8,
15763     const Generator9& g9, const Generator10& g10)
15764       : g1_(g1), g2_(g2), g3_(g3), g4_(g4), g5_(g5), g6_(g6), g7_(g7), g8_(g8),
15765           g9_(g9), g10_(g10) {}
15766   template <typename T1, typename T2, typename T3, typename T4, typename T5,
15767       typename T6, typename T7, typename T8, typename T9, typename T10>
15768   operator ParamGenerator< ::std::tr1::tuple<T1, T2, T3, T4, T5, T6, T7, T8,
15769       T9, T10> >() const {
15770     return ParamGenerator< ::std::tr1::tuple<T1, T2, T3, T4, T5, T6, T7, T8,
15771         T9, T10> >(
15772         new CartesianProductGenerator10<T1, T2, T3, T4, T5, T6, T7, T8, T9,
15773             T10>(
15774         static_cast<ParamGenerator<T1> >(g1_),
15775         static_cast<ParamGenerator<T2> >(g2_),
15776         static_cast<ParamGenerator<T3> >(g3_),
15777         static_cast<ParamGenerator<T4> >(g4_),
15778         static_cast<ParamGenerator<T5> >(g5_),
15779         static_cast<ParamGenerator<T6> >(g6_),
15780         static_cast<ParamGenerator<T7> >(g7_),
15781         static_cast<ParamGenerator<T8> >(g8_),
15782         static_cast<ParamGenerator<T9> >(g9_),
15783         static_cast<ParamGenerator<T10> >(g10_)));
15784   }
15785
15786  private:
15787   // No implementation - assignment is unsupported.
15788   void operator=(const CartesianProductHolder10& other);
15789
15790   const Generator1 g1_;
15791   const Generator2 g2_;
15792   const Generator3 g3_;
15793   const Generator4 g4_;
15794   const Generator5 g5_;
15795   const Generator6 g6_;
15796   const Generator7 g7_;
15797   const Generator8 g8_;
15798   const Generator9 g9_;
15799   const Generator10 g10_;
15800 };  // class CartesianProductHolder10
15801
15802 # endif  // GTEST_HAS_COMBINE
15803
15804 }  // namespace internal
15805 }  // namespace testing
15806
15807 #endif  //  GTEST_HAS_PARAM_TEST
15808
15809 #endif  // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PARAM_UTIL_GENERATED_H_
15810
15811 #if GTEST_HAS_PARAM_TEST
15812
15813 namespace testing {
15814
15815 // Functions producing parameter generators.
15816 //
15817 // Google Test uses these generators to produce parameters for value-
15818 // parameterized tests. When a parameterized test case is instantiated
15819 // with a particular generator, Google Test creates and runs tests
15820 // for each element in the sequence produced by the generator.
15821 //
15822 // In the following sample, tests from test case FooTest are instantiated
15823 // each three times with parameter values 3, 5, and 8:
15824 //
15825 // class FooTest : public TestWithParam<int> { ... };
15826 //
15827 // TEST_P(FooTest, TestThis) {
15828 // }
15829 // TEST_P(FooTest, TestThat) {
15830 // }
15831 // INSTANTIATE_TEST_CASE_P(TestSequence, FooTest, Values(3, 5, 8));
15832 //
15833
15834 // Range() returns generators providing sequences of values in a range.
15835 //
15836 // Synopsis:
15837 // Range(start, end)
15838 //   - returns a generator producing a sequence of values {start, start+1,
15839 //     start+2, ..., }.
15840 // Range(start, end, step)
15841 //   - returns a generator producing a sequence of values {start, start+step,
15842 //     start+step+step, ..., }.
15843 // Notes:
15844 //   * The generated sequences never include end. For example, Range(1, 5)
15845 //     returns a generator producing a sequence {1, 2, 3, 4}. Range(1, 9, 2)
15846 //     returns a generator producing {1, 3, 5, 7}.
15847 //   * start and end must have the same type. That type may be any integral or
15848 //     floating-point type or a user defined type satisfying these conditions:
15849 //     * It must be assignable (have operator=() defined).
15850 //     * It must have operator+() (operator+(int-compatible type) for
15851 //       two-operand version).
15852 //     * It must have operator<() defined.
15853 //     Elements in the resulting sequences will also have that type.
15854 //   * Condition start < end must be satisfied in order for resulting sequences
15855 //     to contain any elements.
15856 //
15857 template <typename T, typename IncrementT>
15858 internal::ParamGenerator<T> Range(T start, T end, IncrementT step) {
15859   return internal::ParamGenerator<T>(
15860       new internal::RangeGenerator<T, IncrementT>(start, end, step));
15861 }
15862
15863 template <typename T>
15864 internal::ParamGenerator<T> Range(T start, T end) {
15865   return Range(start, end, 1);
15866 }
15867
15868 // ValuesIn() function allows generation of tests with parameters coming from
15869 // a container.
15870 //
15871 // Synopsis:
15872 // ValuesIn(const T (&array)[N])
15873 //   - returns a generator producing sequences with elements from
15874 //     a C-style array.
15875 // ValuesIn(const Container& container)
15876 //   - returns a generator producing sequences with elements from
15877 //     an STL-style container.
15878 // ValuesIn(Iterator begin, Iterator end)
15879 //   - returns a generator producing sequences with elements from
15880 //     a range [begin, end) defined by a pair of STL-style iterators. These
15881 //     iterators can also be plain C pointers.
15882 //
15883 // Please note that ValuesIn copies the values from the containers
15884 // passed in and keeps them to generate tests in RUN_ALL_TESTS().
15885 //
15886 // Examples:
15887 //
15888 // This instantiates tests from test case StringTest
15889 // each with C-string values of "foo", "bar", and "baz":
15890 //
15891 // const char* strings[] = {"foo", "bar", "baz"};
15892 // INSTANTIATE_TEST_CASE_P(StringSequence, SrtingTest, ValuesIn(strings));
15893 //
15894 // This instantiates tests from test case StlStringTest
15895 // each with STL strings with values "a" and "b":
15896 //
15897 // ::std::vector< ::std::string> GetParameterStrings() {
15898 //   ::std::vector< ::std::string> v;
15899 //   v.push_back("a");
15900 //   v.push_back("b");
15901 //   return v;
15902 // }
15903 //
15904 // INSTANTIATE_TEST_CASE_P(CharSequence,
15905 //                         StlStringTest,
15906 //                         ValuesIn(GetParameterStrings()));
15907 //
15908 //
15909 // This will also instantiate tests from CharTest
15910 // each with parameter values 'a' and 'b':
15911 //
15912 // ::std::list<char> GetParameterChars() {
15913 //   ::std::list<char> list;
15914 //   list.push_back('a');
15915 //   list.push_back('b');
15916 //   return list;
15917 // }
15918 // ::std::list<char> l = GetParameterChars();
15919 // INSTANTIATE_TEST_CASE_P(CharSequence2,
15920 //                         CharTest,
15921 //                         ValuesIn(l.begin(), l.end()));
15922 //
15923 template <typename ForwardIterator>
15924 internal::ParamGenerator<
15925   typename ::testing::internal::IteratorTraits<ForwardIterator>::value_type>
15926 ValuesIn(ForwardIterator begin, ForwardIterator end) {
15927   typedef typename ::testing::internal::IteratorTraits<ForwardIterator>
15928       ::value_type ParamType;
15929   return internal::ParamGenerator<ParamType>(
15930       new internal::ValuesInIteratorRangeGenerator<ParamType>(begin, end));
15931 }
15932
15933 template <typename T, size_t N>
15934 internal::ParamGenerator<T> ValuesIn(const T (&array)[N]) {
15935   return ValuesIn(array, array + N);
15936 }
15937
15938 template <class Container>
15939 internal::ParamGenerator<typename Container::value_type> ValuesIn(
15940     const Container& container) {
15941   return ValuesIn(container.begin(), container.end());
15942 }
15943
15944 // Values() allows generating tests from explicitly specified list of
15945 // parameters.
15946 //
15947 // Synopsis:
15948 // Values(T v1, T v2, ..., T vN)
15949 //   - returns a generator producing sequences with elements v1, v2, ..., vN.
15950 //
15951 // For example, this instantiates tests from test case BarTest each
15952 // with values "one", "two", and "three":
15953 //
15954 // INSTANTIATE_TEST_CASE_P(NumSequence, BarTest, Values("one", "two", "three"));
15955 //
15956 // This instantiates tests from test case BazTest each with values 1, 2, 3.5.
15957 // The exact type of values will depend on the type of parameter in BazTest.
15958 //
15959 // INSTANTIATE_TEST_CASE_P(FloatingNumbers, BazTest, Values(1, 2, 3.5));
15960 //
15961 // Currently, Values() supports from 1 to 50 parameters.
15962 //
15963 template <typename T1>
15964 internal::ValueArray1<T1> Values(T1 v1) {
15965   return internal::ValueArray1<T1>(v1);
15966 }
15967
15968 template <typename T1, typename T2>
15969 internal::ValueArray2<T1, T2> Values(T1 v1, T2 v2) {
15970   return internal::ValueArray2<T1, T2>(v1, v2);
15971 }
15972
15973 template <typename T1, typename T2, typename T3>
15974 internal::ValueArray3<T1, T2, T3> Values(T1 v1, T2 v2, T3 v3) {
15975   return internal::ValueArray3<T1, T2, T3>(v1, v2, v3);
15976 }
15977
15978 template <typename T1, typename T2, typename T3, typename T4>
15979 internal::ValueArray4<T1, T2, T3, T4> Values(T1 v1, T2 v2, T3 v3, T4 v4) {
15980   return internal::ValueArray4<T1, T2, T3, T4>(v1, v2, v3, v4);
15981 }
15982
15983 template <typename T1, typename T2, typename T3, typename T4, typename T5>
15984 internal::ValueArray5<T1, T2, T3, T4, T5> Values(T1 v1, T2 v2, T3 v3, T4 v4,
15985     T5 v5) {
15986   return internal::ValueArray5<T1, T2, T3, T4, T5>(v1, v2, v3, v4, v5);
15987 }
15988
15989 template <typename T1, typename T2, typename T3, typename T4, typename T5,
15990     typename T6>
15991 internal::ValueArray6<T1, T2, T3, T4, T5, T6> Values(T1 v1, T2 v2, T3 v3,
15992     T4 v4, T5 v5, T6 v6) {
15993   return internal::ValueArray6<T1, T2, T3, T4, T5, T6>(v1, v2, v3, v4, v5, v6);
15994 }
15995
15996 template <typename T1, typename T2, typename T3, typename T4, typename T5,
15997     typename T6, typename T7>
15998 internal::ValueArray7<T1, T2, T3, T4, T5, T6, T7> Values(T1 v1, T2 v2, T3 v3,
15999     T4 v4, T5 v5, T6 v6, T7 v7) {
16000   return internal::ValueArray7<T1, T2, T3, T4, T5, T6, T7>(v1, v2, v3, v4, v5,
16001       v6, v7);
16002 }
16003
16004 template <typename T1, typename T2, typename T3, typename T4, typename T5,
16005     typename T6, typename T7, typename T8>
16006 internal::ValueArray8<T1, T2, T3, T4, T5, T6, T7, T8> Values(T1 v1, T2 v2,
16007     T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8) {
16008   return internal::ValueArray8<T1, T2, T3, T4, T5, T6, T7, T8>(v1, v2, v3, v4,
16009       v5, v6, v7, v8);
16010 }
16011
16012 template <typename T1, typename T2, typename T3, typename T4, typename T5,
16013     typename T6, typename T7, typename T8, typename T9>
16014 internal::ValueArray9<T1, T2, T3, T4, T5, T6, T7, T8, T9> Values(T1 v1, T2 v2,
16015     T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9) {
16016   return internal::ValueArray9<T1, T2, T3, T4, T5, T6, T7, T8, T9>(v1, v2, v3,
16017       v4, v5, v6, v7, v8, v9);
16018 }
16019
16020 template <typename T1, typename T2, typename T3, typename T4, typename T5,
16021     typename T6, typename T7, typename T8, typename T9, typename T10>
16022 internal::ValueArray10<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> Values(T1 v1,
16023     T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10) {
16024   return internal::ValueArray10<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>(v1,
16025       v2, v3, v4, v5, v6, v7, v8, v9, v10);
16026 }
16027
16028 template <typename T1, typename T2, typename T3, typename T4, typename T5,
16029     typename T6, typename T7, typename T8, typename T9, typename T10,
16030     typename T11>
16031 internal::ValueArray11<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10,
16032     T11> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
16033     T10 v10, T11 v11) {
16034   return internal::ValueArray11<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10,
16035       T11>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11);
16036 }
16037
16038 template <typename T1, typename T2, typename T3, typename T4, typename T5,
16039     typename T6, typename T7, typename T8, typename T9, typename T10,
16040     typename T11, typename T12>
16041 internal::ValueArray12<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
16042     T12> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
16043     T10 v10, T11 v11, T12 v12) {
16044   return internal::ValueArray12<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
16045       T12>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12);
16046 }
16047
16048 template <typename T1, typename T2, typename T3, typename T4, typename T5,
16049     typename T6, typename T7, typename T8, typename T9, typename T10,
16050     typename T11, typename T12, typename T13>
16051 internal::ValueArray13<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
16052     T13> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
16053     T10 v10, T11 v11, T12 v12, T13 v13) {
16054   return internal::ValueArray13<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
16055       T12, T13>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13);
16056 }
16057
16058 template <typename T1, typename T2, typename T3, typename T4, typename T5,
16059     typename T6, typename T7, typename T8, typename T9, typename T10,
16060     typename T11, typename T12, typename T13, typename T14>
16061 internal::ValueArray14<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
16062     T14> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
16063     T10 v10, T11 v11, T12 v12, T13 v13, T14 v14) {
16064   return internal::ValueArray14<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
16065       T12, T13, T14>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13,
16066       v14);
16067 }
16068
16069 template <typename T1, typename T2, typename T3, typename T4, typename T5,
16070     typename T6, typename T7, typename T8, typename T9, typename T10,
16071     typename T11, typename T12, typename T13, typename T14, typename T15>
16072 internal::ValueArray15<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
16073     T14, T15> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8,
16074     T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15) {
16075   return internal::ValueArray15<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
16076       T12, T13, T14, T15>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12,
16077       v13, v14, v15);
16078 }
16079
16080 template <typename T1, typename T2, typename T3, typename T4, typename T5,
16081     typename T6, typename T7, typename T8, typename T9, typename T10,
16082     typename T11, typename T12, typename T13, typename T14, typename T15,
16083     typename T16>
16084 internal::ValueArray16<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
16085     T14, T15, T16> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7,
16086     T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15,
16087     T16 v16) {
16088   return internal::ValueArray16<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
16089       T12, T13, T14, T15, T16>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11,
16090       v12, v13, v14, v15, v16);
16091 }
16092
16093 template <typename T1, typename T2, typename T3, typename T4, typename T5,
16094     typename T6, typename T7, typename T8, typename T9, typename T10,
16095     typename T11, typename T12, typename T13, typename T14, typename T15,
16096     typename T16, typename T17>
16097 internal::ValueArray17<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
16098     T14, T15, T16, T17> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7,
16099     T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15,
16100     T16 v16, T17 v17) {
16101   return internal::ValueArray17<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
16102       T12, T13, T14, T15, T16, T17>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10,
16103       v11, v12, v13, v14, v15, v16, v17);
16104 }
16105
16106 template <typename T1, typename T2, typename T3, typename T4, typename T5,
16107     typename T6, typename T7, typename T8, typename T9, typename T10,
16108     typename T11, typename T12, typename T13, typename T14, typename T15,
16109     typename T16, typename T17, typename T18>
16110 internal::ValueArray18<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
16111     T14, T15, T16, T17, T18> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6,
16112     T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15,
16113     T16 v16, T17 v17, T18 v18) {
16114   return internal::ValueArray18<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
16115       T12, T13, T14, T15, T16, T17, T18>(v1, v2, v3, v4, v5, v6, v7, v8, v9,
16116       v10, v11, v12, v13, v14, v15, v16, v17, v18);
16117 }
16118
16119 template <typename T1, typename T2, typename T3, typename T4, typename T5,
16120     typename T6, typename T7, typename T8, typename T9, typename T10,
16121     typename T11, typename T12, typename T13, typename T14, typename T15,
16122     typename T16, typename T17, typename T18, typename T19>
16123 internal::ValueArray19<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
16124     T14, T15, T16, T17, T18, T19> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5,
16125     T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14,
16126     T15 v15, T16 v16, T17 v17, T18 v18, T19 v19) {
16127   return internal::ValueArray19<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
16128       T12, T13, T14, T15, T16, T17, T18, T19>(v1, v2, v3, v4, v5, v6, v7, v8,
16129       v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19);
16130 }
16131
16132 template <typename T1, typename T2, typename T3, typename T4, typename T5,
16133     typename T6, typename T7, typename T8, typename T9, typename T10,
16134     typename T11, typename T12, typename T13, typename T14, typename T15,
16135     typename T16, typename T17, typename T18, typename T19, typename T20>
16136 internal::ValueArray20<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
16137     T14, T15, T16, T17, T18, T19, T20> Values(T1 v1, T2 v2, T3 v3, T4 v4,
16138     T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13,
16139     T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20) {
16140   return internal::ValueArray20<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
16141       T12, T13, T14, T15, T16, T17, T18, T19, T20>(v1, v2, v3, v4, v5, v6, v7,
16142       v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20);
16143 }
16144
16145 template <typename T1, typename T2, typename T3, typename T4, typename T5,
16146     typename T6, typename T7, typename T8, typename T9, typename T10,
16147     typename T11, typename T12, typename T13, typename T14, typename T15,
16148     typename T16, typename T17, typename T18, typename T19, typename T20,
16149     typename T21>
16150 internal::ValueArray21<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
16151     T14, T15, T16, T17, T18, T19, T20, T21> Values(T1 v1, T2 v2, T3 v3, T4 v4,
16152     T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13,
16153     T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21) {
16154   return internal::ValueArray21<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
16155       T12, T13, T14, T15, T16, T17, T18, T19, T20, T21>(v1, v2, v3, v4, v5, v6,
16156       v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21);
16157 }
16158
16159 template <typename T1, typename T2, typename T3, typename T4, typename T5,
16160     typename T6, typename T7, typename T8, typename T9, typename T10,
16161     typename T11, typename T12, typename T13, typename T14, typename T15,
16162     typename T16, typename T17, typename T18, typename T19, typename T20,
16163     typename T21, typename T22>
16164 internal::ValueArray22<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
16165     T14, T15, T16, T17, T18, T19, T20, T21, T22> Values(T1 v1, T2 v2, T3 v3,
16166     T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12,
16167     T13 v13, T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20,
16168     T21 v21, T22 v22) {
16169   return internal::ValueArray22<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
16170       T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22>(v1, v2, v3, v4,
16171       v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19,
16172       v20, v21, v22);
16173 }
16174
16175 template <typename T1, typename T2, typename T3, typename T4, typename T5,
16176     typename T6, typename T7, typename T8, typename T9, typename T10,
16177     typename T11, typename T12, typename T13, typename T14, typename T15,
16178     typename T16, typename T17, typename T18, typename T19, typename T20,
16179     typename T21, typename T22, typename T23>
16180 internal::ValueArray23<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
16181     T14, T15, T16, T17, T18, T19, T20, T21, T22, T23> Values(T1 v1, T2 v2,
16182     T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12,
16183     T13 v13, T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20,
16184     T21 v21, T22 v22, T23 v23) {
16185   return internal::ValueArray23<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
16186       T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23>(v1, v2, v3,
16187       v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19,
16188       v20, v21, v22, v23);
16189 }
16190
16191 template <typename T1, typename T2, typename T3, typename T4, typename T5,
16192     typename T6, typename T7, typename T8, typename T9, typename T10,
16193     typename T11, typename T12, typename T13, typename T14, typename T15,
16194     typename T16, typename T17, typename T18, typename T19, typename T20,
16195     typename T21, typename T22, typename T23, typename T24>
16196 internal::ValueArray24<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
16197     T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24> Values(T1 v1, T2 v2,
16198     T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12,
16199     T13 v13, T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20,
16200     T21 v21, T22 v22, T23 v23, T24 v24) {
16201   return internal::ValueArray24<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
16202       T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24>(v1, v2,
16203       v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18,
16204       v19, v20, v21, v22, v23, v24);
16205 }
16206
16207 template <typename T1, typename T2, typename T3, typename T4, typename T5,
16208     typename T6, typename T7, typename T8, typename T9, typename T10,
16209     typename T11, typename T12, typename T13, typename T14, typename T15,
16210     typename T16, typename T17, typename T18, typename T19, typename T20,
16211     typename T21, typename T22, typename T23, typename T24, typename T25>
16212 internal::ValueArray25<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
16213     T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25> Values(T1 v1,
16214     T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11,
16215     T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19,
16216     T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25) {
16217   return internal::ValueArray25<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
16218       T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25>(v1,
16219       v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17,
16220       v18, v19, v20, v21, v22, v23, v24, v25);
16221 }
16222
16223 template <typename T1, typename T2, typename T3, typename T4, typename T5,
16224     typename T6, typename T7, typename T8, typename T9, typename T10,
16225     typename T11, typename T12, typename T13, typename T14, typename T15,
16226     typename T16, typename T17, typename T18, typename T19, typename T20,
16227     typename T21, typename T22, typename T23, typename T24, typename T25,
16228     typename T26>
16229 internal::ValueArray26<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
16230     T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
16231     T26> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
16232     T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
16233     T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
16234     T26 v26) {
16235   return internal::ValueArray26<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
16236       T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
16237       T26>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15,
16238       v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26);
16239 }
16240
16241 template <typename T1, typename T2, typename T3, typename T4, typename T5,
16242     typename T6, typename T7, typename T8, typename T9, typename T10,
16243     typename T11, typename T12, typename T13, typename T14, typename T15,
16244     typename T16, typename T17, typename T18, typename T19, typename T20,
16245     typename T21, typename T22, typename T23, typename T24, typename T25,
16246     typename T26, typename T27>
16247 internal::ValueArray27<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
16248     T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
16249     T27> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
16250     T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
16251     T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
16252     T26 v26, T27 v27) {
16253   return internal::ValueArray27<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
16254       T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
16255       T26, T27>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14,
16256       v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27);
16257 }
16258
16259 template <typename T1, typename T2, typename T3, typename T4, typename T5,
16260     typename T6, typename T7, typename T8, typename T9, typename T10,
16261     typename T11, typename T12, typename T13, typename T14, typename T15,
16262     typename T16, typename T17, typename T18, typename T19, typename T20,
16263     typename T21, typename T22, typename T23, typename T24, typename T25,
16264     typename T26, typename T27, typename T28>
16265 internal::ValueArray28<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
16266     T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
16267     T28> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
16268     T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
16269     T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
16270     T26 v26, T27 v27, T28 v28) {
16271   return internal::ValueArray28<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
16272       T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
16273       T26, T27, T28>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13,
16274       v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27,
16275       v28);
16276 }
16277
16278 template <typename T1, typename T2, typename T3, typename T4, typename T5,
16279     typename T6, typename T7, typename T8, typename T9, typename T10,
16280     typename T11, typename T12, typename T13, typename T14, typename T15,
16281     typename T16, typename T17, typename T18, typename T19, typename T20,
16282     typename T21, typename T22, typename T23, typename T24, typename T25,
16283     typename T26, typename T27, typename T28, typename T29>
16284 internal::ValueArray29<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
16285     T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
16286     T29> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
16287     T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
16288     T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
16289     T26 v26, T27 v27, T28 v28, T29 v29) {
16290   return internal::ValueArray29<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
16291       T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
16292       T26, T27, T28, T29>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12,
16293       v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26,
16294       v27, v28, v29);
16295 }
16296
16297 template <typename T1, typename T2, typename T3, typename T4, typename T5,
16298     typename T6, typename T7, typename T8, typename T9, typename T10,
16299     typename T11, typename T12, typename T13, typename T14, typename T15,
16300     typename T16, typename T17, typename T18, typename T19, typename T20,
16301     typename T21, typename T22, typename T23, typename T24, typename T25,
16302     typename T26, typename T27, typename T28, typename T29, typename T30>
16303 internal::ValueArray30<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
16304     T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
16305     T29, T30> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8,
16306     T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16,
16307     T17 v17, T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24,
16308     T25 v25, T26 v26, T27 v27, T28 v28, T29 v29, T30 v30) {
16309   return internal::ValueArray30<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
16310       T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
16311       T26, T27, T28, T29, T30>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11,
16312       v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25,
16313       v26, v27, v28, v29, v30);
16314 }
16315
16316 template <typename T1, typename T2, typename T3, typename T4, typename T5,
16317     typename T6, typename T7, typename T8, typename T9, typename T10,
16318     typename T11, typename T12, typename T13, typename T14, typename T15,
16319     typename T16, typename T17, typename T18, typename T19, typename T20,
16320     typename T21, typename T22, typename T23, typename T24, typename T25,
16321     typename T26, typename T27, typename T28, typename T29, typename T30,
16322     typename T31>
16323 internal::ValueArray31<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
16324     T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
16325     T29, T30, T31> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7,
16326     T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15,
16327     T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23,
16328     T24 v24, T25 v25, T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31) {
16329   return internal::ValueArray31<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
16330       T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
16331       T26, T27, T28, T29, T30, T31>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10,
16332       v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24,
16333       v25, v26, v27, v28, v29, v30, v31);
16334 }
16335
16336 template <typename T1, typename T2, typename T3, typename T4, typename T5,
16337     typename T6, typename T7, typename T8, typename T9, typename T10,
16338     typename T11, typename T12, typename T13, typename T14, typename T15,
16339     typename T16, typename T17, typename T18, typename T19, typename T20,
16340     typename T21, typename T22, typename T23, typename T24, typename T25,
16341     typename T26, typename T27, typename T28, typename T29, typename T30,
16342     typename T31, typename T32>
16343 internal::ValueArray32<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
16344     T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
16345     T29, T30, T31, T32> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7,
16346     T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15,
16347     T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23,
16348     T24 v24, T25 v25, T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31,
16349     T32 v32) {
16350   return internal::ValueArray32<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
16351       T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
16352       T26, T27, T28, T29, T30, T31, T32>(v1, v2, v3, v4, v5, v6, v7, v8, v9,
16353       v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23,
16354       v24, v25, v26, v27, v28, v29, v30, v31, v32);
16355 }
16356
16357 template <typename T1, typename T2, typename T3, typename T4, typename T5,
16358     typename T6, typename T7, typename T8, typename T9, typename T10,
16359     typename T11, typename T12, typename T13, typename T14, typename T15,
16360     typename T16, typename T17, typename T18, typename T19, typename T20,
16361     typename T21, typename T22, typename T23, typename T24, typename T25,
16362     typename T26, typename T27, typename T28, typename T29, typename T30,
16363     typename T31, typename T32, typename T33>
16364 internal::ValueArray33<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
16365     T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
16366     T29, T30, T31, T32, T33> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6,
16367     T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15,
16368     T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23,
16369     T24 v24, T25 v25, T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31,
16370     T32 v32, T33 v33) {
16371   return internal::ValueArray33<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
16372       T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
16373       T26, T27, T28, T29, T30, T31, T32, T33>(v1, v2, v3, v4, v5, v6, v7, v8,
16374       v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23,
16375       v24, v25, v26, v27, v28, v29, v30, v31, v32, v33);
16376 }
16377
16378 template <typename T1, typename T2, typename T3, typename T4, typename T5,
16379     typename T6, typename T7, typename T8, typename T9, typename T10,
16380     typename T11, typename T12, typename T13, typename T14, typename T15,
16381     typename T16, typename T17, typename T18, typename T19, typename T20,
16382     typename T21, typename T22, typename T23, typename T24, typename T25,
16383     typename T26, typename T27, typename T28, typename T29, typename T30,
16384     typename T31, typename T32, typename T33, typename T34>
16385 internal::ValueArray34<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
16386     T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
16387     T29, T30, T31, T32, T33, T34> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5,
16388     T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14,
16389     T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21, T22 v22,
16390     T23 v23, T24 v24, T25 v25, T26 v26, T27 v27, T28 v28, T29 v29, T30 v30,
16391     T31 v31, T32 v32, T33 v33, T34 v34) {
16392   return internal::ValueArray34<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
16393       T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
16394       T26, T27, T28, T29, T30, T31, T32, T33, T34>(v1, v2, v3, v4, v5, v6, v7,
16395       v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22,
16396       v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34);
16397 }
16398
16399 template <typename T1, typename T2, typename T3, typename T4, typename T5,
16400     typename T6, typename T7, typename T8, typename T9, typename T10,
16401     typename T11, typename T12, typename T13, typename T14, typename T15,
16402     typename T16, typename T17, typename T18, typename T19, typename T20,
16403     typename T21, typename T22, typename T23, typename T24, typename T25,
16404     typename T26, typename T27, typename T28, typename T29, typename T30,
16405     typename T31, typename T32, typename T33, typename T34, typename T35>
16406 internal::ValueArray35<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
16407     T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
16408     T29, T30, T31, T32, T33, T34, T35> Values(T1 v1, T2 v2, T3 v3, T4 v4,
16409     T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13,
16410     T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21,
16411     T22 v22, T23 v23, T24 v24, T25 v25, T26 v26, T27 v27, T28 v28, T29 v29,
16412     T30 v30, T31 v31, T32 v32, T33 v33, T34 v34, T35 v35) {
16413   return internal::ValueArray35<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
16414       T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
16415       T26, T27, T28, T29, T30, T31, T32, T33, T34, T35>(v1, v2, v3, v4, v5, v6,
16416       v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21,
16417       v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35);
16418 }
16419
16420 template <typename T1, typename T2, typename T3, typename T4, typename T5,
16421     typename T6, typename T7, typename T8, typename T9, typename T10,
16422     typename T11, typename T12, typename T13, typename T14, typename T15,
16423     typename T16, typename T17, typename T18, typename T19, typename T20,
16424     typename T21, typename T22, typename T23, typename T24, typename T25,
16425     typename T26, typename T27, typename T28, typename T29, typename T30,
16426     typename T31, typename T32, typename T33, typename T34, typename T35,
16427     typename T36>
16428 internal::ValueArray36<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
16429     T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
16430     T29, T30, T31, T32, T33, T34, T35, T36> Values(T1 v1, T2 v2, T3 v3, T4 v4,
16431     T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13,
16432     T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21,
16433     T22 v22, T23 v23, T24 v24, T25 v25, T26 v26, T27 v27, T28 v28, T29 v29,
16434     T30 v30, T31 v31, T32 v32, T33 v33, T34 v34, T35 v35, T36 v36) {
16435   return internal::ValueArray36<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
16436       T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
16437       T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36>(v1, v2, v3, v4,
16438       v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19,
16439       v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33,
16440       v34, v35, v36);
16441 }
16442
16443 template <typename T1, typename T2, typename T3, typename T4, typename T5,
16444     typename T6, typename T7, typename T8, typename T9, typename T10,
16445     typename T11, typename T12, typename T13, typename T14, typename T15,
16446     typename T16, typename T17, typename T18, typename T19, typename T20,
16447     typename T21, typename T22, typename T23, typename T24, typename T25,
16448     typename T26, typename T27, typename T28, typename T29, typename T30,
16449     typename T31, typename T32, typename T33, typename T34, typename T35,
16450     typename T36, typename T37>
16451 internal::ValueArray37<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
16452     T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
16453     T29, T30, T31, T32, T33, T34, T35, T36, T37> Values(T1 v1, T2 v2, T3 v3,
16454     T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12,
16455     T13 v13, T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20,
16456     T21 v21, T22 v22, T23 v23, T24 v24, T25 v25, T26 v26, T27 v27, T28 v28,
16457     T29 v29, T30 v30, T31 v31, T32 v32, T33 v33, T34 v34, T35 v35, T36 v36,
16458     T37 v37) {
16459   return internal::ValueArray37<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
16460       T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
16461       T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37>(v1, v2, v3,
16462       v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19,
16463       v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33,
16464       v34, v35, v36, v37);
16465 }
16466
16467 template <typename T1, typename T2, typename T3, typename T4, typename T5,
16468     typename T6, typename T7, typename T8, typename T9, typename T10,
16469     typename T11, typename T12, typename T13, typename T14, typename T15,
16470     typename T16, typename T17, typename T18, typename T19, typename T20,
16471     typename T21, typename T22, typename T23, typename T24, typename T25,
16472     typename T26, typename T27, typename T28, typename T29, typename T30,
16473     typename T31, typename T32, typename T33, typename T34, typename T35,
16474     typename T36, typename T37, typename T38>
16475 internal::ValueArray38<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
16476     T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
16477     T29, T30, T31, T32, T33, T34, T35, T36, T37, T38> Values(T1 v1, T2 v2,
16478     T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12,
16479     T13 v13, T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20,
16480     T21 v21, T22 v22, T23 v23, T24 v24, T25 v25, T26 v26, T27 v27, T28 v28,
16481     T29 v29, T30 v30, T31 v31, T32 v32, T33 v33, T34 v34, T35 v35, T36 v36,
16482     T37 v37, T38 v38) {
16483   return internal::ValueArray38<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
16484       T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
16485       T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38>(v1, v2,
16486       v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18,
16487       v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32,
16488       v33, v34, v35, v36, v37, v38);
16489 }
16490
16491 template <typename T1, typename T2, typename T3, typename T4, typename T5,
16492     typename T6, typename T7, typename T8, typename T9, typename T10,
16493     typename T11, typename T12, typename T13, typename T14, typename T15,
16494     typename T16, typename T17, typename T18, typename T19, typename T20,
16495     typename T21, typename T22, typename T23, typename T24, typename T25,
16496     typename T26, typename T27, typename T28, typename T29, typename T30,
16497     typename T31, typename T32, typename T33, typename T34, typename T35,
16498     typename T36, typename T37, typename T38, typename T39>
16499 internal::ValueArray39<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
16500     T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
16501     T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39> Values(T1 v1, T2 v2,
16502     T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12,
16503     T13 v13, T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20,
16504     T21 v21, T22 v22, T23 v23, T24 v24, T25 v25, T26 v26, T27 v27, T28 v28,
16505     T29 v29, T30 v30, T31 v31, T32 v32, T33 v33, T34 v34, T35 v35, T36 v36,
16506     T37 v37, T38 v38, T39 v39) {
16507   return internal::ValueArray39<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
16508       T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
16509       T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39>(v1,
16510       v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17,
16511       v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31,
16512       v32, v33, v34, v35, v36, v37, v38, v39);
16513 }
16514
16515 template <typename T1, typename T2, typename T3, typename T4, typename T5,
16516     typename T6, typename T7, typename T8, typename T9, typename T10,
16517     typename T11, typename T12, typename T13, typename T14, typename T15,
16518     typename T16, typename T17, typename T18, typename T19, typename T20,
16519     typename T21, typename T22, typename T23, typename T24, typename T25,
16520     typename T26, typename T27, typename T28, typename T29, typename T30,
16521     typename T31, typename T32, typename T33, typename T34, typename T35,
16522     typename T36, typename T37, typename T38, typename T39, typename T40>
16523 internal::ValueArray40<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
16524     T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
16525     T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40> Values(T1 v1,
16526     T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11,
16527     T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19,
16528     T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25, T26 v26, T27 v27,
16529     T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33, T34 v34, T35 v35,
16530     T36 v36, T37 v37, T38 v38, T39 v39, T40 v40) {
16531   return internal::ValueArray40<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
16532       T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
16533       T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39,
16534       T40>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15,
16535       v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29,
16536       v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40);
16537 }
16538
16539 template <typename T1, typename T2, typename T3, typename T4, typename T5,
16540     typename T6, typename T7, typename T8, typename T9, typename T10,
16541     typename T11, typename T12, typename T13, typename T14, typename T15,
16542     typename T16, typename T17, typename T18, typename T19, typename T20,
16543     typename T21, typename T22, typename T23, typename T24, typename T25,
16544     typename T26, typename T27, typename T28, typename T29, typename T30,
16545     typename T31, typename T32, typename T33, typename T34, typename T35,
16546     typename T36, typename T37, typename T38, typename T39, typename T40,
16547     typename T41>
16548 internal::ValueArray41<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
16549     T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
16550     T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40,
16551     T41> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
16552     T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
16553     T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
16554     T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33,
16555     T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39, T40 v40, T41 v41) {
16556   return internal::ValueArray41<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
16557       T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
16558       T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39,
16559       T40, T41>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14,
16560       v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28,
16561       v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41);
16562 }
16563
16564 template <typename T1, typename T2, typename T3, typename T4, typename T5,
16565     typename T6, typename T7, typename T8, typename T9, typename T10,
16566     typename T11, typename T12, typename T13, typename T14, typename T15,
16567     typename T16, typename T17, typename T18, typename T19, typename T20,
16568     typename T21, typename T22, typename T23, typename T24, typename T25,
16569     typename T26, typename T27, typename T28, typename T29, typename T30,
16570     typename T31, typename T32, typename T33, typename T34, typename T35,
16571     typename T36, typename T37, typename T38, typename T39, typename T40,
16572     typename T41, typename T42>
16573 internal::ValueArray42<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
16574     T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
16575     T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41,
16576     T42> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
16577     T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
16578     T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
16579     T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33,
16580     T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39, T40 v40, T41 v41,
16581     T42 v42) {
16582   return internal::ValueArray42<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
16583       T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
16584       T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39,
16585       T40, T41, T42>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13,
16586       v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27,
16587       v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41,
16588       v42);
16589 }
16590
16591 template <typename T1, typename T2, typename T3, typename T4, typename T5,
16592     typename T6, typename T7, typename T8, typename T9, typename T10,
16593     typename T11, typename T12, typename T13, typename T14, typename T15,
16594     typename T16, typename T17, typename T18, typename T19, typename T20,
16595     typename T21, typename T22, typename T23, typename T24, typename T25,
16596     typename T26, typename T27, typename T28, typename T29, typename T30,
16597     typename T31, typename T32, typename T33, typename T34, typename T35,
16598     typename T36, typename T37, typename T38, typename T39, typename T40,
16599     typename T41, typename T42, typename T43>
16600 internal::ValueArray43<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
16601     T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
16602     T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42,
16603     T43> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
16604     T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
16605     T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
16606     T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33,
16607     T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39, T40 v40, T41 v41,
16608     T42 v42, T43 v43) {
16609   return internal::ValueArray43<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
16610       T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
16611       T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39,
16612       T40, T41, T42, T43>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12,
16613       v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26,
16614       v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40,
16615       v41, v42, v43);
16616 }
16617
16618 template <typename T1, typename T2, typename T3, typename T4, typename T5,
16619     typename T6, typename T7, typename T8, typename T9, typename T10,
16620     typename T11, typename T12, typename T13, typename T14, typename T15,
16621     typename T16, typename T17, typename T18, typename T19, typename T20,
16622     typename T21, typename T22, typename T23, typename T24, typename T25,
16623     typename T26, typename T27, typename T28, typename T29, typename T30,
16624     typename T31, typename T32, typename T33, typename T34, typename T35,
16625     typename T36, typename T37, typename T38, typename T39, typename T40,
16626     typename T41, typename T42, typename T43, typename T44>
16627 internal::ValueArray44<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
16628     T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
16629     T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43,
16630     T44> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
16631     T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
16632     T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
16633     T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33,
16634     T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39, T40 v40, T41 v41,
16635     T42 v42, T43 v43, T44 v44) {
16636   return internal::ValueArray44<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
16637       T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
16638       T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39,
16639       T40, T41, T42, T43, T44>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11,
16640       v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25,
16641       v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39,
16642       v40, v41, v42, v43, v44);
16643 }
16644
16645 template <typename T1, typename T2, typename T3, typename T4, typename T5,
16646     typename T6, typename T7, typename T8, typename T9, typename T10,
16647     typename T11, typename T12, typename T13, typename T14, typename T15,
16648     typename T16, typename T17, typename T18, typename T19, typename T20,
16649     typename T21, typename T22, typename T23, typename T24, typename T25,
16650     typename T26, typename T27, typename T28, typename T29, typename T30,
16651     typename T31, typename T32, typename T33, typename T34, typename T35,
16652     typename T36, typename T37, typename T38, typename T39, typename T40,
16653     typename T41, typename T42, typename T43, typename T44, typename T45>
16654 internal::ValueArray45<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
16655     T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
16656     T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43,
16657     T44, T45> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8,
16658     T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16,
16659     T17 v17, T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24,
16660     T25 v25, T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32,
16661     T33 v33, T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39, T40 v40,
16662     T41 v41, T42 v42, T43 v43, T44 v44, T45 v45) {
16663   return internal::ValueArray45<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
16664       T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
16665       T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39,
16666       T40, T41, T42, T43, T44, T45>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10,
16667       v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24,
16668       v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38,
16669       v39, v40, v41, v42, v43, v44, v45);
16670 }
16671
16672 template <typename T1, typename T2, typename T3, typename T4, typename T5,
16673     typename T6, typename T7, typename T8, typename T9, typename T10,
16674     typename T11, typename T12, typename T13, typename T14, typename T15,
16675     typename T16, typename T17, typename T18, typename T19, typename T20,
16676     typename T21, typename T22, typename T23, typename T24, typename T25,
16677     typename T26, typename T27, typename T28, typename T29, typename T30,
16678     typename T31, typename T32, typename T33, typename T34, typename T35,
16679     typename T36, typename T37, typename T38, typename T39, typename T40,
16680     typename T41, typename T42, typename T43, typename T44, typename T45,
16681     typename T46>
16682 internal::ValueArray46<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
16683     T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
16684     T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43,
16685     T44, T45, T46> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7,
16686     T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15,
16687     T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23,
16688     T24 v24, T25 v25, T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31,
16689     T32 v32, T33 v33, T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39,
16690     T40 v40, T41 v41, T42 v42, T43 v43, T44 v44, T45 v45, T46 v46) {
16691   return internal::ValueArray46<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
16692       T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
16693       T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39,
16694       T40, T41, T42, T43, T44, T45, T46>(v1, v2, v3, v4, v5, v6, v7, v8, v9,
16695       v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23,
16696       v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37,
16697       v38, v39, v40, v41, v42, v43, v44, v45, v46);
16698 }
16699
16700 template <typename T1, typename T2, typename T3, typename T4, typename T5,
16701     typename T6, typename T7, typename T8, typename T9, typename T10,
16702     typename T11, typename T12, typename T13, typename T14, typename T15,
16703     typename T16, typename T17, typename T18, typename T19, typename T20,
16704     typename T21, typename T22, typename T23, typename T24, typename T25,
16705     typename T26, typename T27, typename T28, typename T29, typename T30,
16706     typename T31, typename T32, typename T33, typename T34, typename T35,
16707     typename T36, typename T37, typename T38, typename T39, typename T40,
16708     typename T41, typename T42, typename T43, typename T44, typename T45,
16709     typename T46, typename T47>
16710 internal::ValueArray47<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
16711     T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
16712     T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43,
16713     T44, T45, T46, T47> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7,
16714     T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15,
16715     T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23,
16716     T24 v24, T25 v25, T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31,
16717     T32 v32, T33 v33, T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39,
16718     T40 v40, T41 v41, T42 v42, T43 v43, T44 v44, T45 v45, T46 v46, T47 v47) {
16719   return internal::ValueArray47<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
16720       T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
16721       T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39,
16722       T40, T41, T42, T43, T44, T45, T46, T47>(v1, v2, v3, v4, v5, v6, v7, v8,
16723       v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23,
16724       v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37,
16725       v38, v39, v40, v41, v42, v43, v44, v45, v46, v47);
16726 }
16727
16728 template <typename T1, typename T2, typename T3, typename T4, typename T5,
16729     typename T6, typename T7, typename T8, typename T9, typename T10,
16730     typename T11, typename T12, typename T13, typename T14, typename T15,
16731     typename T16, typename T17, typename T18, typename T19, typename T20,
16732     typename T21, typename T22, typename T23, typename T24, typename T25,
16733     typename T26, typename T27, typename T28, typename T29, typename T30,
16734     typename T31, typename T32, typename T33, typename T34, typename T35,
16735     typename T36, typename T37, typename T38, typename T39, typename T40,
16736     typename T41, typename T42, typename T43, typename T44, typename T45,
16737     typename T46, typename T47, typename T48>
16738 internal::ValueArray48<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
16739     T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
16740     T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43,
16741     T44, T45, T46, T47, T48> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6,
16742     T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15,
16743     T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23,
16744     T24 v24, T25 v25, T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31,
16745     T32 v32, T33 v33, T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39,
16746     T40 v40, T41 v41, T42 v42, T43 v43, T44 v44, T45 v45, T46 v46, T47 v47,
16747     T48 v48) {
16748   return internal::ValueArray48<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
16749       T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
16750       T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39,
16751       T40, T41, T42, T43, T44, T45, T46, T47, T48>(v1, v2, v3, v4, v5, v6, v7,
16752       v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22,
16753       v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36,
16754       v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48);
16755 }
16756
16757 template <typename T1, typename T2, typename T3, typename T4, typename T5,
16758     typename T6, typename T7, typename T8, typename T9, typename T10,
16759     typename T11, typename T12, typename T13, typename T14, typename T15,
16760     typename T16, typename T17, typename T18, typename T19, typename T20,
16761     typename T21, typename T22, typename T23, typename T24, typename T25,
16762     typename T26, typename T27, typename T28, typename T29, typename T30,
16763     typename T31, typename T32, typename T33, typename T34, typename T35,
16764     typename T36, typename T37, typename T38, typename T39, typename T40,
16765     typename T41, typename T42, typename T43, typename T44, typename T45,
16766     typename T46, typename T47, typename T48, typename T49>
16767 internal::ValueArray49<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
16768     T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
16769     T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43,
16770     T44, T45, T46, T47, T48, T49> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5,
16771     T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14,
16772     T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21, T22 v22,
16773     T23 v23, T24 v24, T25 v25, T26 v26, T27 v27, T28 v28, T29 v29, T30 v30,
16774     T31 v31, T32 v32, T33 v33, T34 v34, T35 v35, T36 v36, T37 v37, T38 v38,
16775     T39 v39, T40 v40, T41 v41, T42 v42, T43 v43, T44 v44, T45 v45, T46 v46,
16776     T47 v47, T48 v48, T49 v49) {
16777   return internal::ValueArray49<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
16778       T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
16779       T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39,
16780       T40, T41, T42, T43, T44, T45, T46, T47, T48, T49>(v1, v2, v3, v4, v5, v6,
16781       v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21,
16782       v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35,
16783       v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49);
16784 }
16785
16786 template <typename T1, typename T2, typename T3, typename T4, typename T5,
16787     typename T6, typename T7, typename T8, typename T9, typename T10,
16788     typename T11, typename T12, typename T13, typename T14, typename T15,
16789     typename T16, typename T17, typename T18, typename T19, typename T20,
16790     typename T21, typename T22, typename T23, typename T24, typename T25,
16791     typename T26, typename T27, typename T28, typename T29, typename T30,
16792     typename T31, typename T32, typename T33, typename T34, typename T35,
16793     typename T36, typename T37, typename T38, typename T39, typename T40,
16794     typename T41, typename T42, typename T43, typename T44, typename T45,
16795     typename T46, typename T47, typename T48, typename T49, typename T50>
16796 internal::ValueArray50<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
16797     T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
16798     T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43,
16799     T44, T45, T46, T47, T48, T49, T50> Values(T1 v1, T2 v2, T3 v3, T4 v4,
16800     T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13,
16801     T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21,
16802     T22 v22, T23 v23, T24 v24, T25 v25, T26 v26, T27 v27, T28 v28, T29 v29,
16803     T30 v30, T31 v31, T32 v32, T33 v33, T34 v34, T35 v35, T36 v36, T37 v37,
16804     T38 v38, T39 v39, T40 v40, T41 v41, T42 v42, T43 v43, T44 v44, T45 v45,
16805     T46 v46, T47 v47, T48 v48, T49 v49, T50 v50) {
16806   return internal::ValueArray50<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
16807       T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
16808       T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39,
16809       T40, T41, T42, T43, T44, T45, T46, T47, T48, T49, T50>(v1, v2, v3, v4,
16810       v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19,
16811       v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33,
16812       v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47,
16813       v48, v49, v50);
16814 }
16815
16816 // Bool() allows generating tests with parameters in a set of (false, true).
16817 //
16818 // Synopsis:
16819 // Bool()
16820 //   - returns a generator producing sequences with elements {false, true}.
16821 //
16822 // It is useful when testing code that depends on Boolean flags. Combinations
16823 // of multiple flags can be tested when several Bool()'s are combined using
16824 // Combine() function.
16825 //
16826 // In the following example all tests in the test case FlagDependentTest
16827 // will be instantiated twice with parameters false and true.
16828 //
16829 // class FlagDependentTest : public testing::TestWithParam<bool> {
16830 //   virtual void SetUp() {
16831 //     external_flag = GetParam();
16832 //   }
16833 // }
16834 // INSTANTIATE_TEST_CASE_P(BoolSequence, FlagDependentTest, Bool());
16835 //
16836 inline internal::ParamGenerator<bool> Bool() {
16837   return Values(false, true);
16838 }
16839
16840 # if GTEST_HAS_COMBINE
16841 // Combine() allows the user to combine two or more sequences to produce
16842 // values of a Cartesian product of those sequences' elements.
16843 //
16844 // Synopsis:
16845 // Combine(gen1, gen2, ..., genN)
16846 //   - returns a generator producing sequences with elements coming from
16847 //     the Cartesian product of elements from the sequences generated by
16848 //     gen1, gen2, ..., genN. The sequence elements will have a type of
16849 //     tuple<T1, T2, ..., TN> where T1, T2, ..., TN are the types
16850 //     of elements from sequences produces by gen1, gen2, ..., genN.
16851 //
16852 // Combine can have up to 10 arguments. This number is currently limited
16853 // by the maximum number of elements in the tuple implementation used by Google
16854 // Test.
16855 //
16856 // Example:
16857 //
16858 // This will instantiate tests in test case AnimalTest each one with
16859 // the parameter values tuple("cat", BLACK), tuple("cat", WHITE),
16860 // tuple("dog", BLACK), and tuple("dog", WHITE):
16861 //
16862 // enum Color { BLACK, GRAY, WHITE };
16863 // class AnimalTest
16864 //     : public testing::TestWithParam<tuple<const char*, Color> > {...};
16865 //
16866 // TEST_P(AnimalTest, AnimalLooksNice) {...}
16867 //
16868 // INSTANTIATE_TEST_CASE_P(AnimalVariations, AnimalTest,
16869 //                         Combine(Values("cat", "dog"),
16870 //                                 Values(BLACK, WHITE)));
16871 //
16872 // This will instantiate tests in FlagDependentTest with all variations of two
16873 // Boolean flags:
16874 //
16875 // class FlagDependentTest
16876 //     : public testing::TestWithParam<tuple<bool, bool> > {
16877 //   virtual void SetUp() {
16878 //     // Assigns external_flag_1 and external_flag_2 values from the tuple.
16879 //     tie(external_flag_1, external_flag_2) = GetParam();
16880 //   }
16881 // };
16882 //
16883 // TEST_P(FlagDependentTest, TestFeature1) {
16884 //   // Test your code using external_flag_1 and external_flag_2 here.
16885 // }
16886 // INSTANTIATE_TEST_CASE_P(TwoBoolSequence, FlagDependentTest,
16887 //                         Combine(Bool(), Bool()));
16888 //
16889 template <typename Generator1, typename Generator2>
16890 internal::CartesianProductHolder2<Generator1, Generator2> Combine(
16891     const Generator1& g1, const Generator2& g2) {
16892   return internal::CartesianProductHolder2<Generator1, Generator2>(
16893       g1, g2);
16894 }
16895
16896 template <typename Generator1, typename Generator2, typename Generator3>
16897 internal::CartesianProductHolder3<Generator1, Generator2, Generator3> Combine(
16898     const Generator1& g1, const Generator2& g2, const Generator3& g3) {
16899   return internal::CartesianProductHolder3<Generator1, Generator2, Generator3>(
16900       g1, g2, g3);
16901 }
16902
16903 template <typename Generator1, typename Generator2, typename Generator3,
16904     typename Generator4>
16905 internal::CartesianProductHolder4<Generator1, Generator2, Generator3,
16906     Generator4> Combine(
16907     const Generator1& g1, const Generator2& g2, const Generator3& g3,
16908         const Generator4& g4) {
16909   return internal::CartesianProductHolder4<Generator1, Generator2, Generator3,
16910       Generator4>(
16911       g1, g2, g3, g4);
16912 }
16913
16914 template <typename Generator1, typename Generator2, typename Generator3,
16915     typename Generator4, typename Generator5>
16916 internal::CartesianProductHolder5<Generator1, Generator2, Generator3,
16917     Generator4, Generator5> Combine(
16918     const Generator1& g1, const Generator2& g2, const Generator3& g3,
16919         const Generator4& g4, const Generator5& g5) {
16920   return internal::CartesianProductHolder5<Generator1, Generator2, Generator3,
16921       Generator4, Generator5>(
16922       g1, g2, g3, g4, g5);
16923 }
16924
16925 template <typename Generator1, typename Generator2, typename Generator3,
16926     typename Generator4, typename Generator5, typename Generator6>
16927 internal::CartesianProductHolder6<Generator1, Generator2, Generator3,
16928     Generator4, Generator5, Generator6> Combine(
16929     const Generator1& g1, const Generator2& g2, const Generator3& g3,
16930         const Generator4& g4, const Generator5& g5, const Generator6& g6) {
16931   return internal::CartesianProductHolder6<Generator1, Generator2, Generator3,
16932       Generator4, Generator5, Generator6>(
16933       g1, g2, g3, g4, g5, g6);
16934 }
16935
16936 template <typename Generator1, typename Generator2, typename Generator3,
16937     typename Generator4, typename Generator5, typename Generator6,
16938     typename Generator7>
16939 internal::CartesianProductHolder7<Generator1, Generator2, Generator3,
16940     Generator4, Generator5, Generator6, Generator7> Combine(
16941     const Generator1& g1, const Generator2& g2, const Generator3& g3,
16942         const Generator4& g4, const Generator5& g5, const Generator6& g6,
16943         const Generator7& g7) {
16944   return internal::CartesianProductHolder7<Generator1, Generator2, Generator3,
16945       Generator4, Generator5, Generator6, Generator7>(
16946       g1, g2, g3, g4, g5, g6, g7);
16947 }
16948
16949 template <typename Generator1, typename Generator2, typename Generator3,
16950     typename Generator4, typename Generator5, typename Generator6,
16951     typename Generator7, typename Generator8>
16952 internal::CartesianProductHolder8<Generator1, Generator2, Generator3,
16953     Generator4, Generator5, Generator6, Generator7, Generator8> Combine(
16954     const Generator1& g1, const Generator2& g2, const Generator3& g3,
16955         const Generator4& g4, const Generator5& g5, const Generator6& g6,
16956         const Generator7& g7, const Generator8& g8) {
16957   return internal::CartesianProductHolder8<Generator1, Generator2, Generator3,
16958       Generator4, Generator5, Generator6, Generator7, Generator8>(
16959       g1, g2, g3, g4, g5, g6, g7, g8);
16960 }
16961
16962 template <typename Generator1, typename Generator2, typename Generator3,
16963     typename Generator4, typename Generator5, typename Generator6,
16964     typename Generator7, typename Generator8, typename Generator9>
16965 internal::CartesianProductHolder9<Generator1, Generator2, Generator3,
16966     Generator4, Generator5, Generator6, Generator7, Generator8,
16967     Generator9> Combine(
16968     const Generator1& g1, const Generator2& g2, const Generator3& g3,
16969         const Generator4& g4, const Generator5& g5, const Generator6& g6,
16970         const Generator7& g7, const Generator8& g8, const Generator9& g9) {
16971   return internal::CartesianProductHolder9<Generator1, Generator2, Generator3,
16972       Generator4, Generator5, Generator6, Generator7, Generator8, Generator9>(
16973       g1, g2, g3, g4, g5, g6, g7, g8, g9);
16974 }
16975
16976 template <typename Generator1, typename Generator2, typename Generator3,
16977     typename Generator4, typename Generator5, typename Generator6,
16978     typename Generator7, typename Generator8, typename Generator9,
16979     typename Generator10>
16980 internal::CartesianProductHolder10<Generator1, Generator2, Generator3,
16981     Generator4, Generator5, Generator6, Generator7, Generator8, Generator9,
16982     Generator10> Combine(
16983     const Generator1& g1, const Generator2& g2, const Generator3& g3,
16984         const Generator4& g4, const Generator5& g5, const Generator6& g6,
16985         const Generator7& g7, const Generator8& g8, const Generator9& g9,
16986         const Generator10& g10) {
16987   return internal::CartesianProductHolder10<Generator1, Generator2, Generator3,
16988       Generator4, Generator5, Generator6, Generator7, Generator8, Generator9,
16989       Generator10>(
16990       g1, g2, g3, g4, g5, g6, g7, g8, g9, g10);
16991 }
16992 # endif  // GTEST_HAS_COMBINE
16993
16994
16995
16996 # define TEST_P(test_case_name, test_name) \
16997   class GTEST_TEST_CLASS_NAME_(test_case_name, test_name) \
16998       : public test_case_name { \
16999    public: \
17000     GTEST_TEST_CLASS_NAME_(test_case_name, test_name)() {} \
17001     virtual void TestBody(); \
17002    private: \
17003     static int AddToRegistry() { \
17004       ::testing::UnitTest::GetInstance()->parameterized_test_registry(). \
17005           GetTestCasePatternHolder<test_case_name>(\
17006               #test_case_name, __FILE__, __LINE__)->AddTestPattern(\
17007                   #test_case_name, \
17008                   #test_name, \
17009                   new ::testing::internal::TestMetaFactory< \
17010                       GTEST_TEST_CLASS_NAME_(test_case_name, test_name)>()); \
17011       return 0; \
17012     } \
17013     static int gtest_registering_dummy_; \
17014     GTEST_DISALLOW_COPY_AND_ASSIGN_(\
17015         GTEST_TEST_CLASS_NAME_(test_case_name, test_name)); \
17016   }; \
17017   int GTEST_TEST_CLASS_NAME_(test_case_name, \
17018                              test_name)::gtest_registering_dummy_ = \
17019       GTEST_TEST_CLASS_NAME_(test_case_name, test_name)::AddToRegistry(); \
17020   void GTEST_TEST_CLASS_NAME_(test_case_name, test_name)::TestBody()
17021
17022 # define INSTANTIATE_TEST_CASE_P(prefix, test_case_name, generator) \
17023   ::testing::internal::ParamGenerator<test_case_name::ParamType> \
17024       gtest_##prefix##test_case_name##_EvalGenerator_() { return generator; } \
17025   int gtest_##prefix##test_case_name##_dummy_ = \
17026       ::testing::UnitTest::GetInstance()->parameterized_test_registry(). \
17027           GetTestCasePatternHolder<test_case_name>(\
17028               #test_case_name, __FILE__, __LINE__)->AddTestCaseInstantiation(\
17029                   #prefix, \
17030                   &gtest_##prefix##test_case_name##_EvalGenerator_, \
17031                   __FILE__, __LINE__)
17032
17033 }  // namespace testing
17034
17035 #endif  // GTEST_HAS_PARAM_TEST
17036
17037 #endif  // GTEST_INCLUDE_GTEST_GTEST_PARAM_TEST_H_
17038 // Copyright 2006, Google Inc.
17039 // All rights reserved.
17040 //
17041 // Redistribution and use in source and binary forms, with or without
17042 // modification, are permitted provided that the following conditions are
17043 // met:
17044 //
17045 //     * Redistributions of source code must retain the above copyright
17046 // notice, this list of conditions and the following disclaimer.
17047 //     * Redistributions in binary form must reproduce the above
17048 // copyright notice, this list of conditions and the following disclaimer
17049 // in the documentation and/or other materials provided with the
17050 // distribution.
17051 //     * Neither the name of Google Inc. nor the names of its
17052 // contributors may be used to endorse or promote products derived from
17053 // this software without specific prior written permission.
17054 //
17055 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17056 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
17057 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
17058 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
17059 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
17060 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
17061 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
17062 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
17063 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
17064 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
17065 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
17066 //
17067 // Author: wan@google.com (Zhanyong Wan)
17068 //
17069 // Google C++ Testing Framework definitions useful in production code.
17070
17071 #ifndef GTEST_INCLUDE_GTEST_GTEST_PROD_H_
17072 #define GTEST_INCLUDE_GTEST_GTEST_PROD_H_
17073
17074 // When you need to test the private or protected members of a class,
17075 // use the FRIEND_TEST macro to declare your tests as friends of the
17076 // class.  For example:
17077 //
17078 // class MyClass {
17079 //  private:
17080 //   void MyMethod();
17081 //   FRIEND_TEST(MyClassTest, MyMethod);
17082 // };
17083 //
17084 // class MyClassTest : public testing::Test {
17085 //   // ...
17086 // };
17087 //
17088 // TEST_F(MyClassTest, MyMethod) {
17089 //   // Can call MyClass::MyMethod() here.
17090 // }
17091
17092 #define FRIEND_TEST(test_case_name, test_name)\
17093 friend class test_case_name##_##test_name##_Test
17094
17095 #endif  // GTEST_INCLUDE_GTEST_GTEST_PROD_H_
17096 // Copyright 2008, Google Inc.
17097 // All rights reserved.
17098 //
17099 // Redistribution and use in source and binary forms, with or without
17100 // modification, are permitted provided that the following conditions are
17101 // met:
17102 //
17103 //     * Redistributions of source code must retain the above copyright
17104 // notice, this list of conditions and the following disclaimer.
17105 //     * Redistributions in binary form must reproduce the above
17106 // copyright notice, this list of conditions and the following disclaimer
17107 // in the documentation and/or other materials provided with the
17108 // distribution.
17109 //     * Neither the name of Google Inc. nor the names of its
17110 // contributors may be used to endorse or promote products derived from
17111 // this software without specific prior written permission.
17112 //
17113 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17114 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
17115 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
17116 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
17117 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
17118 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
17119 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
17120 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
17121 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
17122 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
17123 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
17124 //
17125 // Author: mheule@google.com (Markus Heule)
17126 //
17127
17128 #ifndef GTEST_INCLUDE_GTEST_GTEST_TEST_PART_H_
17129 #define GTEST_INCLUDE_GTEST_GTEST_TEST_PART_H_
17130
17131 #include <iosfwd>
17132 #include <vector>
17133
17134 namespace testing {
17135
17136 // A copyable object representing the result of a test part (i.e. an
17137 // assertion or an explicit FAIL(), ADD_FAILURE(), or SUCCESS()).
17138 //
17139 // Don't inherit from TestPartResult as its destructor is not virtual.
17140 class GTEST_API_ TestPartResult {
17141  public:
17142   // The possible outcomes of a test part (i.e. an assertion or an
17143   // explicit SUCCEED(), FAIL(), or ADD_FAILURE()).
17144   enum Type {
17145     kSuccess,          // Succeeded.
17146     kNonFatalFailure,  // Failed but the test can continue.
17147     kFatalFailure      // Failed and the test should be terminated.
17148   };
17149
17150   // C'tor.  TestPartResult does NOT have a default constructor.
17151   // Always use this constructor (with parameters) to create a
17152   // TestPartResult object.
17153   TestPartResult(Type a_type,
17154                  const char* a_file_name,
17155                  int a_line_number,
17156                  const char* a_message)
17157       : type_(a_type),
17158         file_name_(a_file_name == NULL ? "" : a_file_name),
17159         line_number_(a_line_number),
17160         summary_(ExtractSummary(a_message)),
17161         message_(a_message) {
17162   }
17163
17164   // Gets the outcome of the test part.
17165   Type type() const { return type_; }
17166
17167   // Gets the name of the source file where the test part took place, or
17168   // NULL if it's unknown.
17169   const char* file_name() const {
17170     return file_name_.empty() ? NULL : file_name_.c_str();
17171   }
17172
17173   // Gets the line in the source file where the test part took place,
17174   // or -1 if it's unknown.
17175   int line_number() const { return line_number_; }
17176
17177   // Gets the summary of the failure message.
17178   const char* summary() const { return summary_.c_str(); }
17179
17180   // Gets the message associated with the test part.
17181   const char* message() const { return message_.c_str(); }
17182
17183   // Returns true iff the test part passed.
17184   bool passed() const { return type_ == kSuccess; }
17185
17186   // Returns true iff the test part failed.
17187   bool failed() const { return type_ != kSuccess; }
17188
17189   // Returns true iff the test part non-fatally failed.
17190   bool nonfatally_failed() const { return type_ == kNonFatalFailure; }
17191
17192   // Returns true iff the test part fatally failed.
17193   bool fatally_failed() const { return type_ == kFatalFailure; }
17194
17195  private:
17196   Type type_;
17197
17198   // Gets the summary of the failure message by omitting the stack
17199   // trace in it.
17200   static std::string ExtractSummary(const char* message);
17201
17202   // The name of the source file where the test part took place, or
17203   // "" if the source file is unknown.
17204   std::string file_name_;
17205   // The line in the source file where the test part took place, or -1
17206   // if the line number is unknown.
17207   int line_number_;
17208   std::string summary_;  // The test failure summary.
17209   std::string message_;  // The test failure message.
17210 };
17211
17212 // Prints a TestPartResult object.
17213 std::ostream& operator<<(std::ostream& os, const TestPartResult& result);
17214
17215 // An array of TestPartResult objects.
17216 //
17217 // Don't inherit from TestPartResultArray as its destructor is not
17218 // virtual.
17219 class GTEST_API_ TestPartResultArray {
17220  public:
17221   TestPartResultArray() {}
17222
17223   // Appends the given TestPartResult to the array.
17224   void Append(const TestPartResult& result);
17225
17226   // Returns the TestPartResult at the given index (0-based).
17227   const TestPartResult& GetTestPartResult(int index) const;
17228
17229   // Returns the number of TestPartResult objects in the array.
17230   int size() const;
17231
17232  private:
17233   std::vector<TestPartResult> array_;
17234
17235   GTEST_DISALLOW_COPY_AND_ASSIGN_(TestPartResultArray);
17236 };
17237
17238 // This interface knows how to report a test part result.
17239 class GTEST_API_ TestPartResultReporterInterface {
17240  public:
17241   virtual ~TestPartResultReporterInterface() {}
17242
17243   virtual void ReportTestPartResult(const TestPartResult& result) = 0;
17244 };
17245
17246 namespace internal {
17247
17248 // This helper class is used by {ASSERT|EXPECT}_NO_FATAL_FAILURE to check if a
17249 // statement generates new fatal failures. To do so it registers itself as the
17250 // current test part result reporter. Besides checking if fatal failures were
17251 // reported, it only delegates the reporting to the former result reporter.
17252 // The original result reporter is restored in the destructor.
17253 // INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
17254 class GTEST_API_ HasNewFatalFailureHelper
17255     : public TestPartResultReporterInterface {
17256  public:
17257   HasNewFatalFailureHelper();
17258   virtual ~HasNewFatalFailureHelper();
17259   virtual void ReportTestPartResult(const TestPartResult& result);
17260   bool has_new_fatal_failure() const { return has_new_fatal_failure_; }
17261  private:
17262   bool has_new_fatal_failure_;
17263   TestPartResultReporterInterface* original_reporter_;
17264
17265   GTEST_DISALLOW_COPY_AND_ASSIGN_(HasNewFatalFailureHelper);
17266 };
17267
17268 }  // namespace internal
17269
17270 }  // namespace testing
17271
17272 #endif  // GTEST_INCLUDE_GTEST_GTEST_TEST_PART_H_
17273 // Copyright 2008 Google Inc.
17274 // All Rights Reserved.
17275 //
17276 // Redistribution and use in source and binary forms, with or without
17277 // modification, are permitted provided that the following conditions are
17278 // met:
17279 //
17280 //     * Redistributions of source code must retain the above copyright
17281 // notice, this list of conditions and the following disclaimer.
17282 //     * Redistributions in binary form must reproduce the above
17283 // copyright notice, this list of conditions and the following disclaimer
17284 // in the documentation and/or other materials provided with the
17285 // distribution.
17286 //     * Neither the name of Google Inc. nor the names of its
17287 // contributors may be used to endorse or promote products derived from
17288 // this software without specific prior written permission.
17289 //
17290 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17291 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
17292 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
17293 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
17294 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
17295 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
17296 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
17297 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
17298 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
17299 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
17300 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
17301 //
17302 // Author: wan@google.com (Zhanyong Wan)
17303
17304 #ifndef GTEST_INCLUDE_GTEST_GTEST_TYPED_TEST_H_
17305 #define GTEST_INCLUDE_GTEST_GTEST_TYPED_TEST_H_
17306
17307 // This header implements typed tests and type-parameterized tests.
17308
17309 // Typed (aka type-driven) tests repeat the same test for types in a
17310 // list.  You must know which types you want to test with when writing
17311 // typed tests. Here's how you do it:
17312
17313 #if 0
17314
17315 // First, define a fixture class template.  It should be parameterized
17316 // by a type.  Remember to derive it from testing::Test.
17317 template <typename T>
17318 class FooTest : public testing::Test {
17319  public:
17320   ...
17321   typedef std::list<T> List;
17322   static T shared_;
17323   T value_;
17324 };
17325
17326 // Next, associate a list of types with the test case, which will be
17327 // repeated for each type in the list.  The typedef is necessary for
17328 // the macro to parse correctly.
17329 typedef testing::Types<char, int, unsigned int> MyTypes;
17330 TYPED_TEST_CASE(FooTest, MyTypes);
17331
17332 // If the type list contains only one type, you can write that type
17333 // directly without Types<...>:
17334 //   TYPED_TEST_CASE(FooTest, int);
17335
17336 // Then, use TYPED_TEST() instead of TEST_F() to define as many typed
17337 // tests for this test case as you want.
17338 TYPED_TEST(FooTest, DoesBlah) {
17339   // Inside a test, refer to TypeParam to get the type parameter.
17340   // Since we are inside a derived class template, C++ requires use to
17341   // visit the members of FooTest via 'this'.
17342   TypeParam n = this->value_;
17343
17344   // To visit static members of the fixture, add the TestFixture::
17345   // prefix.
17346   n += TestFixture::shared_;
17347
17348   // To refer to typedefs in the fixture, add the "typename
17349   // TestFixture::" prefix.
17350   typename TestFixture::List values;
17351   values.push_back(n);
17352   ...
17353 }
17354
17355 TYPED_TEST(FooTest, HasPropertyA) { ... }
17356
17357 #endif  // 0
17358
17359 // Type-parameterized tests are abstract test patterns parameterized
17360 // by a type.  Compared with typed tests, type-parameterized tests
17361 // allow you to define the test pattern without knowing what the type
17362 // parameters are.  The defined pattern can be instantiated with
17363 // different types any number of times, in any number of translation
17364 // units.
17365 //
17366 // If you are designing an interface or concept, you can define a
17367 // suite of type-parameterized tests to verify properties that any
17368 // valid implementation of the interface/concept should have.  Then,
17369 // each implementation can easily instantiate the test suite to verify
17370 // that it conforms to the requirements, without having to write
17371 // similar tests repeatedly.  Here's an example:
17372
17373 #if 0
17374
17375 // First, define a fixture class template.  It should be parameterized
17376 // by a type.  Remember to derive it from testing::Test.
17377 template <typename T>
17378 class FooTest : public testing::Test {
17379   ...
17380 };
17381
17382 // Next, declare that you will define a type-parameterized test case
17383 // (the _P suffix is for "parameterized" or "pattern", whichever you
17384 // prefer):
17385 TYPED_TEST_CASE_P(FooTest);
17386
17387 // Then, use TYPED_TEST_P() to define as many type-parameterized tests
17388 // for this type-parameterized test case as you want.
17389 TYPED_TEST_P(FooTest, DoesBlah) {
17390   // Inside a test, refer to TypeParam to get the type parameter.
17391   TypeParam n = 0;
17392   ...
17393 }
17394
17395 TYPED_TEST_P(FooTest, HasPropertyA) { ... }
17396
17397 // Now the tricky part: you need to register all test patterns before
17398 // you can instantiate them.  The first argument of the macro is the
17399 // test case name; the rest are the names of the tests in this test
17400 // case.
17401 REGISTER_TYPED_TEST_CASE_P(FooTest,
17402                            DoesBlah, HasPropertyA);
17403
17404 // Finally, you are free to instantiate the pattern with the types you
17405 // want.  If you put the above code in a header file, you can #include
17406 // it in multiple C++ source files and instantiate it multiple times.
17407 //
17408 // To distinguish different instances of the pattern, the first
17409 // argument to the INSTANTIATE_* macro is a prefix that will be added
17410 // to the actual test case name.  Remember to pick unique prefixes for
17411 // different instances.
17412 typedef testing::Types<char, int, unsigned int> MyTypes;
17413 INSTANTIATE_TYPED_TEST_CASE_P(My, FooTest, MyTypes);
17414
17415 // If the type list contains only one type, you can write that type
17416 // directly without Types<...>:
17417 //   INSTANTIATE_TYPED_TEST_CASE_P(My, FooTest, int);
17418
17419 #endif  // 0
17420
17421
17422 // Implements typed tests.
17423
17424 #if GTEST_HAS_TYPED_TEST
17425
17426 // INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.
17427 //
17428 // Expands to the name of the typedef for the type parameters of the
17429 // given test case.
17430 # define GTEST_TYPE_PARAMS_(TestCaseName) gtest_type_params_##TestCaseName##_
17431
17432 // The 'Types' template argument below must have spaces around it
17433 // since some compilers may choke on '>>' when passing a template
17434 // instance (e.g. Types<int>)
17435 # define TYPED_TEST_CASE(CaseName, Types) \
17436   typedef ::testing::internal::TypeList< Types >::type \
17437       GTEST_TYPE_PARAMS_(CaseName)
17438
17439 # define TYPED_TEST(CaseName, TestName) \
17440   template <typename gtest_TypeParam_> \
17441   class GTEST_TEST_CLASS_NAME_(CaseName, TestName) \
17442       : public CaseName<gtest_TypeParam_> { \
17443    private: \
17444     typedef CaseName<gtest_TypeParam_> TestFixture; \
17445     typedef gtest_TypeParam_ TypeParam; \
17446     virtual void TestBody(); \
17447   }; \
17448   bool gtest_##CaseName##_##TestName##_registered_ GTEST_ATTRIBUTE_UNUSED_ = \
17449       ::testing::internal::TypeParameterizedTest< \
17450           CaseName, \
17451           ::testing::internal::TemplateSel< \
17452               GTEST_TEST_CLASS_NAME_(CaseName, TestName)>, \
17453           GTEST_TYPE_PARAMS_(CaseName)>::Register(\
17454               "", #CaseName, #TestName, 0); \
17455   template <typename gtest_TypeParam_> \
17456   void GTEST_TEST_CLASS_NAME_(CaseName, TestName)<gtest_TypeParam_>::TestBody()
17457
17458 #endif  // GTEST_HAS_TYPED_TEST
17459
17460 // Implements type-parameterized tests.
17461
17462 #if GTEST_HAS_TYPED_TEST_P
17463
17464 // INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.
17465 //
17466 // Expands to the namespace name that the type-parameterized tests for
17467 // the given type-parameterized test case are defined in.  The exact
17468 // name of the namespace is subject to change without notice.
17469 # define GTEST_CASE_NAMESPACE_(TestCaseName) \
17470   gtest_case_##TestCaseName##_
17471
17472 // INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.
17473 //
17474 // Expands to the name of the variable used to remember the names of
17475 // the defined tests in the given test case.
17476 # define GTEST_TYPED_TEST_CASE_P_STATE_(TestCaseName) \
17477   gtest_typed_test_case_p_state_##TestCaseName##_
17478
17479 // INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE DIRECTLY.
17480 //
17481 // Expands to the name of the variable used to remember the names of
17482 // the registered tests in the given test case.
17483 # define GTEST_REGISTERED_TEST_NAMES_(TestCaseName) \
17484   gtest_registered_test_names_##TestCaseName##_
17485
17486 // The variables defined in the type-parameterized test macros are
17487 // static as typically these macros are used in a .h file that can be
17488 // #included in multiple translation units linked together.
17489 # define TYPED_TEST_CASE_P(CaseName) \
17490   static ::testing::internal::TypedTestCasePState \
17491       GTEST_TYPED_TEST_CASE_P_STATE_(CaseName)
17492
17493 # define TYPED_TEST_P(CaseName, TestName) \
17494   namespace GTEST_CASE_NAMESPACE_(CaseName) { \
17495   template <typename gtest_TypeParam_> \
17496   class TestName : public CaseName<gtest_TypeParam_> { \
17497    private: \
17498     typedef CaseName<gtest_TypeParam_> TestFixture; \
17499     typedef gtest_TypeParam_ TypeParam; \
17500     virtual void TestBody(); \
17501   }; \
17502   static bool gtest_##TestName##_defined_ GTEST_ATTRIBUTE_UNUSED_ = \
17503       GTEST_TYPED_TEST_CASE_P_STATE_(CaseName).AddTestName(\
17504           __FILE__, __LINE__, #CaseName, #TestName); \
17505   } \
17506   template <typename gtest_TypeParam_> \
17507   void GTEST_CASE_NAMESPACE_(CaseName)::TestName<gtest_TypeParam_>::TestBody()
17508
17509 # define REGISTER_TYPED_TEST_CASE_P(CaseName, ...) \
17510   namespace GTEST_CASE_NAMESPACE_(CaseName) { \
17511   typedef ::testing::internal::Templates<__VA_ARGS__>::type gtest_AllTests_; \
17512   } \
17513   static const char* const GTEST_REGISTERED_TEST_NAMES_(CaseName) = \
17514       GTEST_TYPED_TEST_CASE_P_STATE_(CaseName).VerifyRegisteredTestNames(\
17515           __FILE__, __LINE__, #__VA_ARGS__)
17516
17517 // The 'Types' template argument below must have spaces around it
17518 // since some compilers may choke on '>>' when passing a template
17519 // instance (e.g. Types<int>)
17520 # define INSTANTIATE_TYPED_TEST_CASE_P(Prefix, CaseName, Types) \
17521   bool gtest_##Prefix##_##CaseName GTEST_ATTRIBUTE_UNUSED_ = \
17522       ::testing::internal::TypeParameterizedTestCase<CaseName, \
17523           GTEST_CASE_NAMESPACE_(CaseName)::gtest_AllTests_, \
17524           ::testing::internal::TypeList< Types >::type>::Register(\
17525               #Prefix, #CaseName, GTEST_REGISTERED_TEST_NAMES_(CaseName))
17526
17527 #endif  // GTEST_HAS_TYPED_TEST_P
17528
17529 #endif  // GTEST_INCLUDE_GTEST_GTEST_TYPED_TEST_H_
17530
17531 // Depending on the platform, different string classes are available.
17532 // On Linux, in addition to ::std::string, Google also makes use of
17533 // class ::string, which has the same interface as ::std::string, but
17534 // has a different implementation.
17535 //
17536 // The user can define GTEST_HAS_GLOBAL_STRING to 1 to indicate that
17537 // ::string is available AND is a distinct type to ::std::string, or
17538 // define it to 0 to indicate otherwise.
17539 //
17540 // If the user's ::std::string and ::string are the same class due to
17541 // aliasing, he should define GTEST_HAS_GLOBAL_STRING to 0.
17542 //
17543 // If the user doesn't define GTEST_HAS_GLOBAL_STRING, it is defined
17544 // heuristically.
17545
17546 namespace testing {
17547
17548 // Declares the flags.
17549
17550 // This flag temporary enables the disabled tests.
17551 GTEST_DECLARE_bool_(also_run_disabled_tests);
17552
17553 // This flag brings the debugger on an assertion failure.
17554 GTEST_DECLARE_bool_(break_on_failure);
17555
17556 // This flag controls whether Google Test catches all test-thrown exceptions
17557 // and logs them as failures.
17558 GTEST_DECLARE_bool_(catch_exceptions);
17559
17560 // This flag enables using colors in terminal output. Available values are
17561 // "yes" to enable colors, "no" (disable colors), or "auto" (the default)
17562 // to let Google Test decide.
17563 GTEST_DECLARE_string_(color);
17564
17565 // This flag sets up the filter to select by name using a glob pattern
17566 // the tests to run. If the filter is not given all tests are executed.
17567 GTEST_DECLARE_string_(filter);
17568
17569 // OpenCV extension: same as filter, but for the parameters string.
17570 GTEST_DECLARE_string_(param_filter);
17571
17572 // This flag causes the Google Test to list tests. None of the tests listed
17573 // are actually run if the flag is provided.
17574 GTEST_DECLARE_bool_(list_tests);
17575
17576 // This flag controls whether Google Test emits a detailed XML report to a file
17577 // in addition to its normal textual output.
17578 GTEST_DECLARE_string_(output);
17579
17580 // This flags control whether Google Test prints the elapsed time for each
17581 // test.
17582 GTEST_DECLARE_bool_(print_time);
17583
17584 // This flag specifies the random number seed.
17585 GTEST_DECLARE_int32_(random_seed);
17586
17587 // This flag sets how many times the tests are repeated. The default value
17588 // is 1. If the value is -1 the tests are repeating forever.
17589 GTEST_DECLARE_int32_(repeat);
17590
17591 // This flag controls whether Google Test includes Google Test internal
17592 // stack frames in failure stack traces.
17593 GTEST_DECLARE_bool_(show_internal_stack_frames);
17594
17595 // When this flag is specified, tests' order is randomized on every iteration.
17596 GTEST_DECLARE_bool_(shuffle);
17597
17598 // This flag specifies the maximum number of stack frames to be
17599 // printed in a failure message.
17600 GTEST_DECLARE_int32_(stack_trace_depth);
17601
17602 // When this flag is specified, a failed assertion will throw an
17603 // exception if exceptions are enabled, or exit the program with a
17604 // non-zero code otherwise.
17605 GTEST_DECLARE_bool_(throw_on_failure);
17606
17607 // When this flag is set with a "host:port" string, on supported
17608 // platforms test results are streamed to the specified port on
17609 // the specified host machine.
17610 GTEST_DECLARE_string_(stream_result_to);
17611
17612 // The upper limit for valid stack trace depths.
17613 const int kMaxStackTraceDepth = 100;
17614
17615 namespace internal {
17616
17617 class AssertHelper;
17618 class DefaultGlobalTestPartResultReporter;
17619 class ExecDeathTest;
17620 class NoExecDeathTest;
17621 class FinalSuccessChecker;
17622 class GTestFlagSaver;
17623 class StreamingListenerTest;
17624 class TestResultAccessor;
17625 class TestEventListenersAccessor;
17626 class TestEventRepeater;
17627 class UnitTestRecordPropertyTestHelper;
17628 class WindowsDeathTest;
17629 class UnitTestImpl* GetUnitTestImpl();
17630 void ReportFailureInUnknownLocation(TestPartResult::Type result_type,
17631                                     const std::string& message);
17632
17633 }  // namespace internal
17634
17635 // The friend relationship of some of these classes is cyclic.
17636 // If we don't forward declare them the compiler might confuse the classes
17637 // in friendship clauses with same named classes on the scope.
17638 class Test;
17639 class TestCase;
17640 class TestInfo;
17641 class UnitTest;
17642
17643 // A class for indicating whether an assertion was successful.  When
17644 // the assertion wasn't successful, the AssertionResult object
17645 // remembers a non-empty message that describes how it failed.
17646 //
17647 // To create an instance of this class, use one of the factory functions
17648 // (AssertionSuccess() and AssertionFailure()).
17649 //
17650 // This class is useful for two purposes:
17651 //   1. Defining predicate functions to be used with Boolean test assertions
17652 //      EXPECT_TRUE/EXPECT_FALSE and their ASSERT_ counterparts
17653 //   2. Defining predicate-format functions to be
17654 //      used with predicate assertions (ASSERT_PRED_FORMAT*, etc).
17655 //
17656 // For example, if you define IsEven predicate:
17657 //
17658 //   testing::AssertionResult IsEven(int n) {
17659 //     if ((n % 2) == 0)
17660 //       return testing::AssertionSuccess();
17661 //     else
17662 //       return testing::AssertionFailure() << n << " is odd";
17663 //   }
17664 //
17665 // Then the failed expectation EXPECT_TRUE(IsEven(Fib(5)))
17666 // will print the message
17667 //
17668 //   Value of: IsEven(Fib(5))
17669 //     Actual: false (5 is odd)
17670 //   Expected: true
17671 //
17672 // instead of a more opaque
17673 //
17674 //   Value of: IsEven(Fib(5))
17675 //     Actual: false
17676 //   Expected: true
17677 //
17678 // in case IsEven is a simple Boolean predicate.
17679 //
17680 // If you expect your predicate to be reused and want to support informative
17681 // messages in EXPECT_FALSE and ASSERT_FALSE (negative assertions show up
17682 // about half as often as positive ones in our tests), supply messages for
17683 // both success and failure cases:
17684 //
17685 //   testing::AssertionResult IsEven(int n) {
17686 //     if ((n % 2) == 0)
17687 //       return testing::AssertionSuccess() << n << " is even";
17688 //     else
17689 //       return testing::AssertionFailure() << n << " is odd";
17690 //   }
17691 //
17692 // Then a statement EXPECT_FALSE(IsEven(Fib(6))) will print
17693 //
17694 //   Value of: IsEven(Fib(6))
17695 //     Actual: true (8 is even)
17696 //   Expected: false
17697 //
17698 // NB: Predicates that support negative Boolean assertions have reduced
17699 // performance in positive ones so be careful not to use them in tests
17700 // that have lots (tens of thousands) of positive Boolean assertions.
17701 //
17702 // To use this class with EXPECT_PRED_FORMAT assertions such as:
17703 //
17704 //   // Verifies that Foo() returns an even number.
17705 //   EXPECT_PRED_FORMAT1(IsEven, Foo());
17706 //
17707 // you need to define:
17708 //
17709 //   testing::AssertionResult IsEven(const char* expr, int n) {
17710 //     if ((n % 2) == 0)
17711 //       return testing::AssertionSuccess();
17712 //     else
17713 //       return testing::AssertionFailure()
17714 //         << "Expected: " << expr << " is even\n  Actual: it's " << n;
17715 //   }
17716 //
17717 // If Foo() returns 5, you will see the following message:
17718 //
17719 //   Expected: Foo() is even
17720 //     Actual: it's 5
17721 //
17722 class GTEST_API_ AssertionResult {
17723  public:
17724   // Copy constructor.
17725   // Used in EXPECT_TRUE/FALSE(assertion_result).
17726   AssertionResult(const AssertionResult& other);
17727   // Used in the EXPECT_TRUE/FALSE(bool_expression).
17728   explicit AssertionResult(bool success) : success_(success) {}
17729
17730   // Returns true iff the assertion succeeded.
17731   operator bool() const { return success_; }  // NOLINT
17732
17733   // Returns the assertion's negation. Used with EXPECT/ASSERT_FALSE.
17734   AssertionResult operator!() const;
17735
17736   // Returns the text streamed into this AssertionResult. Test assertions
17737   // use it when they fail (i.e., the predicate's outcome doesn't match the
17738   // assertion's expectation). When nothing has been streamed into the
17739   // object, returns an empty string.
17740   const char* message() const {
17741     return message_.get() != NULL ?  message_->c_str() : "";
17742   }
17743   // TODO(vladl@google.com): Remove this after making sure no clients use it.
17744   // Deprecated; please use message() instead.
17745   const char* failure_message() const { return message(); }
17746
17747   // Streams a custom failure message into this object.
17748   template <typename T> AssertionResult& operator<<(const T& value) {
17749     AppendMessage(Message() << value);
17750     return *this;
17751   }
17752
17753   // Allows streaming basic output manipulators such as endl or flush into
17754   // this object.
17755   AssertionResult& operator<<(
17756       ::std::ostream& (*basic_manipulator)(::std::ostream& stream)) {
17757     AppendMessage(Message() << basic_manipulator);
17758     return *this;
17759   }
17760
17761  private:
17762   // Appends the contents of message to message_.
17763   void AppendMessage(const Message& a_message) {
17764     if (message_.get() == NULL)
17765       message_.reset(new ::std::string);
17766     message_->append(a_message.GetString().c_str());
17767   }
17768
17769   // Stores result of the assertion predicate.
17770   bool success_;
17771   // Stores the message describing the condition in case the expectation
17772   // construct is not satisfied with the predicate's outcome.
17773   // Referenced via a pointer to avoid taking too much stack frame space
17774   // with test assertions.
17775   internal::scoped_ptr< ::std::string> message_;
17776
17777   GTEST_DISALLOW_ASSIGN_(AssertionResult);
17778 };
17779
17780 // Makes a successful assertion result.
17781 GTEST_API_ AssertionResult AssertionSuccess();
17782
17783 // Makes a failed assertion result.
17784 GTEST_API_ AssertionResult AssertionFailure();
17785
17786 // Makes a failed assertion result with the given failure message.
17787 // Deprecated; use AssertionFailure() << msg.
17788 GTEST_API_ AssertionResult AssertionFailure(const Message& msg);
17789
17790 // The abstract class that all tests inherit from.
17791 //
17792 // In Google Test, a unit test program contains one or many TestCases, and
17793 // each TestCase contains one or many Tests.
17794 //
17795 // When you define a test using the TEST macro, you don't need to
17796 // explicitly derive from Test - the TEST macro automatically does
17797 // this for you.
17798 //
17799 // The only time you derive from Test is when defining a test fixture
17800 // to be used a TEST_F.  For example:
17801 //
17802 //   class FooTest : public testing::Test {
17803 //    protected:
17804 //     virtual void SetUp() { ... }
17805 //     virtual void TearDown() { ... }
17806 //     ...
17807 //   };
17808 //
17809 //   TEST_F(FooTest, Bar) { ... }
17810 //   TEST_F(FooTest, Baz) { ... }
17811 //
17812 // Test is not copyable.
17813 class GTEST_API_ Test {
17814  public:
17815   friend class TestInfo;
17816
17817   // Defines types for pointers to functions that set up and tear down
17818   // a test case.
17819   typedef internal::SetUpTestCaseFunc SetUpTestCaseFunc;
17820   typedef internal::TearDownTestCaseFunc TearDownTestCaseFunc;
17821
17822   // The d'tor is virtual as we intend to inherit from Test.
17823   virtual ~Test();
17824
17825   // Sets up the stuff shared by all tests in this test case.
17826   //
17827   // Google Test will call Foo::SetUpTestCase() before running the first
17828   // test in test case Foo.  Hence a sub-class can define its own
17829   // SetUpTestCase() method to shadow the one defined in the super
17830   // class.
17831   static void SetUpTestCase() {}
17832
17833   // Tears down the stuff shared by all tests in this test case.
17834   //
17835   // Google Test will call Foo::TearDownTestCase() after running the last
17836   // test in test case Foo.  Hence a sub-class can define its own
17837   // TearDownTestCase() method to shadow the one defined in the super
17838   // class.
17839   static void TearDownTestCase() {}
17840
17841   // Returns true iff the current test has a fatal failure.
17842   static bool HasFatalFailure();
17843
17844   // Returns true iff the current test has a non-fatal failure.
17845   static bool HasNonfatalFailure();
17846
17847   // Returns true iff the current test has a (either fatal or
17848   // non-fatal) failure.
17849   static bool HasFailure() { return HasFatalFailure() || HasNonfatalFailure(); }
17850
17851   // Logs a property for the current test, test case, or for the entire
17852   // invocation of the test program when used outside of the context of a
17853   // test case.  Only the last value for a given key is remembered.  These
17854   // are public static so they can be called from utility functions that are
17855   // not members of the test fixture.  Calls to RecordProperty made during
17856   // lifespan of the test (from the moment its constructor starts to the
17857   // moment its destructor finishes) will be output in XML as attributes of
17858   // the <testcase> element.  Properties recorded from fixture's
17859   // SetUpTestCase or TearDownTestCase are logged as attributes of the
17860   // corresponding <testsuite> element.  Calls to RecordProperty made in the
17861   // global context (before or after invocation of RUN_ALL_TESTS and from
17862   // SetUp/TearDown method of Environment objects registered with Google
17863   // Test) will be output as attributes of the <testsuites> element.
17864   static void RecordProperty(const std::string& key, const std::string& value);
17865   static void RecordProperty(const std::string& key, int value);
17866
17867  protected:
17868   // Creates a Test object.
17869   Test();
17870
17871   // Sets up the test fixture.
17872   virtual void SetUp();
17873
17874   // Tears down the test fixture.
17875   virtual void TearDown();
17876
17877  private:
17878   // Returns true iff the current test has the same fixture class as
17879   // the first test in the current test case.
17880   static bool HasSameFixtureClass();
17881
17882   // Runs the test after the test fixture has been set up.
17883   //
17884   // A sub-class must implement this to define the test logic.
17885   //
17886   // DO NOT OVERRIDE THIS FUNCTION DIRECTLY IN A USER PROGRAM.
17887   // Instead, use the TEST or TEST_F macro.
17888   virtual void TestBody() = 0;
17889
17890   // Sets up, executes, and tears down the test.
17891   void Run();
17892
17893   // Deletes self.  We deliberately pick an unusual name for this
17894   // internal method to avoid clashing with names used in user TESTs.
17895   void DeleteSelf_() { delete this; }
17896
17897   // Uses a GTestFlagSaver to save and restore all Google Test flags.
17898   const internal::GTestFlagSaver* const gtest_flag_saver_;
17899
17900   // Often a user mis-spells SetUp() as Setup() and spends a long time
17901   // wondering why it is never called by Google Test.  The declaration of
17902   // the following method is solely for catching such an error at
17903   // compile time:
17904   //
17905   //   - The return type is deliberately chosen to be not void, so it
17906   //   will be a conflict if a user declares void Setup() in his test
17907   //   fixture.
17908   //
17909   //   - This method is private, so it will be another compiler error
17910   //   if a user calls it from his test fixture.
17911   //
17912   // DO NOT OVERRIDE THIS FUNCTION.
17913   //
17914   // If you see an error about overriding the following function or
17915   // about it being private, you have mis-spelled SetUp() as Setup().
17916   struct Setup_should_be_spelled_SetUp {};
17917   virtual Setup_should_be_spelled_SetUp* Setup() { return NULL; }
17918
17919   // We disallow copying Tests.
17920   GTEST_DISALLOW_COPY_AND_ASSIGN_(Test);
17921 };
17922
17923 typedef internal::TimeInMillis TimeInMillis;
17924
17925 // A copyable object representing a user specified test property which can be
17926 // output as a key/value string pair.
17927 //
17928 // Don't inherit from TestProperty as its destructor is not virtual.
17929 class TestProperty {
17930  public:
17931   // C'tor.  TestProperty does NOT have a default constructor.
17932   // Always use this constructor (with parameters) to create a
17933   // TestProperty object.
17934   TestProperty(const std::string& a_key, const std::string& a_value) :
17935     key_(a_key), value_(a_value) {
17936   }
17937
17938   // Gets the user supplied key.
17939   const char* key() const {
17940     return key_.c_str();
17941   }
17942
17943   // Gets the user supplied value.
17944   const char* value() const {
17945     return value_.c_str();
17946   }
17947
17948   // Sets a new value, overriding the one supplied in the constructor.
17949   void SetValue(const std::string& new_value) {
17950     value_ = new_value;
17951   }
17952
17953  private:
17954   // The key supplied by the user.
17955   std::string key_;
17956   // The value supplied by the user.
17957   std::string value_;
17958 };
17959
17960 // The result of a single Test.  This includes a list of
17961 // TestPartResults, a list of TestProperties, a count of how many
17962 // death tests there are in the Test, and how much time it took to run
17963 // the Test.
17964 //
17965 // TestResult is not copyable.
17966 class GTEST_API_ TestResult {
17967  public:
17968   // Creates an empty TestResult.
17969   TestResult();
17970
17971   // D'tor.  Do not inherit from TestResult.
17972   ~TestResult();
17973
17974   // Gets the number of all test parts.  This is the sum of the number
17975   // of successful test parts and the number of failed test parts.
17976   int total_part_count() const;
17977
17978   // Returns the number of the test properties.
17979   int test_property_count() const;
17980
17981   // Returns true iff the test passed (i.e. no test part failed).
17982   bool Passed() const { return !Failed(); }
17983
17984   // Returns true iff the test failed.
17985   bool Failed() const;
17986
17987   // Returns true iff the test fatally failed.
17988   bool HasFatalFailure() const;
17989
17990   // Returns true iff the test has a non-fatal failure.
17991   bool HasNonfatalFailure() const;
17992
17993   // Returns the elapsed time, in milliseconds.
17994   TimeInMillis elapsed_time() const { return elapsed_time_; }
17995
17996   // Returns the i-th test part result among all the results. i can range
17997   // from 0 to test_property_count() - 1. If i is not in that range, aborts
17998   // the program.
17999   const TestPartResult& GetTestPartResult(int i) const;
18000
18001   // Returns the i-th test property. i can range from 0 to
18002   // test_property_count() - 1. If i is not in that range, aborts the
18003   // program.
18004   const TestProperty& GetTestProperty(int i) const;
18005
18006  private:
18007   friend class TestInfo;
18008   friend class TestCase;
18009   friend class UnitTest;
18010   friend class internal::DefaultGlobalTestPartResultReporter;
18011   friend class internal::ExecDeathTest;
18012   friend class internal::TestResultAccessor;
18013   friend class internal::UnitTestImpl;
18014   friend class internal::WindowsDeathTest;
18015
18016   // Gets the vector of TestPartResults.
18017   const std::vector<TestPartResult>& test_part_results() const {
18018     return test_part_results_;
18019   }
18020
18021   // Gets the vector of TestProperties.
18022   const std::vector<TestProperty>& test_properties() const {
18023     return test_properties_;
18024   }
18025
18026   // Sets the elapsed time.
18027   void set_elapsed_time(TimeInMillis elapsed) { elapsed_time_ = elapsed; }
18028
18029   // Adds a test property to the list. The property is validated and may add
18030   // a non-fatal failure if invalid (e.g., if it conflicts with reserved
18031   // key names). If a property is already recorded for the same key, the
18032   // value will be updated, rather than storing multiple values for the same
18033   // key.  xml_element specifies the element for which the property is being
18034   // recorded and is used for validation.
18035   void RecordProperty(const std::string& xml_element,
18036                       const TestProperty& test_property);
18037
18038   // Adds a failure if the key is a reserved attribute of Google Test
18039   // testcase tags.  Returns true if the property is valid.
18040   // TODO(russr): Validate attribute names are legal and human readable.
18041   static bool ValidateTestProperty(const std::string& xml_element,
18042                                    const TestProperty& test_property);
18043
18044   // Adds a test part result to the list.
18045   void AddTestPartResult(const TestPartResult& test_part_result);
18046
18047   // Returns the death test count.
18048   int death_test_count() const { return death_test_count_; }
18049
18050   // Increments the death test count, returning the new count.
18051   int increment_death_test_count() { return ++death_test_count_; }
18052
18053   // Clears the test part results.
18054   void ClearTestPartResults();
18055
18056   // Clears the object.
18057   void Clear();
18058
18059   // Protects mutable state of the property vector and of owned
18060   // properties, whose values may be updated.
18061   internal::Mutex test_properites_mutex_;
18062
18063   // The vector of TestPartResults
18064   std::vector<TestPartResult> test_part_results_;
18065   // The vector of TestProperties
18066   std::vector<TestProperty> test_properties_;
18067   // Running count of death tests.
18068   int death_test_count_;
18069   // The elapsed time, in milliseconds.
18070   TimeInMillis elapsed_time_;
18071
18072   // We disallow copying TestResult.
18073   GTEST_DISALLOW_COPY_AND_ASSIGN_(TestResult);
18074 };  // class TestResult
18075
18076 // A TestInfo object stores the following information about a test:
18077 //
18078 //   Test case name
18079 //   Test name
18080 //   Whether the test should be run
18081 //   A function pointer that creates the test object when invoked
18082 //   Test result
18083 //
18084 // The constructor of TestInfo registers itself with the UnitTest
18085 // singleton such that the RUN_ALL_TESTS() macro knows which tests to
18086 // run.
18087 class GTEST_API_ TestInfo {
18088  public:
18089   // Destructs a TestInfo object.  This function is not virtual, so
18090   // don't inherit from TestInfo.
18091   ~TestInfo();
18092
18093   // Returns the test case name.
18094   const char* test_case_name() const { return test_case_name_.c_str(); }
18095
18096   // Returns the test name.
18097   const char* name() const { return name_.c_str(); }
18098
18099   // Returns the name of the parameter type, or NULL if this is not a typed
18100   // or a type-parameterized test.
18101   const char* type_param() const {
18102     if (type_param_.get() != NULL)
18103       return type_param_->c_str();
18104     return NULL;
18105   }
18106
18107   // Returns the text representation of the value parameter, or NULL if this
18108   // is not a value-parameterized test.
18109   const char* value_param() const {
18110     if (value_param_.get() != NULL)
18111       return value_param_->c_str();
18112     return NULL;
18113   }
18114
18115   // Returns true if this test should run, that is if the test is not disabled
18116   // (or it is disabled but the also_run_disabled_tests flag has been specified)
18117   // and its full name matches the user-specified filter.
18118   //
18119   // Google Test allows the user to filter the tests by their full names.
18120   // The full name of a test Bar in test case Foo is defined as
18121   // "Foo.Bar".  Only the tests that match the filter will run.
18122   //
18123   // A filter is a colon-separated list of glob (not regex) patterns,
18124   // optionally followed by a '-' and a colon-separated list of
18125   // negative patterns (tests to exclude).  A test is run if it
18126   // matches one of the positive patterns and does not match any of
18127   // the negative patterns.
18128   //
18129   // For example, *A*:Foo.* is a filter that matches any string that
18130   // contains the character 'A' or starts with "Foo.".
18131   bool should_run() const { return should_run_; }
18132
18133   // Returns the result of the test.
18134   const TestResult* result() const { return &result_; }
18135
18136  private:
18137 #if GTEST_HAS_DEATH_TEST
18138   friend class internal::DefaultDeathTestFactory;
18139 #endif  // GTEST_HAS_DEATH_TEST
18140   friend class Test;
18141   friend class TestCase;
18142   friend class internal::UnitTestImpl;
18143   friend class internal::StreamingListenerTest;
18144   friend TestInfo* internal::MakeAndRegisterTestInfo(
18145       const char* test_case_name,
18146       const char* name,
18147       const char* type_param,
18148       const char* value_param,
18149       internal::TypeId fixture_class_id,
18150       Test::SetUpTestCaseFunc set_up_tc,
18151       Test::TearDownTestCaseFunc tear_down_tc,
18152       internal::TestFactoryBase* factory);
18153
18154   // Constructs a TestInfo object. The newly constructed instance assumes
18155   // ownership of the factory object.
18156   TestInfo(const std::string& test_case_name,
18157            const std::string& name,
18158            const char* a_type_param,   // NULL if not a type-parameterized test
18159            const char* a_value_param,  // NULL if not a value-parameterized test
18160            internal::TypeId fixture_class_id,
18161            internal::TestFactoryBase* factory);
18162
18163   // Increments the number of death tests encountered in this test so
18164   // far.
18165   int increment_death_test_count() {
18166     return result_.increment_death_test_count();
18167   }
18168
18169   // Creates the test object, runs it, records its result, and then
18170   // deletes it.
18171   void Run();
18172
18173   static void ClearTestResult(TestInfo* test_info) {
18174     test_info->result_.Clear();
18175   }
18176
18177   // These fields are immutable properties of the test.
18178   const std::string test_case_name_;     // Test case name
18179   const std::string name_;               // Test name
18180   // Name of the parameter type, or NULL if this is not a typed or a
18181   // type-parameterized test.
18182   const internal::scoped_ptr<const ::std::string> type_param_;
18183   // Text representation of the value parameter, or NULL if this is not a
18184   // value-parameterized test.
18185   const internal::scoped_ptr<const ::std::string> value_param_;
18186   const internal::TypeId fixture_class_id_;   // ID of the test fixture class
18187   bool should_run_;                 // True iff this test should run
18188   bool is_disabled_;                // True iff this test is disabled
18189   bool matches_filter_;             // True if this test matches the
18190                                     // user-specified filter.
18191   internal::TestFactoryBase* const factory_;  // The factory that creates
18192                                               // the test object
18193
18194   // This field is mutable and needs to be reset before running the
18195   // test for the second time.
18196   TestResult result_;
18197
18198   GTEST_DISALLOW_COPY_AND_ASSIGN_(TestInfo);
18199 };
18200
18201 // A test case, which consists of a vector of TestInfos.
18202 //
18203 // TestCase is not copyable.
18204 class GTEST_API_ TestCase {
18205  public:
18206   // Creates a TestCase with the given name.
18207   //
18208   // TestCase does NOT have a default constructor.  Always use this
18209   // constructor to create a TestCase object.
18210   //
18211   // Arguments:
18212   //
18213   //   name:         name of the test case
18214   //   a_type_param: the name of the test's type parameter, or NULL if
18215   //                 this is not a type-parameterized test.
18216   //   set_up_tc:    pointer to the function that sets up the test case
18217   //   tear_down_tc: pointer to the function that tears down the test case
18218   TestCase(const char* name, const char* a_type_param,
18219            Test::SetUpTestCaseFunc set_up_tc,
18220            Test::TearDownTestCaseFunc tear_down_tc);
18221
18222   // Destructor of TestCase.
18223   virtual ~TestCase();
18224
18225   // Gets the name of the TestCase.
18226   const char* name() const { return name_.c_str(); }
18227
18228   // Returns the name of the parameter type, or NULL if this is not a
18229   // type-parameterized test case.
18230   const char* type_param() const {
18231     if (type_param_.get() != NULL)
18232       return type_param_->c_str();
18233     return NULL;
18234   }
18235
18236   // Returns true if any test in this test case should run.
18237   bool should_run() const { return should_run_; }
18238
18239   // Gets the number of successful tests in this test case.
18240   int successful_test_count() const;
18241
18242   // Gets the number of failed tests in this test case.
18243   int failed_test_count() const;
18244
18245   // Gets the number of disabled tests in this test case.
18246   int disabled_test_count() const;
18247
18248   // Get the number of tests in this test case that should run.
18249   int test_to_run_count() const;
18250
18251   // Gets the number of all tests in this test case.
18252   int total_test_count() const;
18253
18254   // Returns true iff the test case passed.
18255   bool Passed() const { return !Failed(); }
18256
18257   // Returns true iff the test case failed.
18258   bool Failed() const { return failed_test_count() > 0; }
18259
18260   // Returns the elapsed time, in milliseconds.
18261   TimeInMillis elapsed_time() const { return elapsed_time_; }
18262
18263   // Returns the i-th test among all the tests. i can range from 0 to
18264   // total_test_count() - 1. If i is not in that range, returns NULL.
18265   const TestInfo* GetTestInfo(int i) const;
18266
18267   // Returns the TestResult that holds test properties recorded during
18268   // execution of SetUpTestCase and TearDownTestCase.
18269   const TestResult& ad_hoc_test_result() const { return ad_hoc_test_result_; }
18270
18271  private:
18272   friend class Test;
18273   friend class internal::UnitTestImpl;
18274
18275   // Gets the (mutable) vector of TestInfos in this TestCase.
18276   std::vector<TestInfo*>& test_info_list() { return test_info_list_; }
18277
18278   // Gets the (immutable) vector of TestInfos in this TestCase.
18279   const std::vector<TestInfo*>& test_info_list() const {
18280     return test_info_list_;
18281   }
18282
18283   // Returns the i-th test among all the tests. i can range from 0 to
18284   // total_test_count() - 1. If i is not in that range, returns NULL.
18285   TestInfo* GetMutableTestInfo(int i);
18286
18287   // Sets the should_run member.
18288   void set_should_run(bool should) { should_run_ = should; }
18289
18290   // Adds a TestInfo to this test case.  Will delete the TestInfo upon
18291   // destruction of the TestCase object.
18292   void AddTestInfo(TestInfo * test_info);
18293
18294   // Clears the results of all tests in this test case.
18295   void ClearResult();
18296
18297   // Clears the results of all tests in the given test case.
18298   static void ClearTestCaseResult(TestCase* test_case) {
18299     test_case->ClearResult();
18300   }
18301
18302   // Runs every test in this TestCase.
18303   void Run();
18304
18305   // Runs SetUpTestCase() for this TestCase.  This wrapper is needed
18306   // for catching exceptions thrown from SetUpTestCase().
18307   void RunSetUpTestCase() { (*set_up_tc_)(); }
18308
18309   // Runs TearDownTestCase() for this TestCase.  This wrapper is
18310   // needed for catching exceptions thrown from TearDownTestCase().
18311   void RunTearDownTestCase() { (*tear_down_tc_)(); }
18312
18313   // Returns true iff test passed.
18314   static bool TestPassed(const TestInfo* test_info) {
18315     return test_info->should_run() && test_info->result()->Passed();
18316   }
18317
18318   // Returns true iff test failed.
18319   static bool TestFailed(const TestInfo* test_info) {
18320     return test_info->should_run() && test_info->result()->Failed();
18321   }
18322
18323   // Returns true iff test is disabled.
18324   static bool TestDisabled(const TestInfo* test_info) {
18325     return test_info->is_disabled_;
18326   }
18327
18328   // Returns true if the given test should run.
18329   static bool ShouldRunTest(const TestInfo* test_info) {
18330     return test_info->should_run();
18331   }
18332
18333   // Shuffles the tests in this test case.
18334   void ShuffleTests(internal::Random* random);
18335
18336   // Restores the test order to before the first shuffle.
18337   void UnshuffleTests();
18338
18339   // Name of the test case.
18340   std::string name_;
18341   // Name of the parameter type, or NULL if this is not a typed or a
18342   // type-parameterized test.
18343   const internal::scoped_ptr<const ::std::string> type_param_;
18344   // The vector of TestInfos in their original order.  It owns the
18345   // elements in the vector.
18346   std::vector<TestInfo*> test_info_list_;
18347   // Provides a level of indirection for the test list to allow easy
18348   // shuffling and restoring the test order.  The i-th element in this
18349   // vector is the index of the i-th test in the shuffled test list.
18350   std::vector<int> test_indices_;
18351   // Pointer to the function that sets up the test case.
18352   Test::SetUpTestCaseFunc set_up_tc_;
18353   // Pointer to the function that tears down the test case.
18354   Test::TearDownTestCaseFunc tear_down_tc_;
18355   // True iff any test in this test case should run.
18356   bool should_run_;
18357   // Elapsed time, in milliseconds.
18358   TimeInMillis elapsed_time_;
18359   // Holds test properties recorded during execution of SetUpTestCase and
18360   // TearDownTestCase.
18361   TestResult ad_hoc_test_result_;
18362
18363   // We disallow copying TestCases.
18364   GTEST_DISALLOW_COPY_AND_ASSIGN_(TestCase);
18365 };
18366
18367 // An Environment object is capable of setting up and tearing down an
18368 // environment.  The user should subclass this to define his own
18369 // environment(s).
18370 //
18371 // An Environment object does the set-up and tear-down in virtual
18372 // methods SetUp() and TearDown() instead of the constructor and the
18373 // destructor, as:
18374 //
18375 //   1. You cannot safely throw from a destructor.  This is a problem
18376 //      as in some cases Google Test is used where exceptions are enabled, and
18377 //      we may want to implement ASSERT_* using exceptions where they are
18378 //      available.
18379 //   2. You cannot use ASSERT_* directly in a constructor or
18380 //      destructor.
18381 class Environment {
18382  public:
18383   // The d'tor is virtual as we need to subclass Environment.
18384   virtual ~Environment() {}
18385
18386   // Override this to define how to set up the environment.
18387   virtual void SetUp() {}
18388
18389   // Override this to define how to tear down the environment.
18390   virtual void TearDown() {}
18391  private:
18392   // If you see an error about overriding the following function or
18393   // about it being private, you have mis-spelled SetUp() as Setup().
18394   struct Setup_should_be_spelled_SetUp {};
18395   virtual Setup_should_be_spelled_SetUp* Setup() { return NULL; }
18396 };
18397
18398 // The interface for tracing execution of tests. The methods are organized in
18399 // the order the corresponding events are fired.
18400 class TestEventListener {
18401  public:
18402   virtual ~TestEventListener() {}
18403
18404   // Fired before any test activity starts.
18405   virtual void OnTestProgramStart(const UnitTest& unit_test) = 0;
18406
18407   // Fired before each iteration of tests starts.  There may be more than
18408   // one iteration if GTEST_FLAG(repeat) is set. iteration is the iteration
18409   // index, starting from 0.
18410   virtual void OnTestIterationStart(const UnitTest& unit_test,
18411                                     int iteration) = 0;
18412
18413   // Fired before environment set-up for each iteration of tests starts.
18414   virtual void OnEnvironmentsSetUpStart(const UnitTest& unit_test) = 0;
18415
18416   // Fired after environment set-up for each iteration of tests ends.
18417   virtual void OnEnvironmentsSetUpEnd(const UnitTest& unit_test) = 0;
18418
18419   // Fired before the test case starts.
18420   virtual void OnTestCaseStart(const TestCase& test_case) = 0;
18421
18422   // Fired before the test starts.
18423   virtual void OnTestStart(const TestInfo& test_info) = 0;
18424
18425   // Fired after a failed assertion or a SUCCEED() invocation.
18426   virtual void OnTestPartResult(const TestPartResult& test_part_result) = 0;
18427
18428   // Fired after the test ends.
18429   virtual void OnTestEnd(const TestInfo& test_info) = 0;
18430
18431   // Fired after the test case ends.
18432   virtual void OnTestCaseEnd(const TestCase& test_case) = 0;
18433
18434   // Fired before environment tear-down for each iteration of tests starts.
18435   virtual void OnEnvironmentsTearDownStart(const UnitTest& unit_test) = 0;
18436
18437   // Fired after environment tear-down for each iteration of tests ends.
18438   virtual void OnEnvironmentsTearDownEnd(const UnitTest& unit_test) = 0;
18439
18440   // Fired after each iteration of tests finishes.
18441   virtual void OnTestIterationEnd(const UnitTest& unit_test,
18442                                   int iteration) = 0;
18443
18444   // Fired after all test activities have ended.
18445   virtual void OnTestProgramEnd(const UnitTest& unit_test) = 0;
18446 };
18447
18448 // The convenience class for users who need to override just one or two
18449 // methods and are not concerned that a possible change to a signature of
18450 // the methods they override will not be caught during the build.  For
18451 // comments about each method please see the definition of TestEventListener
18452 // above.
18453 class EmptyTestEventListener : public TestEventListener {
18454  public:
18455   virtual void OnTestProgramStart(const UnitTest& /*unit_test*/) {}
18456   virtual void OnTestIterationStart(const UnitTest& /*unit_test*/,
18457                                     int /*iteration*/) {}
18458   virtual void OnEnvironmentsSetUpStart(const UnitTest& /*unit_test*/) {}
18459   virtual void OnEnvironmentsSetUpEnd(const UnitTest& /*unit_test*/) {}
18460   virtual void OnTestCaseStart(const TestCase& /*test_case*/) {}
18461   virtual void OnTestStart(const TestInfo& /*test_info*/) {}
18462   virtual void OnTestPartResult(const TestPartResult& /*test_part_result*/) {}
18463   virtual void OnTestEnd(const TestInfo& /*test_info*/) {}
18464   virtual void OnTestCaseEnd(const TestCase& /*test_case*/) {}
18465   virtual void OnEnvironmentsTearDownStart(const UnitTest& /*unit_test*/) {}
18466   virtual void OnEnvironmentsTearDownEnd(const UnitTest& /*unit_test*/) {}
18467   virtual void OnTestIterationEnd(const UnitTest& /*unit_test*/,
18468                                   int /*iteration*/) {}
18469   virtual void OnTestProgramEnd(const UnitTest& /*unit_test*/) {}
18470 };
18471
18472 // TestEventListeners lets users add listeners to track events in Google Test.
18473 class GTEST_API_ TestEventListeners {
18474  public:
18475   TestEventListeners();
18476   ~TestEventListeners();
18477
18478   // Appends an event listener to the end of the list. Google Test assumes
18479   // the ownership of the listener (i.e. it will delete the listener when
18480   // the test program finishes).
18481   void Append(TestEventListener* listener);
18482
18483   // Removes the given event listener from the list and returns it.  It then
18484   // becomes the caller's responsibility to delete the listener. Returns
18485   // NULL if the listener is not found in the list.
18486   TestEventListener* Release(TestEventListener* listener);
18487
18488   // Returns the standard listener responsible for the default console
18489   // output.  Can be removed from the listeners list to shut down default
18490   // console output.  Note that removing this object from the listener list
18491   // with Release transfers its ownership to the caller and makes this
18492   // function return NULL the next time.
18493   TestEventListener* default_result_printer() const {
18494     return default_result_printer_;
18495   }
18496
18497   // Returns the standard listener responsible for the default XML output
18498   // controlled by the --gtest_output=xml flag.  Can be removed from the
18499   // listeners list by users who want to shut down the default XML output
18500   // controlled by this flag and substitute it with custom one.  Note that
18501   // removing this object from the listener list with Release transfers its
18502   // ownership to the caller and makes this function return NULL the next
18503   // time.
18504   TestEventListener* default_xml_generator() const {
18505     return default_xml_generator_;
18506   }
18507
18508  private:
18509   friend class TestCase;
18510   friend class TestInfo;
18511   friend class internal::DefaultGlobalTestPartResultReporter;
18512   friend class internal::NoExecDeathTest;
18513   friend class internal::TestEventListenersAccessor;
18514   friend class internal::UnitTestImpl;
18515
18516   // Returns repeater that broadcasts the TestEventListener events to all
18517   // subscribers.
18518   TestEventListener* repeater();
18519
18520   // Sets the default_result_printer attribute to the provided listener.
18521   // The listener is also added to the listener list and previous
18522   // default_result_printer is removed from it and deleted. The listener can
18523   // also be NULL in which case it will not be added to the list. Does
18524   // nothing if the previous and the current listener objects are the same.
18525   void SetDefaultResultPrinter(TestEventListener* listener);
18526
18527   // Sets the default_xml_generator attribute to the provided listener.  The
18528   // listener is also added to the listener list and previous
18529   // default_xml_generator is removed from it and deleted. The listener can
18530   // also be NULL in which case it will not be added to the list. Does
18531   // nothing if the previous and the current listener objects are the same.
18532   void SetDefaultXmlGenerator(TestEventListener* listener);
18533
18534   // Controls whether events will be forwarded by the repeater to the
18535   // listeners in the list.
18536   bool EventForwardingEnabled() const;
18537   void SuppressEventForwarding();
18538
18539   // The actual list of listeners.
18540   internal::TestEventRepeater* repeater_;
18541   // Listener responsible for the standard result output.
18542   TestEventListener* default_result_printer_;
18543   // Listener responsible for the creation of the XML output file.
18544   TestEventListener* default_xml_generator_;
18545
18546   // We disallow copying TestEventListeners.
18547   GTEST_DISALLOW_COPY_AND_ASSIGN_(TestEventListeners);
18548 };
18549
18550 // A UnitTest consists of a vector of TestCases.
18551 //
18552 // This is a singleton class.  The only instance of UnitTest is
18553 // created when UnitTest::GetInstance() is first called.  This
18554 // instance is never deleted.
18555 //
18556 // UnitTest is not copyable.
18557 //
18558 // This class is thread-safe as long as the methods are called
18559 // according to their specification.
18560 class GTEST_API_ UnitTest {
18561  public:
18562   // Gets the singleton UnitTest object.  The first time this method
18563   // is called, a UnitTest object is constructed and returned.
18564   // Consecutive calls will return the same object.
18565   static UnitTest* GetInstance();
18566
18567   // Runs all tests in this UnitTest object and prints the result.
18568   // Returns 0 if successful, or 1 otherwise.
18569   //
18570   // This method can only be called from the main thread.
18571   //
18572   // INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
18573   int Run() GTEST_MUST_USE_RESULT_;
18574
18575   // Returns the working directory when the first TEST() or TEST_F()
18576   // was executed.  The UnitTest object owns the string.
18577   const char* original_working_dir() const;
18578
18579   // Returns the TestCase object for the test that's currently running,
18580   // or NULL if no test is running.
18581   const TestCase* current_test_case() const
18582       GTEST_LOCK_EXCLUDED_(mutex_);
18583
18584   // Returns the TestInfo object for the test that's currently running,
18585   // or NULL if no test is running.
18586   const TestInfo* current_test_info() const
18587       GTEST_LOCK_EXCLUDED_(mutex_);
18588
18589   // Returns the random seed used at the start of the current test run.
18590   int random_seed() const;
18591
18592 #if GTEST_HAS_PARAM_TEST
18593   // Returns the ParameterizedTestCaseRegistry object used to keep track of
18594   // value-parameterized tests and instantiate and register them.
18595   //
18596   // INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
18597   internal::ParameterizedTestCaseRegistry& parameterized_test_registry()
18598       GTEST_LOCK_EXCLUDED_(mutex_);
18599 #endif  // GTEST_HAS_PARAM_TEST
18600
18601   // Gets the number of successful test cases.
18602   int successful_test_case_count() const;
18603
18604   // Gets the number of failed test cases.
18605   int failed_test_case_count() const;
18606
18607   // Gets the number of all test cases.
18608   int total_test_case_count() const;
18609
18610   // Gets the number of all test cases that contain at least one test
18611   // that should run.
18612   int test_case_to_run_count() const;
18613
18614   // Gets the number of successful tests.
18615   int successful_test_count() const;
18616
18617   // Gets the number of failed tests.
18618   int failed_test_count() const;
18619
18620   // Gets the number of disabled tests.
18621   int disabled_test_count() const;
18622
18623   // Gets the number of all tests.
18624   int total_test_count() const;
18625
18626   // Gets the number of tests that should run.
18627   int test_to_run_count() const;
18628
18629   // Gets the time of the test program start, in ms from the start of the
18630   // UNIX epoch.
18631   TimeInMillis start_timestamp() const;
18632
18633   // Gets the elapsed time, in milliseconds.
18634   TimeInMillis elapsed_time() const;
18635
18636   // Returns true iff the unit test passed (i.e. all test cases passed).
18637   bool Passed() const;
18638
18639   // Returns true iff the unit test failed (i.e. some test case failed
18640   // or something outside of all tests failed).
18641   bool Failed() const;
18642
18643   // Gets the i-th test case among all the test cases. i can range from 0 to
18644   // total_test_case_count() - 1. If i is not in that range, returns NULL.
18645   const TestCase* GetTestCase(int i) const;
18646
18647   // Returns the TestResult containing information on test failures and
18648   // properties logged outside of individual test cases.
18649   const TestResult& ad_hoc_test_result() const;
18650
18651   // Returns the list of event listeners that can be used to track events
18652   // inside Google Test.
18653   TestEventListeners& listeners();
18654
18655  private:
18656   // Registers and returns a global test environment.  When a test
18657   // program is run, all global test environments will be set-up in
18658   // the order they were registered.  After all tests in the program
18659   // have finished, all global test environments will be torn-down in
18660   // the *reverse* order they were registered.
18661   //
18662   // The UnitTest object takes ownership of the given environment.
18663   //
18664   // This method can only be called from the main thread.
18665   Environment* AddEnvironment(Environment* env);
18666
18667   // Adds a TestPartResult to the current TestResult object.  All
18668   // Google Test assertion macros (e.g. ASSERT_TRUE, EXPECT_EQ, etc)
18669   // eventually call this to report their results.  The user code
18670   // should use the assertion macros instead of calling this directly.
18671   void AddTestPartResult(TestPartResult::Type result_type,
18672                          const char* file_name,
18673                          int line_number,
18674                          const std::string& message,
18675                          const std::string& os_stack_trace)
18676       GTEST_LOCK_EXCLUDED_(mutex_);
18677
18678   // Adds a TestProperty to the current TestResult object when invoked from
18679   // inside a test, to current TestCase's ad_hoc_test_result_ when invoked
18680   // from SetUpTestCase or TearDownTestCase, or to the global property set
18681   // when invoked elsewhere.  If the result already contains a property with
18682   // the same key, the value will be updated.
18683   void RecordProperty(const std::string& key, const std::string& value);
18684
18685   // Gets the i-th test case among all the test cases. i can range from 0 to
18686   // total_test_case_count() - 1. If i is not in that range, returns NULL.
18687   TestCase* GetMutableTestCase(int i);
18688
18689   // Accessors for the implementation object.
18690   internal::UnitTestImpl* impl() { return impl_; }
18691   const internal::UnitTestImpl* impl() const { return impl_; }
18692
18693   // These classes and funcions are friends as they need to access private
18694   // members of UnitTest.
18695   friend class Test;
18696   friend class internal::AssertHelper;
18697   friend class internal::ScopedTrace;
18698   friend class internal::StreamingListenerTest;
18699   friend class internal::UnitTestRecordPropertyTestHelper;
18700   friend Environment* AddGlobalTestEnvironment(Environment* env);
18701   friend internal::UnitTestImpl* internal::GetUnitTestImpl();
18702   friend void internal::ReportFailureInUnknownLocation(
18703       TestPartResult::Type result_type,
18704       const std::string& message);
18705
18706   // Creates an empty UnitTest.
18707   UnitTest();
18708
18709   // D'tor
18710   virtual ~UnitTest();
18711
18712   // Pushes a trace defined by SCOPED_TRACE() on to the per-thread
18713   // Google Test trace stack.
18714   void PushGTestTrace(const internal::TraceInfo& trace)
18715       GTEST_LOCK_EXCLUDED_(mutex_);
18716
18717   // Pops a trace from the per-thread Google Test trace stack.
18718   void PopGTestTrace()
18719       GTEST_LOCK_EXCLUDED_(mutex_);
18720
18721   // Protects mutable state in *impl_.  This is mutable as some const
18722   // methods need to lock it too.
18723   mutable internal::Mutex mutex_;
18724
18725   // Opaque implementation object.  This field is never changed once
18726   // the object is constructed.  We don't mark it as const here, as
18727   // doing so will cause a warning in the constructor of UnitTest.
18728   // Mutable state in *impl_ is protected by mutex_.
18729   internal::UnitTestImpl* impl_;
18730
18731   // We disallow copying UnitTest.
18732   GTEST_DISALLOW_COPY_AND_ASSIGN_(UnitTest);
18733 };
18734
18735 // A convenient wrapper for adding an environment for the test
18736 // program.
18737 //
18738 // You should call this before RUN_ALL_TESTS() is called, probably in
18739 // main().  If you use gtest_main, you need to call this before main()
18740 // starts for it to take effect.  For example, you can define a global
18741 // variable like this:
18742 //
18743 //   testing::Environment* const foo_env =
18744 //       testing::AddGlobalTestEnvironment(new FooEnvironment);
18745 //
18746 // However, we strongly recommend you to write your own main() and
18747 // call AddGlobalTestEnvironment() there, as relying on initialization
18748 // of global variables makes the code harder to read and may cause
18749 // problems when you register multiple environments from different
18750 // translation units and the environments have dependencies among them
18751 // (remember that the compiler doesn't guarantee the order in which
18752 // global variables from different translation units are initialized).
18753 inline Environment* AddGlobalTestEnvironment(Environment* env) {
18754   return UnitTest::GetInstance()->AddEnvironment(env);
18755 }
18756
18757 // Initializes Google Test.  This must be called before calling
18758 // RUN_ALL_TESTS().  In particular, it parses a command line for the
18759 // flags that Google Test recognizes.  Whenever a Google Test flag is
18760 // seen, it is removed from argv, and *argc is decremented.
18761 //
18762 // No value is returned.  Instead, the Google Test flag variables are
18763 // updated.
18764 //
18765 // Calling the function for the second time has no user-visible effect.
18766 GTEST_API_ void InitGoogleTest(int* argc, char** argv);
18767
18768 // This overloaded version can be used in Windows programs compiled in
18769 // UNICODE mode.
18770 GTEST_API_ void InitGoogleTest(int* argc, wchar_t** argv);
18771
18772 namespace internal {
18773
18774 // FormatForComparison<ToPrint, OtherOperand>::Format(value) formats a
18775 // value of type ToPrint that is an operand of a comparison assertion
18776 // (e.g. ASSERT_EQ).  OtherOperand is the type of the other operand in
18777 // the comparison, and is used to help determine the best way to
18778 // format the value.  In particular, when the value is a C string
18779 // (char pointer) and the other operand is an STL string object, we
18780 // want to format the C string as a string, since we know it is
18781 // compared by value with the string object.  If the value is a char
18782 // pointer but the other operand is not an STL string object, we don't
18783 // know whether the pointer is supposed to point to a NUL-terminated
18784 // string, and thus want to print it as a pointer to be safe.
18785 //
18786 // INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
18787
18788 // The default case.
18789 template <typename ToPrint, typename OtherOperand>
18790 class FormatForComparison {
18791  public:
18792   static ::std::string Format(const ToPrint& value) {
18793     return ::testing::PrintToString(value);
18794   }
18795 };
18796
18797 // Array.
18798 template <typename ToPrint, size_t N, typename OtherOperand>
18799 class FormatForComparison<ToPrint[N], OtherOperand> {
18800  public:
18801   static ::std::string Format(const ToPrint* value) {
18802     return FormatForComparison<const ToPrint*, OtherOperand>::Format(value);
18803   }
18804 };
18805
18806 // By default, print C string as pointers to be safe, as we don't know
18807 // whether they actually point to a NUL-terminated string.
18808
18809 #define GTEST_IMPL_FORMAT_C_STRING_AS_POINTER_(CharType)                \
18810   template <typename OtherOperand>                                      \
18811   class FormatForComparison<CharType*, OtherOperand> {                  \
18812    public:                                                              \
18813     static ::std::string Format(CharType* value) {                      \
18814       return ::testing::PrintToString(static_cast<const void*>(value)); \
18815     }                                                                   \
18816   }
18817
18818 GTEST_IMPL_FORMAT_C_STRING_AS_POINTER_(char);
18819 GTEST_IMPL_FORMAT_C_STRING_AS_POINTER_(const char);
18820 GTEST_IMPL_FORMAT_C_STRING_AS_POINTER_(wchar_t);
18821 GTEST_IMPL_FORMAT_C_STRING_AS_POINTER_(const wchar_t);
18822
18823 #undef GTEST_IMPL_FORMAT_C_STRING_AS_POINTER_
18824
18825 // If a C string is compared with an STL string object, we know it's meant
18826 // to point to a NUL-terminated string, and thus can print it as a string.
18827
18828 #define GTEST_IMPL_FORMAT_C_STRING_AS_STRING_(CharType, OtherStringType) \
18829   template <>                                                           \
18830   class FormatForComparison<CharType*, OtherStringType> {               \
18831    public:                                                              \
18832     static ::std::string Format(CharType* value) {                      \
18833       return ::testing::PrintToString(value);                           \
18834     }                                                                   \
18835   }
18836
18837 GTEST_IMPL_FORMAT_C_STRING_AS_STRING_(char, ::std::string);
18838 GTEST_IMPL_FORMAT_C_STRING_AS_STRING_(const char, ::std::string);
18839
18840 #if GTEST_HAS_GLOBAL_STRING
18841 GTEST_IMPL_FORMAT_C_STRING_AS_STRING_(char, ::string);
18842 GTEST_IMPL_FORMAT_C_STRING_AS_STRING_(const char, ::string);
18843 #endif
18844
18845 #if GTEST_HAS_GLOBAL_WSTRING
18846 GTEST_IMPL_FORMAT_C_STRING_AS_STRING_(wchar_t, ::wstring);
18847 GTEST_IMPL_FORMAT_C_STRING_AS_STRING_(const wchar_t, ::wstring);
18848 #endif
18849
18850 #if GTEST_HAS_STD_WSTRING
18851 GTEST_IMPL_FORMAT_C_STRING_AS_STRING_(wchar_t, ::std::wstring);
18852 GTEST_IMPL_FORMAT_C_STRING_AS_STRING_(const wchar_t, ::std::wstring);
18853 #endif
18854
18855 #undef GTEST_IMPL_FORMAT_C_STRING_AS_STRING_
18856
18857 // Formats a comparison assertion (e.g. ASSERT_EQ, EXPECT_LT, and etc)
18858 // operand to be used in a failure message.  The type (but not value)
18859 // of the other operand may affect the format.  This allows us to
18860 // print a char* as a raw pointer when it is compared against another
18861 // char* or void*, and print it as a C string when it is compared
18862 // against an std::string object, for example.
18863 //
18864 // INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
18865 template <typename T1, typename T2>
18866 std::string FormatForComparisonFailureMessage(
18867     const T1& value, const T2& /* other_operand */) {
18868   return FormatForComparison<T1, T2>::Format(value);
18869 }
18870
18871 // The helper function for {ASSERT|EXPECT}_EQ.
18872 template <typename T1, typename T2>
18873 AssertionResult CmpHelperEQ(const char* expected_expression,
18874                             const char* actual_expression,
18875                             const T1& expected,
18876                             const T2& actual) {
18877 #ifdef _MSC_VER
18878 # pragma warning(push)          // Saves the current warning state.
18879 # pragma warning(disable:4389)  // Temporarily disables warning on
18880                                 // signed/unsigned mismatch.
18881 #endif
18882
18883   if (expected == actual) {
18884     return AssertionSuccess();
18885   }
18886
18887 #ifdef _MSC_VER
18888 # pragma warning(pop)          // Restores the warning state.
18889 #endif
18890
18891   return EqFailure(expected_expression,
18892                    actual_expression,
18893                    FormatForComparisonFailureMessage(expected, actual),
18894                    FormatForComparisonFailureMessage(actual, expected),
18895                    false);
18896 }
18897
18898 // With this overloaded version, we allow anonymous enums to be used
18899 // in {ASSERT|EXPECT}_EQ when compiled with gcc 4, as anonymous enums
18900 // can be implicitly cast to BiggestInt.
18901 GTEST_API_ AssertionResult CmpHelperEQ(const char* expected_expression,
18902                                        const char* actual_expression,
18903                                        BiggestInt expected,
18904                                        BiggestInt actual);
18905
18906 // The helper class for {ASSERT|EXPECT}_EQ.  The template argument
18907 // lhs_is_null_literal is true iff the first argument to ASSERT_EQ()
18908 // is a null pointer literal.  The following default implementation is
18909 // for lhs_is_null_literal being false.
18910 template <bool lhs_is_null_literal>
18911 class EqHelper {
18912  public:
18913   // This templatized version is for the general case.
18914   template <typename T1, typename T2>
18915   static AssertionResult Compare(const char* expected_expression,
18916                                  const char* actual_expression,
18917                                  const T1& expected,
18918                                  const T2& actual) {
18919     return CmpHelperEQ(expected_expression, actual_expression, expected,
18920                        actual);
18921   }
18922
18923   // With this overloaded version, we allow anonymous enums to be used
18924   // in {ASSERT|EXPECT}_EQ when compiled with gcc 4, as anonymous
18925   // enums can be implicitly cast to BiggestInt.
18926   //
18927   // Even though its body looks the same as the above version, we
18928   // cannot merge the two, as it will make anonymous enums unhappy.
18929   static AssertionResult Compare(const char* expected_expression,
18930                                  const char* actual_expression,
18931                                  BiggestInt expected,
18932                                  BiggestInt actual) {
18933     return CmpHelperEQ(expected_expression, actual_expression, expected,
18934                        actual);
18935   }
18936 };
18937
18938 // This specialization is used when the first argument to ASSERT_EQ()
18939 // is a null pointer literal, like NULL, false, or 0.
18940 template <>
18941 class EqHelper<true> {
18942  public:
18943   // We define two overloaded versions of Compare().  The first
18944   // version will be picked when the second argument to ASSERT_EQ() is
18945   // NOT a pointer, e.g. ASSERT_EQ(0, AnIntFunction()) or
18946   // EXPECT_EQ(false, a_bool).
18947   template <typename T1, typename T2>
18948   static AssertionResult Compare(
18949       const char* expected_expression,
18950       const char* actual_expression,
18951       const T1& expected,
18952       const T2& actual,
18953       // The following line prevents this overload from being considered if T2
18954       // is not a pointer type.  We need this because ASSERT_EQ(NULL, my_ptr)
18955       // expands to Compare("", "", NULL, my_ptr), which requires a conversion
18956       // to match the Secret* in the other overload, which would otherwise make
18957       // this template match better.
18958       typename EnableIf<!is_pointer<T2>::value>::type* = 0) {
18959     return CmpHelperEQ(expected_expression, actual_expression, expected,
18960                        actual);
18961   }
18962
18963   // This version will be picked when the second argument to ASSERT_EQ() is a
18964   // pointer, e.g. ASSERT_EQ(NULL, a_pointer).
18965   template <typename T>
18966   static AssertionResult Compare(
18967       const char* expected_expression,
18968       const char* actual_expression,
18969       // We used to have a second template parameter instead of Secret*.  That
18970       // template parameter would deduce to 'long', making this a better match
18971       // than the first overload even without the first overload's EnableIf.
18972       // Unfortunately, gcc with -Wconversion-null warns when "passing NULL to
18973       // non-pointer argument" (even a deduced integral argument), so the old
18974       // implementation caused warnings in user code.
18975       Secret* /* expected (NULL) */,
18976       T* actual) {
18977     // We already know that 'expected' is a null pointer.
18978     return CmpHelperEQ(expected_expression, actual_expression,
18979                        static_cast<T*>(NULL), actual);
18980   }
18981 };
18982
18983 // A macro for implementing the helper functions needed to implement
18984 // ASSERT_?? and EXPECT_??.  It is here just to avoid copy-and-paste
18985 // of similar code.
18986 //
18987 // For each templatized helper function, we also define an overloaded
18988 // version for BiggestInt in order to reduce code bloat and allow
18989 // anonymous enums to be used with {ASSERT|EXPECT}_?? when compiled
18990 // with gcc 4.
18991 //
18992 // INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
18993 #define GTEST_IMPL_CMP_HELPER_(op_name, op)\
18994 template <typename T1, typename T2>\
18995 AssertionResult CmpHelper##op_name(const char* expr1, const char* expr2, \
18996                                    const T1& val1, const T2& val2) {\
18997   if (val1 op val2) {\
18998     return AssertionSuccess();\
18999   } else {\
19000     return AssertionFailure() \
19001         << "Expected: (" << expr1 << ") " #op " (" << expr2\
19002         << "), actual: " << FormatForComparisonFailureMessage(val1, val2)\
19003         << " vs " << FormatForComparisonFailureMessage(val2, val1);\
19004   }\
19005 }\
19006 GTEST_API_ AssertionResult CmpHelper##op_name(\
19007     const char* expr1, const char* expr2, BiggestInt val1, BiggestInt val2)
19008
19009 // INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
19010
19011 // Implements the helper function for {ASSERT|EXPECT}_NE
19012 GTEST_IMPL_CMP_HELPER_(NE, !=);
19013 // Implements the helper function for {ASSERT|EXPECT}_LE
19014 GTEST_IMPL_CMP_HELPER_(LE, <=);
19015 // Implements the helper function for {ASSERT|EXPECT}_LT
19016 GTEST_IMPL_CMP_HELPER_(LT, <);
19017 // Implements the helper function for {ASSERT|EXPECT}_GE
19018 GTEST_IMPL_CMP_HELPER_(GE, >=);
19019 // Implements the helper function for {ASSERT|EXPECT}_GT
19020 GTEST_IMPL_CMP_HELPER_(GT, >);
19021
19022 #undef GTEST_IMPL_CMP_HELPER_
19023
19024 // The helper function for {ASSERT|EXPECT}_STREQ.
19025 //
19026 // INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
19027 GTEST_API_ AssertionResult CmpHelperSTREQ(const char* expected_expression,
19028                                           const char* actual_expression,
19029                                           const char* expected,
19030                                           const char* actual);
19031
19032 // The helper function for {ASSERT|EXPECT}_STRCASEEQ.
19033 //
19034 // INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
19035 GTEST_API_ AssertionResult CmpHelperSTRCASEEQ(const char* expected_expression,
19036                                               const char* actual_expression,
19037                                               const char* expected,
19038                                               const char* actual);
19039
19040 // The helper function for {ASSERT|EXPECT}_STRNE.
19041 //
19042 // INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
19043 GTEST_API_ AssertionResult CmpHelperSTRNE(const char* s1_expression,
19044                                           const char* s2_expression,
19045                                           const char* s1,
19046                                           const char* s2);
19047
19048 // The helper function for {ASSERT|EXPECT}_STRCASENE.
19049 //
19050 // INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
19051 GTEST_API_ AssertionResult CmpHelperSTRCASENE(const char* s1_expression,
19052                                               const char* s2_expression,
19053                                               const char* s1,
19054                                               const char* s2);
19055
19056
19057 // Helper function for *_STREQ on wide strings.
19058 //
19059 // INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
19060 GTEST_API_ AssertionResult CmpHelperSTREQ(const char* expected_expression,
19061                                           const char* actual_expression,
19062                                           const wchar_t* expected,
19063                                           const wchar_t* actual);
19064
19065 // Helper function for *_STRNE on wide strings.
19066 //
19067 // INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
19068 GTEST_API_ AssertionResult CmpHelperSTRNE(const char* s1_expression,
19069                                           const char* s2_expression,
19070                                           const wchar_t* s1,
19071                                           const wchar_t* s2);
19072
19073 }  // namespace internal
19074
19075 // IsSubstring() and IsNotSubstring() are intended to be used as the
19076 // first argument to {EXPECT,ASSERT}_PRED_FORMAT2(), not by
19077 // themselves.  They check whether needle is a substring of haystack
19078 // (NULL is considered a substring of itself only), and return an
19079 // appropriate error message when they fail.
19080 //
19081 // The {needle,haystack}_expr arguments are the stringified
19082 // expressions that generated the two real arguments.
19083 GTEST_API_ AssertionResult IsSubstring(
19084     const char* needle_expr, const char* haystack_expr,
19085     const char* needle, const char* haystack);
19086 GTEST_API_ AssertionResult IsSubstring(
19087     const char* needle_expr, const char* haystack_expr,
19088     const wchar_t* needle, const wchar_t* haystack);
19089 GTEST_API_ AssertionResult IsNotSubstring(
19090     const char* needle_expr, const char* haystack_expr,
19091     const char* needle, const char* haystack);
19092 GTEST_API_ AssertionResult IsNotSubstring(
19093     const char* needle_expr, const char* haystack_expr,
19094     const wchar_t* needle, const wchar_t* haystack);
19095 GTEST_API_ AssertionResult IsSubstring(
19096     const char* needle_expr, const char* haystack_expr,
19097     const ::std::string& needle, const ::std::string& haystack);
19098 GTEST_API_ AssertionResult IsNotSubstring(
19099     const char* needle_expr, const char* haystack_expr,
19100     const ::std::string& needle, const ::std::string& haystack);
19101
19102 #if GTEST_HAS_STD_WSTRING
19103 GTEST_API_ AssertionResult IsSubstring(
19104     const char* needle_expr, const char* haystack_expr,
19105     const ::std::wstring& needle, const ::std::wstring& haystack);
19106 GTEST_API_ AssertionResult IsNotSubstring(
19107     const char* needle_expr, const char* haystack_expr,
19108     const ::std::wstring& needle, const ::std::wstring& haystack);
19109 #endif  // GTEST_HAS_STD_WSTRING
19110
19111 namespace internal {
19112
19113 // Helper template function for comparing floating-points.
19114 //
19115 // Template parameter:
19116 //
19117 //   RawType: the raw floating-point type (either float or double)
19118 //
19119 // INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
19120 template <typename RawType>
19121 AssertionResult CmpHelperFloatingPointEQ(const char* expected_expression,
19122                                          const char* actual_expression,
19123                                          RawType expected,
19124                                          RawType actual) {
19125   const FloatingPoint<RawType> lhs(expected), rhs(actual);
19126
19127   if (lhs.AlmostEquals(rhs)) {
19128     return AssertionSuccess();
19129   }
19130
19131   ::std::stringstream expected_ss;
19132   expected_ss << std::setprecision(std::numeric_limits<RawType>::digits10 + 2)
19133               << expected;
19134
19135   ::std::stringstream actual_ss;
19136   actual_ss << std::setprecision(std::numeric_limits<RawType>::digits10 + 2)
19137             << actual;
19138
19139   return EqFailure(expected_expression,
19140                    actual_expression,
19141                    StringStreamToString(&expected_ss),
19142                    StringStreamToString(&actual_ss),
19143                    false);
19144 }
19145
19146 // Helper function for implementing ASSERT_NEAR.
19147 //
19148 // INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
19149 GTEST_API_ AssertionResult DoubleNearPredFormat(const char* expr1,
19150                                                 const char* expr2,
19151                                                 const char* abs_error_expr,
19152                                                 double val1,
19153                                                 double val2,
19154                                                 double abs_error);
19155
19156 // INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.
19157 // A class that enables one to stream messages to assertion macros
19158 class GTEST_API_ AssertHelper {
19159  public:
19160   // Constructor.
19161   AssertHelper(TestPartResult::Type type,
19162                const char* file,
19163                int line,
19164                const char* message);
19165   ~AssertHelper();
19166
19167   // Message assignment is a semantic trick to enable assertion
19168   // streaming; see the GTEST_MESSAGE_ macro below.
19169   void operator=(const Message& message) const;
19170
19171  private:
19172   // We put our data in a struct so that the size of the AssertHelper class can
19173   // be as small as possible.  This is important because gcc is incapable of
19174   // re-using stack space even for temporary variables, so every EXPECT_EQ
19175   // reserves stack space for another AssertHelper.
19176   struct AssertHelperData {
19177     AssertHelperData(TestPartResult::Type t,
19178                      const char* srcfile,
19179                      int line_num,
19180                      const char* msg)
19181         : type(t), file(srcfile), line(line_num), message(msg) { }
19182
19183     TestPartResult::Type const type;
19184     const char*        const file;
19185     int                const line;
19186     std::string const message;
19187
19188    private:
19189     GTEST_DISALLOW_COPY_AND_ASSIGN_(AssertHelperData);
19190   };
19191
19192   AssertHelperData* const data_;
19193
19194   GTEST_DISALLOW_COPY_AND_ASSIGN_(AssertHelper);
19195 };
19196
19197 }  // namespace internal
19198
19199 #if GTEST_HAS_PARAM_TEST
19200 // The pure interface class that all value-parameterized tests inherit from.
19201 // A value-parameterized class must inherit from both ::testing::Test and
19202 // ::testing::WithParamInterface. In most cases that just means inheriting
19203 // from ::testing::TestWithParam, but more complicated test hierarchies
19204 // may need to inherit from Test and WithParamInterface at different levels.
19205 //
19206 // This interface has support for accessing the test parameter value via
19207 // the GetParam() method.
19208 //
19209 // Use it with one of the parameter generator defining functions, like Range(),
19210 // Values(), ValuesIn(), Bool(), and Combine().
19211 //
19212 // class FooTest : public ::testing::TestWithParam<int> {
19213 //  protected:
19214 //   FooTest() {
19215 //     // Can use GetParam() here.
19216 //   }
19217 //   virtual ~FooTest() {
19218 //     // Can use GetParam() here.
19219 //   }
19220 //   virtual void SetUp() {
19221 //     // Can use GetParam() here.
19222 //   }
19223 //   virtual void TearDown {
19224 //     // Can use GetParam() here.
19225 //   }
19226 // };
19227 // TEST_P(FooTest, DoesBar) {
19228 //   // Can use GetParam() method here.
19229 //   Foo foo;
19230 //   ASSERT_TRUE(foo.DoesBar(GetParam()));
19231 // }
19232 // INSTANTIATE_TEST_CASE_P(OneToTenRange, FooTest, ::testing::Range(1, 10));
19233
19234 template <typename T>
19235 class WithParamInterface {
19236  public:
19237   typedef T ParamType;
19238   virtual ~WithParamInterface() {}
19239
19240   // The current parameter value. Is also available in the test fixture's
19241   // constructor. This member function is non-static, even though it only
19242   // references static data, to reduce the opportunity for incorrect uses
19243   // like writing 'WithParamInterface<bool>::GetParam()' for a test that
19244   // uses a fixture whose parameter type is int.
19245   const ParamType& GetParam() const {
19246     GTEST_CHECK_(parameter_ != NULL)
19247         << "GetParam() can only be called inside a value-parameterized test "
19248         << "-- did you intend to write TEST_P instead of TEST_F?";
19249     return *parameter_;
19250   }
19251
19252  private:
19253   // Sets parameter value. The caller is responsible for making sure the value
19254   // remains alive and unchanged throughout the current test.
19255   static void SetParam(const ParamType* parameter) {
19256     parameter_ = parameter;
19257   }
19258
19259   // Static value used for accessing parameter during a test lifetime.
19260   static const ParamType* parameter_;
19261
19262   // TestClass must be a subclass of WithParamInterface<T> and Test.
19263   template <class TestClass> friend class internal::ParameterizedTestFactory;
19264 };
19265
19266 template <typename T>
19267 const T* WithParamInterface<T>::parameter_ = NULL;
19268
19269 // Most value-parameterized classes can ignore the existence of
19270 // WithParamInterface, and can just inherit from ::testing::TestWithParam.
19271
19272 template <typename T>
19273 class TestWithParam : public Test, public WithParamInterface<T> {
19274 };
19275
19276 #endif  // GTEST_HAS_PARAM_TEST
19277
19278 // Macros for indicating success/failure in test code.
19279
19280 // ADD_FAILURE unconditionally adds a failure to the current test.
19281 // SUCCEED generates a success - it doesn't automatically make the
19282 // current test successful, as a test is only successful when it has
19283 // no failure.
19284 //
19285 // EXPECT_* verifies that a certain condition is satisfied.  If not,
19286 // it behaves like ADD_FAILURE.  In particular:
19287 //
19288 //   EXPECT_TRUE  verifies that a Boolean condition is true.
19289 //   EXPECT_FALSE verifies that a Boolean condition is false.
19290 //
19291 // FAIL and ASSERT_* are similar to ADD_FAILURE and EXPECT_*, except
19292 // that they will also abort the current function on failure.  People
19293 // usually want the fail-fast behavior of FAIL and ASSERT_*, but those
19294 // writing data-driven tests often find themselves using ADD_FAILURE
19295 // and EXPECT_* more.
19296
19297 // Generates a nonfatal failure with a generic message.
19298 #define ADD_FAILURE() GTEST_NONFATAL_FAILURE_("Failed")
19299
19300 // Generates a nonfatal failure at the given source file location with
19301 // a generic message.
19302 #define ADD_FAILURE_AT(file, line) \
19303   GTEST_MESSAGE_AT_(file, line, "Failed", \
19304                     ::testing::TestPartResult::kNonFatalFailure)
19305
19306 // Generates a fatal failure with a generic message.
19307 #define GTEST_FAIL() GTEST_FATAL_FAILURE_("Failed")
19308
19309 // Define this macro to 1 to omit the definition of FAIL(), which is a
19310 // generic name and clashes with some other libraries.
19311 #if !GTEST_DONT_DEFINE_FAIL
19312 # define FAIL() GTEST_FAIL()
19313 #endif
19314
19315 // Generates a success with a generic message.
19316 #define GTEST_SUCCEED() GTEST_SUCCESS_("Succeeded")
19317
19318 // Define this macro to 1 to omit the definition of SUCCEED(), which
19319 // is a generic name and clashes with some other libraries.
19320 #if !GTEST_DONT_DEFINE_SUCCEED
19321 # define SUCCEED() GTEST_SUCCEED()
19322 #endif
19323
19324 // Macros for testing exceptions.
19325 //
19326 //    * {ASSERT|EXPECT}_THROW(statement, expected_exception):
19327 //         Tests that the statement throws the expected exception.
19328 //    * {ASSERT|EXPECT}_NO_THROW(statement):
19329 //         Tests that the statement doesn't throw any exception.
19330 //    * {ASSERT|EXPECT}_ANY_THROW(statement):
19331 //         Tests that the statement throws an exception.
19332
19333 #define EXPECT_THROW(statement, expected_exception) \
19334   GTEST_TEST_THROW_(statement, expected_exception, GTEST_NONFATAL_FAILURE_)
19335 #define EXPECT_NO_THROW(statement) \
19336   GTEST_TEST_NO_THROW_(statement, GTEST_NONFATAL_FAILURE_)
19337 #define EXPECT_ANY_THROW(statement) \
19338   GTEST_TEST_ANY_THROW_(statement, GTEST_NONFATAL_FAILURE_)
19339 #define ASSERT_THROW(statement, expected_exception) \
19340   GTEST_TEST_THROW_(statement, expected_exception, GTEST_FATAL_FAILURE_)
19341 #define ASSERT_NO_THROW(statement) \
19342   GTEST_TEST_NO_THROW_(statement, GTEST_FATAL_FAILURE_)
19343 #define ASSERT_ANY_THROW(statement) \
19344   GTEST_TEST_ANY_THROW_(statement, GTEST_FATAL_FAILURE_)
19345
19346 // Boolean assertions. Condition can be either a Boolean expression or an
19347 // AssertionResult. For more information on how to use AssertionResult with
19348 // these macros see comments on that class.
19349 #define EXPECT_TRUE(condition) \
19350   GTEST_TEST_BOOLEAN_(condition, #condition, false, true, \
19351                       GTEST_NONFATAL_FAILURE_)
19352 #define EXPECT_FALSE(condition) \
19353   GTEST_TEST_BOOLEAN_(!(condition), #condition, true, false, \
19354                       GTEST_NONFATAL_FAILURE_)
19355 #define ASSERT_TRUE(condition) \
19356   GTEST_TEST_BOOLEAN_(condition, #condition, false, true, \
19357                       GTEST_FATAL_FAILURE_)
19358 #define ASSERT_FALSE(condition) \
19359   GTEST_TEST_BOOLEAN_(!(condition), #condition, true, false, \
19360                       GTEST_FATAL_FAILURE_)
19361
19362 // Includes the auto-generated header that implements a family of
19363 // generic predicate assertion macros.
19364 // Copyright 2006, Google Inc.
19365 // All rights reserved.
19366 //
19367 // Redistribution and use in source and binary forms, with or without
19368 // modification, are permitted provided that the following conditions are
19369 // met:
19370 //
19371 //     * Redistributions of source code must retain the above copyright
19372 // notice, this list of conditions and the following disclaimer.
19373 //     * Redistributions in binary form must reproduce the above
19374 // copyright notice, this list of conditions and the following disclaimer
19375 // in the documentation and/or other materials provided with the
19376 // distribution.
19377 //     * Neither the name of Google Inc. nor the names of its
19378 // contributors may be used to endorse or promote products derived from
19379 // this software without specific prior written permission.
19380 //
19381 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19382 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19383 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19384 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
19385 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
19386 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
19387 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
19388 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
19389 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
19390 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
19391 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
19392
19393 // This file is AUTOMATICALLY GENERATED on 10/31/2011 by command
19394 // 'gen_gtest_pred_impl.py 5'.  DO NOT EDIT BY HAND!
19395 //
19396 // Implements a family of generic predicate assertion macros.
19397
19398 #ifndef GTEST_INCLUDE_GTEST_GTEST_PRED_IMPL_H_
19399 #define GTEST_INCLUDE_GTEST_GTEST_PRED_IMPL_H_
19400
19401 // Makes sure this header is not included before gtest.h.
19402 #ifndef GTEST_INCLUDE_GTEST_GTEST_H_
19403 # error Do not include gtest_pred_impl.h directly.  Include gtest.h instead.
19404 #endif  // GTEST_INCLUDE_GTEST_GTEST_H_
19405
19406 // This header implements a family of generic predicate assertion
19407 // macros:
19408 //
19409 //   ASSERT_PRED_FORMAT1(pred_format, v1)
19410 //   ASSERT_PRED_FORMAT2(pred_format, v1, v2)
19411 //   ...
19412 //
19413 // where pred_format is a function or functor that takes n (in the
19414 // case of ASSERT_PRED_FORMATn) values and their source expression
19415 // text, and returns a testing::AssertionResult.  See the definition
19416 // of ASSERT_EQ in gtest.h for an example.
19417 //
19418 // If you don't care about formatting, you can use the more
19419 // restrictive version:
19420 //
19421 //   ASSERT_PRED1(pred, v1)
19422 //   ASSERT_PRED2(pred, v1, v2)
19423 //   ...
19424 //
19425 // where pred is an n-ary function or functor that returns bool,
19426 // and the values v1, v2, ..., must support the << operator for
19427 // streaming to std::ostream.
19428 //
19429 // We also define the EXPECT_* variations.
19430 //
19431 // For now we only support predicates whose arity is at most 5.
19432 // Please email googletestframework@googlegroups.com if you need
19433 // support for higher arities.
19434
19435 // GTEST_ASSERT_ is the basic statement to which all of the assertions
19436 // in this file reduce.  Don't use this in your code.
19437
19438 #define GTEST_ASSERT_(expression, on_failure) \
19439   GTEST_AMBIGUOUS_ELSE_BLOCKER_ \
19440   if (const ::testing::AssertionResult gtest_ar = (expression)) \
19441     ; \
19442   else \
19443     on_failure(gtest_ar.failure_message())
19444
19445
19446 // Helper function for implementing {EXPECT|ASSERT}_PRED1.  Don't use
19447 // this in your code.
19448 template <typename Pred,
19449           typename T1>
19450 AssertionResult AssertPred1Helper(const char* pred_text,
19451                                   const char* e1,
19452                                   Pred pred,
19453                                   const T1& v1) {
19454   if (pred(v1)) return AssertionSuccess();
19455
19456   return AssertionFailure() << pred_text << "("
19457                             << e1 << ") evaluates to false, where"
19458                             << "\n" << e1 << " evaluates to " << v1;
19459 }
19460
19461 // Internal macro for implementing {EXPECT|ASSERT}_PRED_FORMAT1.
19462 // Don't use this in your code.
19463 #define GTEST_PRED_FORMAT1_(pred_format, v1, on_failure)\
19464   GTEST_ASSERT_(pred_format(#v1, v1), \
19465                 on_failure)
19466
19467 // Internal macro for implementing {EXPECT|ASSERT}_PRED1.  Don't use
19468 // this in your code.
19469 #define GTEST_PRED1_(pred, v1, on_failure)\
19470   GTEST_ASSERT_(::testing::AssertPred1Helper(#pred, \
19471                                              #v1, \
19472                                              pred, \
19473                                              v1), on_failure)
19474
19475 // Unary predicate assertion macros.
19476 #define EXPECT_PRED_FORMAT1(pred_format, v1) \
19477   GTEST_PRED_FORMAT1_(pred_format, v1, GTEST_NONFATAL_FAILURE_)
19478 #define EXPECT_PRED1(pred, v1) \
19479   GTEST_PRED1_(pred, v1, GTEST_NONFATAL_FAILURE_)
19480 #define ASSERT_PRED_FORMAT1(pred_format, v1) \
19481   GTEST_PRED_FORMAT1_(pred_format, v1, GTEST_FATAL_FAILURE_)
19482 #define ASSERT_PRED1(pred, v1) \
19483   GTEST_PRED1_(pred, v1, GTEST_FATAL_FAILURE_)
19484
19485
19486
19487 // Helper function for implementing {EXPECT|ASSERT}_PRED2.  Don't use
19488 // this in your code.
19489 template <typename Pred,
19490           typename T1,
19491           typename T2>
19492 AssertionResult AssertPred2Helper(const char* pred_text,
19493                                   const char* e1,
19494                                   const char* e2,
19495                                   Pred pred,
19496                                   const T1& v1,
19497                                   const T2& v2) {
19498   if (pred(v1, v2)) return AssertionSuccess();
19499
19500   return AssertionFailure() << pred_text << "("
19501                             << e1 << ", "
19502                             << e2 << ") evaluates to false, where"
19503                             << "\n" << e1 << " evaluates to " << v1
19504                             << "\n" << e2 << " evaluates to " << v2;
19505 }
19506
19507 // Internal macro for implementing {EXPECT|ASSERT}_PRED_FORMAT2.
19508 // Don't use this in your code.
19509 #define GTEST_PRED_FORMAT2_(pred_format, v1, v2, on_failure)\
19510   GTEST_ASSERT_(pred_format(#v1, #v2, v1, v2), \
19511                 on_failure)
19512
19513 // Internal macro for implementing {EXPECT|ASSERT}_PRED2.  Don't use
19514 // this in your code.
19515 #define GTEST_PRED2_(pred, v1, v2, on_failure)\
19516   GTEST_ASSERT_(::testing::AssertPred2Helper(#pred, \
19517                                              #v1, \
19518                                              #v2, \
19519                                              pred, \
19520                                              v1, \
19521                                              v2), on_failure)
19522
19523 // Binary predicate assertion macros.
19524 #define EXPECT_PRED_FORMAT2(pred_format, v1, v2) \
19525   GTEST_PRED_FORMAT2_(pred_format, v1, v2, GTEST_NONFATAL_FAILURE_)
19526 #define EXPECT_PRED2(pred, v1, v2) \
19527   GTEST_PRED2_(pred, v1, v2, GTEST_NONFATAL_FAILURE_)
19528 #define ASSERT_PRED_FORMAT2(pred_format, v1, v2) \
19529   GTEST_PRED_FORMAT2_(pred_format, v1, v2, GTEST_FATAL_FAILURE_)
19530 #define ASSERT_PRED2(pred, v1, v2) \
19531   GTEST_PRED2_(pred, v1, v2, GTEST_FATAL_FAILURE_)
19532
19533
19534
19535 // Helper function for implementing {EXPECT|ASSERT}_PRED3.  Don't use
19536 // this in your code.
19537 template <typename Pred,
19538           typename T1,
19539           typename T2,
19540           typename T3>
19541 AssertionResult AssertPred3Helper(const char* pred_text,
19542                                   const char* e1,
19543                                   const char* e2,
19544                                   const char* e3,
19545                                   Pred pred,
19546                                   const T1& v1,
19547                                   const T2& v2,
19548                                   const T3& v3) {
19549   if (pred(v1, v2, v3)) return AssertionSuccess();
19550
19551   return AssertionFailure() << pred_text << "("
19552                             << e1 << ", "
19553                             << e2 << ", "
19554                             << e3 << ") evaluates to false, where"
19555                             << "\n" << e1 << " evaluates to " << v1
19556                             << "\n" << e2 << " evaluates to " << v2
19557                             << "\n" << e3 << " evaluates to " << v3;
19558 }
19559
19560 // Internal macro for implementing {EXPECT|ASSERT}_PRED_FORMAT3.
19561 // Don't use this in your code.
19562 #define GTEST_PRED_FORMAT3_(pred_format, v1, v2, v3, on_failure)\
19563   GTEST_ASSERT_(pred_format(#v1, #v2, #v3, v1, v2, v3), \
19564                 on_failure)
19565
19566 // Internal macro for implementing {EXPECT|ASSERT}_PRED3.  Don't use
19567 // this in your code.
19568 #define GTEST_PRED3_(pred, v1, v2, v3, on_failure)\
19569   GTEST_ASSERT_(::testing::AssertPred3Helper(#pred, \
19570                                              #v1, \
19571                                              #v2, \
19572                                              #v3, \
19573                                              pred, \
19574                                              v1, \
19575                                              v2, \
19576                                              v3), on_failure)
19577
19578 // Ternary predicate assertion macros.
19579 #define EXPECT_PRED_FORMAT3(pred_format, v1, v2, v3) \
19580   GTEST_PRED_FORMAT3_(pred_format, v1, v2, v3, GTEST_NONFATAL_FAILURE_)
19581 #define EXPECT_PRED3(pred, v1, v2, v3) \
19582   GTEST_PRED3_(pred, v1, v2, v3, GTEST_NONFATAL_FAILURE_)
19583 #define ASSERT_PRED_FORMAT3(pred_format, v1, v2, v3) \
19584   GTEST_PRED_FORMAT3_(pred_format, v1, v2, v3, GTEST_FATAL_FAILURE_)
19585 #define ASSERT_PRED3(pred, v1, v2, v3) \
19586   GTEST_PRED3_(pred, v1, v2, v3, GTEST_FATAL_FAILURE_)
19587
19588
19589
19590 // Helper function for implementing {EXPECT|ASSERT}_PRED4.  Don't use
19591 // this in your code.
19592 template <typename Pred,
19593           typename T1,
19594           typename T2,
19595           typename T3,
19596           typename T4>
19597 AssertionResult AssertPred4Helper(const char* pred_text,
19598                                   const char* e1,
19599                                   const char* e2,
19600                                   const char* e3,
19601                                   const char* e4,
19602                                   Pred pred,
19603                                   const T1& v1,
19604                                   const T2& v2,
19605                                   const T3& v3,
19606                                   const T4& v4) {
19607   if (pred(v1, v2, v3, v4)) return AssertionSuccess();
19608
19609   return AssertionFailure() << pred_text << "("
19610                             << e1 << ", "
19611                             << e2 << ", "
19612                             << e3 << ", "
19613                             << e4 << ") evaluates to false, where"
19614                             << "\n" << e1 << " evaluates to " << v1
19615                             << "\n" << e2 << " evaluates to " << v2
19616                             << "\n" << e3 << " evaluates to " << v3
19617                             << "\n" << e4 << " evaluates to " << v4;
19618 }
19619
19620 // Internal macro for implementing {EXPECT|ASSERT}_PRED_FORMAT4.
19621 // Don't use this in your code.
19622 #define GTEST_PRED_FORMAT4_(pred_format, v1, v2, v3, v4, on_failure)\
19623   GTEST_ASSERT_(pred_format(#v1, #v2, #v3, #v4, v1, v2, v3, v4), \
19624                 on_failure)
19625
19626 // Internal macro for implementing {EXPECT|ASSERT}_PRED4.  Don't use
19627 // this in your code.
19628 #define GTEST_PRED4_(pred, v1, v2, v3, v4, on_failure)\
19629   GTEST_ASSERT_(::testing::AssertPred4Helper(#pred, \
19630                                              #v1, \
19631                                              #v2, \
19632                                              #v3, \
19633                                              #v4, \
19634                                              pred, \
19635                                              v1, \
19636                                              v2, \
19637                                              v3, \
19638                                              v4), on_failure)
19639
19640 // 4-ary predicate assertion macros.
19641 #define EXPECT_PRED_FORMAT4(pred_format, v1, v2, v3, v4) \
19642   GTEST_PRED_FORMAT4_(pred_format, v1, v2, v3, v4, GTEST_NONFATAL_FAILURE_)
19643 #define EXPECT_PRED4(pred, v1, v2, v3, v4) \
19644   GTEST_PRED4_(pred, v1, v2, v3, v4, GTEST_NONFATAL_FAILURE_)
19645 #define ASSERT_PRED_FORMAT4(pred_format, v1, v2, v3, v4) \
19646   GTEST_PRED_FORMAT4_(pred_format, v1, v2, v3, v4, GTEST_FATAL_FAILURE_)
19647 #define ASSERT_PRED4(pred, v1, v2, v3, v4) \
19648   GTEST_PRED4_(pred, v1, v2, v3, v4, GTEST_FATAL_FAILURE_)
19649
19650
19651
19652 // Helper function for implementing {EXPECT|ASSERT}_PRED5.  Don't use
19653 // this in your code.
19654 template <typename Pred,
19655           typename T1,
19656           typename T2,
19657           typename T3,
19658           typename T4,
19659           typename T5>
19660 AssertionResult AssertPred5Helper(const char* pred_text,
19661                                   const char* e1,
19662                                   const char* e2,
19663                                   const char* e3,
19664                                   const char* e4,
19665                                   const char* e5,
19666                                   Pred pred,
19667                                   const T1& v1,
19668                                   const T2& v2,
19669                                   const T3& v3,
19670                                   const T4& v4,
19671                                   const T5& v5) {
19672   if (pred(v1, v2, v3, v4, v5)) return AssertionSuccess();
19673
19674   return AssertionFailure() << pred_text << "("
19675                             << e1 << ", "
19676                             << e2 << ", "
19677                             << e3 << ", "
19678                             << e4 << ", "
19679                             << e5 << ") evaluates to false, where"
19680                             << "\n" << e1 << " evaluates to " << v1
19681                             << "\n" << e2 << " evaluates to " << v2
19682                             << "\n" << e3 << " evaluates to " << v3
19683                             << "\n" << e4 << " evaluates to " << v4
19684                             << "\n" << e5 << " evaluates to " << v5;
19685 }
19686
19687 // Internal macro for implementing {EXPECT|ASSERT}_PRED_FORMAT5.
19688 // Don't use this in your code.
19689 #define GTEST_PRED_FORMAT5_(pred_format, v1, v2, v3, v4, v5, on_failure)\
19690   GTEST_ASSERT_(pred_format(#v1, #v2, #v3, #v4, #v5, v1, v2, v3, v4, v5), \
19691                 on_failure)
19692
19693 // Internal macro for implementing {EXPECT|ASSERT}_PRED5.  Don't use
19694 // this in your code.
19695 #define GTEST_PRED5_(pred, v1, v2, v3, v4, v5, on_failure)\
19696   GTEST_ASSERT_(::testing::AssertPred5Helper(#pred, \
19697                                              #v1, \
19698                                              #v2, \
19699                                              #v3, \
19700                                              #v4, \
19701                                              #v5, \
19702                                              pred, \
19703                                              v1, \
19704                                              v2, \
19705                                              v3, \
19706                                              v4, \
19707                                              v5), on_failure)
19708
19709 // 5-ary predicate assertion macros.
19710 #define EXPECT_PRED_FORMAT5(pred_format, v1, v2, v3, v4, v5) \
19711   GTEST_PRED_FORMAT5_(pred_format, v1, v2, v3, v4, v5, GTEST_NONFATAL_FAILURE_)
19712 #define EXPECT_PRED5(pred, v1, v2, v3, v4, v5) \
19713   GTEST_PRED5_(pred, v1, v2, v3, v4, v5, GTEST_NONFATAL_FAILURE_)
19714 #define ASSERT_PRED_FORMAT5(pred_format, v1, v2, v3, v4, v5) \
19715   GTEST_PRED_FORMAT5_(pred_format, v1, v2, v3, v4, v5, GTEST_FATAL_FAILURE_)
19716 #define ASSERT_PRED5(pred, v1, v2, v3, v4, v5) \
19717   GTEST_PRED5_(pred, v1, v2, v3, v4, v5, GTEST_FATAL_FAILURE_)
19718
19719
19720
19721 #endif  // GTEST_INCLUDE_GTEST_GTEST_PRED_IMPL_H_
19722
19723 // Macros for testing equalities and inequalities.
19724 //
19725 //    * {ASSERT|EXPECT}_EQ(expected, actual): Tests that expected == actual
19726 //    * {ASSERT|EXPECT}_NE(v1, v2):           Tests that v1 != v2
19727 //    * {ASSERT|EXPECT}_LT(v1, v2):           Tests that v1 < v2
19728 //    * {ASSERT|EXPECT}_LE(v1, v2):           Tests that v1 <= v2
19729 //    * {ASSERT|EXPECT}_GT(v1, v2):           Tests that v1 > v2
19730 //    * {ASSERT|EXPECT}_GE(v1, v2):           Tests that v1 >= v2
19731 //
19732 // When they are not, Google Test prints both the tested expressions and
19733 // their actual values.  The values must be compatible built-in types,
19734 // or you will get a compiler error.  By "compatible" we mean that the
19735 // values can be compared by the respective operator.
19736 //
19737 // Note:
19738 //
19739 //   1. It is possible to make a user-defined type work with
19740 //   {ASSERT|EXPECT}_??(), but that requires overloading the
19741 //   comparison operators and is thus discouraged by the Google C++
19742 //   Usage Guide.  Therefore, you are advised to use the
19743 //   {ASSERT|EXPECT}_TRUE() macro to assert that two objects are
19744 //   equal.
19745 //
19746 //   2. The {ASSERT|EXPECT}_??() macros do pointer comparisons on
19747 //   pointers (in particular, C strings).  Therefore, if you use it
19748 //   with two C strings, you are testing how their locations in memory
19749 //   are related, not how their content is related.  To compare two C
19750 //   strings by content, use {ASSERT|EXPECT}_STR*().
19751 //
19752 //   3. {ASSERT|EXPECT}_EQ(expected, actual) is preferred to
19753 //   {ASSERT|EXPECT}_TRUE(expected == actual), as the former tells you
19754 //   what the actual value is when it fails, and similarly for the
19755 //   other comparisons.
19756 //
19757 //   4. Do not depend on the order in which {ASSERT|EXPECT}_??()
19758 //   evaluate their arguments, which is undefined.
19759 //
19760 //   5. These macros evaluate their arguments exactly once.
19761 //
19762 // Examples:
19763 //
19764 //   EXPECT_NE(5, Foo());
19765 //   EXPECT_EQ(NULL, a_pointer);
19766 //   ASSERT_LT(i, array_size);
19767 //   ASSERT_GT(records.size(), 0) << "There is no record left.";
19768
19769 #define EXPECT_EQ(expected, actual) \
19770   EXPECT_PRED_FORMAT2(::testing::internal:: \
19771                       EqHelper<GTEST_IS_NULL_LITERAL_(expected)>::Compare, \
19772                       expected, actual)
19773 #define EXPECT_NE(expected, actual) \
19774   EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperNE, expected, actual)
19775 #define EXPECT_LE(val1, val2) \
19776   EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperLE, val1, val2)
19777 #define EXPECT_LT(val1, val2) \
19778   EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperLT, val1, val2)
19779 #define EXPECT_GE(val1, val2) \
19780   EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperGE, val1, val2)
19781 #define EXPECT_GT(val1, val2) \
19782   EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperGT, val1, val2)
19783
19784 #define GTEST_ASSERT_EQ(expected, actual) \
19785   ASSERT_PRED_FORMAT2(::testing::internal:: \
19786                       EqHelper<GTEST_IS_NULL_LITERAL_(expected)>::Compare, \
19787                       expected, actual)
19788 #define GTEST_ASSERT_NE(val1, val2) \
19789   ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperNE, val1, val2)
19790 #define GTEST_ASSERT_LE(val1, val2) \
19791   ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperLE, val1, val2)
19792 #define GTEST_ASSERT_LT(val1, val2) \
19793   ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperLT, val1, val2)
19794 #define GTEST_ASSERT_GE(val1, val2) \
19795   ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperGE, val1, val2)
19796 #define GTEST_ASSERT_GT(val1, val2) \
19797   ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperGT, val1, val2)
19798
19799 // Define macro GTEST_DONT_DEFINE_ASSERT_XY to 1 to omit the definition of
19800 // ASSERT_XY(), which clashes with some users' own code.
19801
19802 #if !GTEST_DONT_DEFINE_ASSERT_EQ
19803 # define ASSERT_EQ(val1, val2) GTEST_ASSERT_EQ(val1, val2)
19804 #endif
19805
19806 #if !GTEST_DONT_DEFINE_ASSERT_NE
19807 # define ASSERT_NE(val1, val2) GTEST_ASSERT_NE(val1, val2)
19808 #endif
19809
19810 #if !GTEST_DONT_DEFINE_ASSERT_LE
19811 # define ASSERT_LE(val1, val2) GTEST_ASSERT_LE(val1, val2)
19812 #endif
19813
19814 #if !GTEST_DONT_DEFINE_ASSERT_LT
19815 # define ASSERT_LT(val1, val2) GTEST_ASSERT_LT(val1, val2)
19816 #endif
19817
19818 #if !GTEST_DONT_DEFINE_ASSERT_GE
19819 # define ASSERT_GE(val1, val2) GTEST_ASSERT_GE(val1, val2)
19820 #endif
19821
19822 #if !GTEST_DONT_DEFINE_ASSERT_GT
19823 # define ASSERT_GT(val1, val2) GTEST_ASSERT_GT(val1, val2)
19824 #endif
19825
19826 // C-string Comparisons.  All tests treat NULL and any non-NULL string
19827 // as different.  Two NULLs are equal.
19828 //
19829 //    * {ASSERT|EXPECT}_STREQ(s1, s2):     Tests that s1 == s2
19830 //    * {ASSERT|EXPECT}_STRNE(s1, s2):     Tests that s1 != s2
19831 //    * {ASSERT|EXPECT}_STRCASEEQ(s1, s2): Tests that s1 == s2, ignoring case
19832 //    * {ASSERT|EXPECT}_STRCASENE(s1, s2): Tests that s1 != s2, ignoring case
19833 //
19834 // For wide or narrow string objects, you can use the
19835 // {ASSERT|EXPECT}_??() macros.
19836 //
19837 // Don't depend on the order in which the arguments are evaluated,
19838 // which is undefined.
19839 //
19840 // These macros evaluate their arguments exactly once.
19841
19842 #define EXPECT_STREQ(expected, actual) \
19843   EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperSTREQ, expected, actual)
19844 #define EXPECT_STRNE(s1, s2) \
19845   EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperSTRNE, s1, s2)
19846 #define EXPECT_STRCASEEQ(expected, actual) \
19847   EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperSTRCASEEQ, expected, actual)
19848 #define EXPECT_STRCASENE(s1, s2)\
19849   EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperSTRCASENE, s1, s2)
19850
19851 #define ASSERT_STREQ(expected, actual) \
19852   ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperSTREQ, expected, actual)
19853 #define ASSERT_STRNE(s1, s2) \
19854   ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperSTRNE, s1, s2)
19855 #define ASSERT_STRCASEEQ(expected, actual) \
19856   ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperSTRCASEEQ, expected, actual)
19857 #define ASSERT_STRCASENE(s1, s2)\
19858   ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperSTRCASENE, s1, s2)
19859
19860 // Macros for comparing floating-point numbers.
19861 //
19862 //    * {ASSERT|EXPECT}_FLOAT_EQ(expected, actual):
19863 //         Tests that two float values are almost equal.
19864 //    * {ASSERT|EXPECT}_DOUBLE_EQ(expected, actual):
19865 //         Tests that two double values are almost equal.
19866 //    * {ASSERT|EXPECT}_NEAR(v1, v2, abs_error):
19867 //         Tests that v1 and v2 are within the given distance to each other.
19868 //
19869 // Google Test uses ULP-based comparison to automatically pick a default
19870 // error bound that is appropriate for the operands.  See the
19871 // FloatingPoint template class in gtest-internal.h if you are
19872 // interested in the implementation details.
19873
19874 #define EXPECT_FLOAT_EQ(expected, actual)\
19875   EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperFloatingPointEQ<float>, \
19876                       expected, actual)
19877
19878 #define EXPECT_DOUBLE_EQ(expected, actual)\
19879   EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperFloatingPointEQ<double>, \
19880                       expected, actual)
19881
19882 #define ASSERT_FLOAT_EQ(expected, actual)\
19883   ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperFloatingPointEQ<float>, \
19884                       expected, actual)
19885
19886 #define ASSERT_DOUBLE_EQ(expected, actual)\
19887   ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperFloatingPointEQ<double>, \
19888                       expected, actual)
19889
19890 #define EXPECT_NEAR(val1, val2, abs_error)\
19891   EXPECT_PRED_FORMAT3(::testing::internal::DoubleNearPredFormat, \
19892                       val1, val2, abs_error)
19893
19894 #define ASSERT_NEAR(val1, val2, abs_error)\
19895   ASSERT_PRED_FORMAT3(::testing::internal::DoubleNearPredFormat, \
19896                       val1, val2, abs_error)
19897
19898 // These predicate format functions work on floating-point values, and
19899 // can be used in {ASSERT|EXPECT}_PRED_FORMAT2*(), e.g.
19900 //
19901 //   EXPECT_PRED_FORMAT2(testing::DoubleLE, Foo(), 5.0);
19902
19903 // Asserts that val1 is less than, or almost equal to, val2.  Fails
19904 // otherwise.  In particular, it fails if either val1 or val2 is NaN.
19905 GTEST_API_ AssertionResult FloatLE(const char* expr1, const char* expr2,
19906                                    float val1, float val2);
19907 GTEST_API_ AssertionResult DoubleLE(const char* expr1, const char* expr2,
19908                                     double val1, double val2);
19909
19910
19911 #if GTEST_OS_WINDOWS
19912
19913 // Macros that test for HRESULT failure and success, these are only useful
19914 // on Windows, and rely on Windows SDK macros and APIs to compile.
19915 //
19916 //    * {ASSERT|EXPECT}_HRESULT_{SUCCEEDED|FAILED}(expr)
19917 //
19918 // When expr unexpectedly fails or succeeds, Google Test prints the
19919 // expected result and the actual result with both a human-readable
19920 // string representation of the error, if available, as well as the
19921 // hex result code.
19922 # define EXPECT_HRESULT_SUCCEEDED(expr) \
19923     EXPECT_PRED_FORMAT1(::testing::internal::IsHRESULTSuccess, (expr))
19924
19925 # define ASSERT_HRESULT_SUCCEEDED(expr) \
19926     ASSERT_PRED_FORMAT1(::testing::internal::IsHRESULTSuccess, (expr))
19927
19928 # define EXPECT_HRESULT_FAILED(expr) \
19929     EXPECT_PRED_FORMAT1(::testing::internal::IsHRESULTFailure, (expr))
19930
19931 # define ASSERT_HRESULT_FAILED(expr) \
19932     ASSERT_PRED_FORMAT1(::testing::internal::IsHRESULTFailure, (expr))
19933
19934 #endif  // GTEST_OS_WINDOWS
19935
19936 // Macros that execute statement and check that it doesn't generate new fatal
19937 // failures in the current thread.
19938 //
19939 //   * {ASSERT|EXPECT}_NO_FATAL_FAILURE(statement);
19940 //
19941 // Examples:
19942 //
19943 //   EXPECT_NO_FATAL_FAILURE(Process());
19944 //   ASSERT_NO_FATAL_FAILURE(Process()) << "Process() failed";
19945 //
19946 #define ASSERT_NO_FATAL_FAILURE(statement) \
19947     GTEST_TEST_NO_FATAL_FAILURE_(statement, GTEST_FATAL_FAILURE_)
19948 #define EXPECT_NO_FATAL_FAILURE(statement) \
19949     GTEST_TEST_NO_FATAL_FAILURE_(statement, GTEST_NONFATAL_FAILURE_)
19950
19951 // Causes a trace (including the source file path, the current line
19952 // number, and the given message) to be included in every test failure
19953 // message generated by code in the current scope.  The effect is
19954 // undone when the control leaves the current scope.
19955 //
19956 // The message argument can be anything streamable to std::ostream.
19957 //
19958 // In the implementation, we include the current line number as part
19959 // of the dummy variable name, thus allowing multiple SCOPED_TRACE()s
19960 // to appear in the same block - as long as they are on different
19961 // lines.
19962 #define SCOPED_TRACE(message) \
19963   ::testing::internal::ScopedTrace GTEST_CONCAT_TOKEN_(gtest_trace_, __LINE__)(\
19964     __FILE__, __LINE__, ::testing::Message() << (message))
19965
19966 // Compile-time assertion for type equality.
19967 // StaticAssertTypeEq<type1, type2>() compiles iff type1 and type2 are
19968 // the same type.  The value it returns is not interesting.
19969 //
19970 // Instead of making StaticAssertTypeEq a class template, we make it a
19971 // function template that invokes a helper class template.  This
19972 // prevents a user from misusing StaticAssertTypeEq<T1, T2> by
19973 // defining objects of that type.
19974 //
19975 // CAVEAT:
19976 //
19977 // When used inside a method of a class template,
19978 // StaticAssertTypeEq<T1, T2>() is effective ONLY IF the method is
19979 // instantiated.  For example, given:
19980 //
19981 //   template <typename T> class Foo {
19982 //    public:
19983 //     void Bar() { testing::StaticAssertTypeEq<int, T>(); }
19984 //   };
19985 //
19986 // the code:
19987 //
19988 //   void Test1() { Foo<bool> foo; }
19989 //
19990 // will NOT generate a compiler error, as Foo<bool>::Bar() is never
19991 // actually instantiated.  Instead, you need:
19992 //
19993 //   void Test2() { Foo<bool> foo; foo.Bar(); }
19994 //
19995 // to cause a compiler error.
19996 template <typename T1, typename T2>
19997 bool StaticAssertTypeEq() {
19998   (void)internal::StaticAssertTypeEqHelper<T1, T2>();
19999   return true;
20000 }
20001
20002 // Defines a test.
20003 //
20004 // The first parameter is the name of the test case, and the second
20005 // parameter is the name of the test within the test case.
20006 //
20007 // The convention is to end the test case name with "Test".  For
20008 // example, a test case for the Foo class can be named FooTest.
20009 //
20010 // The user should put his test code between braces after using this
20011 // macro.  Example:
20012 //
20013 //   TEST(FooTest, InitializesCorrectly) {
20014 //     Foo foo;
20015 //     EXPECT_TRUE(foo.StatusIsOK());
20016 //   }
20017
20018 // Note that we call GetTestTypeId() instead of GetTypeId<
20019 // ::testing::Test>() here to get the type ID of testing::Test.  This
20020 // is to work around a suspected linker bug when using Google Test as
20021 // a framework on Mac OS X.  The bug causes GetTypeId<
20022 // ::testing::Test>() to return different values depending on whether
20023 // the call is from the Google Test framework itself or from user test
20024 // code.  GetTestTypeId() is guaranteed to always return the same
20025 // value, as it always calls GetTypeId<>() from the Google Test
20026 // framework.
20027 #define GTEST_TEST(test_case_name, test_name)\
20028   GTEST_TEST_(test_case_name, test_name, \
20029               ::testing::Test, ::testing::internal::GetTestTypeId())
20030
20031 // Define this macro to 1 to omit the definition of TEST(), which
20032 // is a generic name and clashes with some other libraries.
20033 #if !GTEST_DONT_DEFINE_TEST
20034 # define TEST(test_case_name, test_name) GTEST_TEST(test_case_name, test_name)
20035 #endif
20036
20037 // Defines a test that uses a test fixture.
20038 //
20039 // The first parameter is the name of the test fixture class, which
20040 // also doubles as the test case name.  The second parameter is the
20041 // name of the test within the test case.
20042 //
20043 // A test fixture class must be declared earlier.  The user should put
20044 // his test code between braces after using this macro.  Example:
20045 //
20046 //   class FooTest : public testing::Test {
20047 //    protected:
20048 //     virtual void SetUp() { b_.AddElement(3); }
20049 //
20050 //     Foo a_;
20051 //     Foo b_;
20052 //   };
20053 //
20054 //   TEST_F(FooTest, InitializesCorrectly) {
20055 //     EXPECT_TRUE(a_.StatusIsOK());
20056 //   }
20057 //
20058 //   TEST_F(FooTest, ReturnsElementCountCorrectly) {
20059 //     EXPECT_EQ(0, a_.size());
20060 //     EXPECT_EQ(1, b_.size());
20061 //   }
20062
20063 #define TEST_F(test_fixture, test_name)\
20064   GTEST_TEST_(test_fixture, test_name, test_fixture, \
20065               ::testing::internal::GetTypeId<test_fixture>())
20066
20067 }  // namespace testing
20068
20069 // Use this function in main() to run all tests.  It returns 0 if all
20070 // tests are successful, or 1 otherwise.
20071 //
20072 // RUN_ALL_TESTS() should be invoked after the command line has been
20073 // parsed by InitGoogleTest().
20074 //
20075 // This function was formerly a macro; thus, it is in the global
20076 // namespace and has an all-caps name.
20077 int RUN_ALL_TESTS() GTEST_MUST_USE_RESULT_;
20078
20079 inline int RUN_ALL_TESTS() {
20080   return ::testing::UnitTest::GetInstance()->Run();
20081 }
20082
20083 #endif  // GTEST_INCLUDE_GTEST_GTEST_H_