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.  All macros ending with _ and symbols defined in an
130 // internal namespace are subject to change without notice.  Code
131 // outside Google Test MUST NOT USE THEM DIRECTLY.  Macros that don't
132 // end with _ are part of Google Test's public API and can be used by
133 // code outside Google Test.
134 //
135 // This file is fundamental to Google Test.  All other Google Test source
136 // files are expected to #include this.  Therefore, it cannot #include
137 // any other Google Test header.
138 
139 #ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PORT_H_
140 #define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PORT_H_
141 
142 // Environment-describing macros
143 // -----------------------------
144 //
145 // Google Test can be used in many different environments.  Macros in
146 // this section tell Google Test what kind of environment it is being
147 // used in, such that Google Test can provide environment-specific
148 // features and implementations.
149 //
150 // Google Test tries to automatically detect the properties of its
151 // environment, so users usually don't need to worry about these
152 // macros.  However, the automatic detection is not perfect.
153 // Sometimes it's necessary for a user to define some of the following
154 // macros in the build script to override Google Test's decisions.
155 //
156 // If the user doesn't define a macro in the list, Google Test will
157 // provide a default definition.  After this header is #included, all
158 // macros in this list will be defined to either 1 or 0.
159 //
160 // Notes to maintainers:
161 //   - Each macro here is a user-tweakable knob; do not grow the list
162 //     lightly.
163 //   - Use #if to key off these macros.  Don't use #ifdef or "#if
164 //     defined(...)", which will not work as these macros are ALWAYS
165 //     defined.
166 //
167 //   GTEST_HAS_CLONE          - Define it to 1/0 to indicate that clone(2)
168 //                              is/isn't available.
169 //   GTEST_HAS_EXCEPTIONS     - Define it to 1/0 to indicate that exceptions
170 //                              are enabled.
171 //   GTEST_HAS_GLOBAL_STRING  - Define it to 1/0 to indicate that ::string
172 //                              is/isn't available (some systems define
173 //                              ::string, which is different to std::string).
174 //   GTEST_HAS_GLOBAL_WSTRING - Define it to 1/0 to indicate that ::string
175 //                              is/isn't available (some systems define
176 //                              ::wstring, which is different to std::wstring).
177 //   GTEST_HAS_POSIX_RE       - Define it to 1/0 to indicate that POSIX regular
178 //                              expressions are/aren't available.
179 //   GTEST_HAS_PTHREAD        - Define it to 1/0 to indicate that <pthread.h>
180 //                              is/isn't available.
181 //   GTEST_HAS_RTTI           - Define it to 1/0 to indicate that RTTI is/isn't
182 //                              enabled.
183 //   GTEST_HAS_STD_WSTRING    - Define it to 1/0 to indicate that
184 //                              std::wstring does/doesn't work (Google Test can
185 //                              be used where std::wstring is unavailable).
186 //   GTEST_HAS_TR1_TUPLE      - Define it to 1/0 to indicate tr1::tuple
187 //                              is/isn't available.
188 //   GTEST_HAS_SEH            - Define it to 1/0 to indicate whether the
189 //                              compiler supports Microsoft's "Structured
190 //                              Exception Handling".
191 //   GTEST_HAS_STREAM_REDIRECTION
192 //                            - Define it to 1/0 to indicate whether the
193 //                              platform supports I/O stream redirection using
194 //                              dup() and dup2().
195 //   GTEST_USE_OWN_TR1_TUPLE  - Define it to 1/0 to indicate whether Google
196 //                              Test's own tr1 tuple implementation should be
197 //                              used.  Unused when the user sets
198 //                              GTEST_HAS_TR1_TUPLE to 0.
199 //   GTEST_LANG_CXX11         - Define it to 1/0 to indicate that Google Test
200 //                              is building in C++11/C++98 mode.
201 //   GTEST_LINKED_AS_SHARED_LIBRARY
202 //                            - Define to 1 when compiling tests that use
203 //                              Google Test as a shared library (known as
204 //                              DLL on Windows).
205 //   GTEST_CREATE_SHARED_LIBRARY
206 //                            - Define to 1 when compiling Google Test itself
207 //                              as a shared library.
208 
209 // Platform-indicating macros
210 // --------------------------
211 //
212 // Macros indicating the platform on which Google Test is being used
213 // (a macro is defined to 1 if compiled on the given platform;
214 // otherwise UNDEFINED -- it's never defined to 0.).  Google Test
215 // defines these macros automatically.  Code outside Google Test MUST
216 // NOT define them.
217 //
218 //   GTEST_OS_AIX      - IBM AIX
219 //   GTEST_OS_CYGWIN   - Cygwin
220 //   GTEST_OS_FREEBSD  - DragonFly
221 //   GTEST_OS_HPUX     - HP-UX
222 //   GTEST_OS_LINUX    - Linux
223 //     GTEST_OS_LINUX_ANDROID - Google Android
224 //   GTEST_OS_MAC      - Mac OS X
225 //     GTEST_OS_IOS    - iOS
226 //   GTEST_OS_NACL     - Google Native Client (NaCl)
227 //   GTEST_OS_OPENBSD  - OpenBSD
228 //   GTEST_OS_QNX      - QNX
229 //   GTEST_OS_SOLARIS  - Sun Solaris
230 //   GTEST_OS_SYMBIAN  - Symbian
231 //   GTEST_OS_WINDOWS  - Windows (Desktop, MinGW, or Mobile)
232 //     GTEST_OS_WINDOWS_DESKTOP  - Windows Desktop
233 //     GTEST_OS_WINDOWS_MINGW    - MinGW
234 //     GTEST_OS_WINDOWS_MOBILE   - Windows Mobile
235 //     GTEST_OS_WINDOWS_PHONE    - Windows Phone
236 //     GTEST_OS_WINDOWS_RT       - Windows Store App/WinRT
237 //   GTEST_OS_ZOS      - z/OS
238 //
239 // Among the platforms, Cygwin, Linux, Max OS X, and Windows have the
240 // most stable support.  Since core members of the Google Test project
241 // don't have access to other platforms, support for them may be less
242 // stable.  If you notice any problems on your platform, please notify
243 // googletestframework@googlegroups.com (patches for fixing them are
244 // even more welcome!).
245 //
246 // It is possible that none of the GTEST_OS_* macros are defined.
247 
248 // Feature-indicating macros
249 // -------------------------
250 //
251 // Macros indicating which Google Test features are available (a macro
252 // is defined to 1 if the corresponding feature is supported;
253 // otherwise UNDEFINED -- it's never defined to 0.).  Google Test
254 // defines these macros automatically.  Code outside Google Test MUST
255 // NOT define them.
256 //
257 // These macros are public so that portable tests can be written.
258 // Such tests typically surround code using a feature with an #if
259 // which controls that code.  For example:
260 //
261 // #if GTEST_HAS_DEATH_TEST
262 //   EXPECT_DEATH(DoSomethingDeadly());
263 // #endif
264 //
265 //   GTEST_HAS_COMBINE      - the Combine() function (for value-parameterized
266 //                            tests)
267 //   GTEST_HAS_DEATH_TEST   - death tests
268 //   GTEST_HAS_PARAM_TEST   - value-parameterized tests
269 //   GTEST_HAS_TYPED_TEST   - typed tests
270 //   GTEST_HAS_TYPED_TEST_P - type-parameterized tests
271 //   GTEST_IS_THREADSAFE    - Google Test is thread-safe.
272 //   GTEST_USES_POSIX_RE    - enhanced POSIX regex is used. Do not confuse with
273 //                            GTEST_HAS_POSIX_RE (see above) which users can
274 //                            define themselves.
275 //   GTEST_USES_SIMPLE_RE   - our own simple regex is used;
276 //                            the above two are mutually exclusive.
277 //   GTEST_CAN_COMPARE_NULL - accepts untyped NULL in EXPECT_EQ().
278 
279 // Misc public macros
280 // ------------------
281 //
282 //   GTEST_FLAG(flag_name)  - references the variable corresponding to
283 //                            the given Google Test flag.
284 
285 // Internal utilities
286 // ------------------
287 //
288 // The following macros and utilities are for Google Test's INTERNAL
289 // use only.  Code outside Google Test MUST NOT USE THEM DIRECTLY.
290 //
291 // Macros for basic C++ coding:
292 //   GTEST_AMBIGUOUS_ELSE_BLOCKER_ - for disabling a gcc warning.
293 //   GTEST_ATTRIBUTE_UNUSED_  - declares that a class' instances or a
294 //                              variable don't have to be used.
295 //   GTEST_DISALLOW_ASSIGN_   - disables operator=.
296 //   GTEST_DISALLOW_COPY_AND_ASSIGN_ - disables copy ctor and operator=.
297 //   GTEST_MUST_USE_RESULT_   - declares that a function's result must be used.
298 //   GTEST_INTENTIONAL_CONST_COND_PUSH_ - start code section where MSVC C4127 is
299 //                                        suppressed (constant conditional).
300 //   GTEST_INTENTIONAL_CONST_COND_POP_  - finish code section where MSVC C4127
301 //                                        is suppressed.
302 //
303 // C++11 feature wrappers:
304 //
305 //   testing::internal::move  - portability wrapper for std::move.
306 //
307 // Synchronization:
308 //   Mutex, MutexLock, ThreadLocal, GetThreadCount()
309 //                            - synchronization primitives.
310 //
311 // Template meta programming:
312 //   is_pointer     - as in TR1; needed on Symbian and IBM XL C/C++ only.
313 //   IteratorTraits - partial implementation of std::iterator_traits, which
314 //                    is not available in libCstd when compiled with Sun C++.
315 //
316 // Smart pointers:
317 //   scoped_ptr     - as in TR2.
318 //
319 // Regular expressions:
320 //   RE             - a simple regular expression class using the POSIX
321 //                    Extended Regular Expression syntax on UNIX-like
322 //                    platforms, or a reduced regular exception syntax on
323 //                    other platforms, including Windows.
324 //
325 // Logging:
326 //   GTEST_LOG_()   - logs messages at the specified severity level.
327 //   LogToStderr()  - directs all log messages to stderr.
328 //   FlushInfoLog() - flushes informational log messages.
329 //
330 // Stdout and stderr capturing:
331 //   CaptureStdout()     - starts capturing stdout.
332 //   GetCapturedStdout() - stops capturing stdout and returns the captured
333 //                         string.
334 //   CaptureStderr()     - starts capturing stderr.
335 //   GetCapturedStderr() - stops capturing stderr and returns the captured
336 //                         string.
337 //
338 // Integer types:
339 //   TypeWithSize   - maps an integer to a int type.
340 //   Int32, UInt32, Int64, UInt64, TimeInMillis
341 //                  - integers of known sizes.
342 //   BiggestInt     - the biggest signed integer type.
343 //
344 // Command-line utilities:
345 //   GTEST_DECLARE_*()  - declares a flag.
346 //   GTEST_DEFINE_*()   - defines a flag.
347 //   GetInjectableArgvs() - returns the command line as a vector of strings.
348 //
349 // Environment variable utilities:
350 //   GetEnv()             - gets the value of an environment variable.
351 //   BoolFromGTestEnv()   - parses a bool environment variable.
352 //   Int32FromGTestEnv()  - parses an Int32 environment variable.
353 //   StringFromGTestEnv() - parses a string environment variable.
354 
355 #include <ctype.h>   // for isspace, etc
356 #include <stddef.h>  // for ptrdiff_t
357 #include <stdlib.h>
358 #include <stdio.h>
359 #include <string.h>
360 #ifndef _WIN32_WCE
361 # include <sys/types.h>
362 # include <sys/stat.h>
363 #endif  // !_WIN32_WCE
364 
365 #if defined __APPLE__
366 # include <AvailabilityMacros.h>
367 # include <TargetConditionals.h>
368 #endif
369 
370 #include <algorithm>  // NOLINT
371 #include <iostream>  // NOLINT
372 #include <sstream>  // NOLINT
373 #include <string>  // NOLINT
374 #include <utility>
375 #include <vector>  // NOLINT
376 
377 // Copyright 2015, Google Inc.
378 // All rights reserved.
379 //
380 // Redistribution and use in source and binary forms, with or without
381 // modification, are permitted provided that the following conditions are
382 // met:
383 //
384 //     * Redistributions of source code must retain the above copyright
385 // notice, this list of conditions and the following disclaimer.
386 //     * Redistributions in binary form must reproduce the above
387 // copyright notice, this list of conditions and the following disclaimer
388 // in the documentation and/or other materials provided with the
389 // distribution.
390 //     * Neither the name of Google Inc. nor the names of its
391 // contributors may be used to endorse or promote products derived from
392 // this software without specific prior written permission.
393 //
394 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
395 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
396 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
397 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
398 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
399 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
400 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
401 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
402 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
403 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
404 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
405 //
406 // The Google C++ Testing Framework (Google Test)
407 //
408 // This header file defines the GTEST_OS_* macro.
409 // It is separate from gtest-port.h so that custom/gtest-port.h can include it.
410 
411 #ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PORT_ARCH_H_
412 #define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PORT_ARCH_H_
413 
414 // Determines the platform on which Google Test is compiled.
415 #ifdef __CYGWIN__
416 # define GTEST_OS_CYGWIN 1
417 #elif defined __SYMBIAN32__
418 # define GTEST_OS_SYMBIAN 1
419 #elif defined _WIN32
420 # define GTEST_OS_WINDOWS 1
421 # ifdef _WIN32_WCE
422 #  define GTEST_OS_WINDOWS_MOBILE 1
423 # elif defined(__MINGW__) || defined(__MINGW32__)
424 #  define GTEST_OS_WINDOWS_MINGW 1
425 # elif defined(WINAPI_FAMILY)
426 #  include <winapifamily.h>
427 #  if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
428 #   define GTEST_OS_WINDOWS_DESKTOP 1
429 #  elif WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_PHONE_APP)
430 #   define GTEST_OS_WINDOWS_PHONE 1
431 #  elif WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP)
432 #   define GTEST_OS_WINDOWS_RT 1
433 #  else
434     // WINAPI_FAMILY defined but no known partition matched.
435     // Default to desktop.
436 #   define GTEST_OS_WINDOWS_DESKTOP 1
437 #  endif
438 # else
439 #  define GTEST_OS_WINDOWS_DESKTOP 1
440 # endif  // _WIN32_WCE
441 #elif defined __APPLE__
442 # define GTEST_OS_MAC 1
443 # if TARGET_OS_IPHONE
444 #  define GTEST_OS_IOS 1
445 # endif
446 #elif defined __DragonFly__
447 # define GTEST_OS_FREEBSD 1
448 #elif defined __linux__
449 # define GTEST_OS_LINUX 1
450 # if defined __ANDROID__
451 #  define GTEST_OS_LINUX_ANDROID 1
452 # endif
453 #elif defined __MVS__
454 # define GTEST_OS_ZOS 1
455 #elif defined(__sun) && defined(__SVR4)
456 # define GTEST_OS_SOLARIS 1
457 #elif defined(_AIX)
458 # define GTEST_OS_AIX 1
459 #elif defined(__hpux)
460 # define GTEST_OS_HPUX 1
461 #elif defined __native_client__
462 # define GTEST_OS_NACL 1
463 #elif defined __OpenBSD__
464 # define GTEST_OS_OPENBSD 1
465 #elif defined __QNX__
466 # define GTEST_OS_QNX 1
467 #endif  // __CYGWIN__
468 
469 #endif  // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PORT_ARCH_H_
470 // Copyright 2015, Google Inc.
471 // All rights reserved.
472 //
473 // Redistribution and use in source and binary forms, with or without
474 // modification, are permitted provided that the following conditions are
475 // met:
476 //
477 //     * Redistributions of source code must retain the above copyright
478 // notice, this list of conditions and the following disclaimer.
479 //     * Redistributions in binary form must reproduce the above
480 // copyright notice, this list of conditions and the following disclaimer
481 // in the documentation and/or other materials provided with the
482 // distribution.
483 //     * Neither the name of Google Inc. nor the names of its
484 // contributors may be used to endorse or promote products derived from
485 // this software without specific prior written permission.
486 //
487 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
488 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
489 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
490 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
491 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
492 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
493 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
494 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
495 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
496 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
497 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
498 //
499 // Injection point for custom user configurations.
500 // The following macros can be defined:
501 //
502 //   Flag related macros:
503 //     GTEST_FLAG(flag_name)
504 //     GTEST_USE_OWN_FLAGFILE_FLAG_  - Define to 0 when the system provides its
505 //                                     own flagfile flag parsing.
506 //     GTEST_DECLARE_bool_(name)
507 //     GTEST_DECLARE_int32_(name)
508 //     GTEST_DECLARE_string_(name)
509 //     GTEST_DEFINE_bool_(name, default_val, doc)
510 //     GTEST_DEFINE_int32_(name, default_val, doc)
511 //     GTEST_DEFINE_string_(name, default_val, doc)
512 //
513 //   Test filtering:
514 //     GTEST_TEST_FILTER_ENV_VAR_ - The name of an environment variable that
515 //                                  will be used if --GTEST_FLAG(test_filter)
516 //                                  is not provided.
517 //
518 //   Logging:
519 //     GTEST_LOG_(severity)
520 //     GTEST_CHECK_(condition)
521 //     Functions LogToStderr() and FlushInfoLog() have to be provided too.
522 //
523 //   Threading:
524 //     GTEST_HAS_NOTIFICATION_ - Enabled if Notification is already provided.
525 //     GTEST_HAS_MUTEX_AND_THREAD_LOCAL_ - Enabled if Mutex and ThreadLocal are
526 //                                         already provided.
527 //     Must also provide GTEST_DECLARE_STATIC_MUTEX_(mutex) and
528 //     GTEST_DEFINE_STATIC_MUTEX_(mutex)
529 //
530 //     GTEST_EXCLUSIVE_LOCK_REQUIRED_(locks)
531 //     GTEST_LOCK_EXCLUDED_(locks)
532 //
533 // ** Custom implementation starts here **
534 
535 #ifndef GTEST_INCLUDE_GTEST_INTERNAL_CUSTOM_GTEST_PORT_H_
536 #define GTEST_INCLUDE_GTEST_INTERNAL_CUSTOM_GTEST_PORT_H_
537 
538 #endif  // GTEST_INCLUDE_GTEST_INTERNAL_CUSTOM_GTEST_PORT_H_
539 
540 #if !defined(GTEST_DEV_EMAIL_)
541 # define GTEST_DEV_EMAIL_ "googletestframework@@googlegroups.com"
542 # define GTEST_FLAG_PREFIX_ "gtest_"
543 # define GTEST_FLAG_PREFIX_DASH_ "gtest-"
544 # define GTEST_FLAG_PREFIX_UPPER_ "GTEST_"
545 # define GTEST_NAME_ "Google Test"
546 # define GTEST_PROJECT_URL_ "https://github.com/google/googletest/"
547 #endif  // !defined(GTEST_DEV_EMAIL_)
548 
549 #if !defined(GTEST_INIT_GOOGLE_TEST_NAME_)
550 # define GTEST_INIT_GOOGLE_TEST_NAME_ "testing::InitGoogleTest"
551 #endif  // !defined(GTEST_INIT_GOOGLE_TEST_NAME_)
552 
553 // Determines the version of gcc that is used to compile this.
554 #ifdef __GNUC__
555 // 40302 means version 4.3.2.
556 # define GTEST_GCC_VER_ \
557     (__GNUC__*10000 + __GNUC_MINOR__*100 + __GNUC_PATCHLEVEL__)
558 #endif  // __GNUC__
559 
560 // Macros for disabling Microsoft Visual C++ warnings.
561 //
562 //   GTEST_DISABLE_MSC_WARNINGS_PUSH_(4800 4385)
563 //   /* code that triggers warnings C4800 and C4385 */
564 //   GTEST_DISABLE_MSC_WARNINGS_POP_()
565 #if _MSC_VER >= 1500
566 # define GTEST_DISABLE_MSC_WARNINGS_PUSH_(warnings) \
567     __pragma(warning(push))                        \
568     __pragma(warning(disable: warnings))
569 # define GTEST_DISABLE_MSC_WARNINGS_POP_()          \
570     __pragma(warning(pop))
571 #else
572 // Older versions of MSVC don't have __pragma.
573 # define GTEST_DISABLE_MSC_WARNINGS_PUSH_(warnings)
574 # define GTEST_DISABLE_MSC_WARNINGS_POP_()
575 #endif
576 
577 #ifndef GTEST_LANG_CXX11
578 // gcc and clang define __GXX_EXPERIMENTAL_CXX0X__ when
579 // -std={c,gnu}++{0x,11} is passed.  The C++11 standard specifies a
580 // value for __cplusplus, and recent versions of clang, gcc, and
581 // probably other compilers set that too in C++11 mode.
582 # if __GXX_EXPERIMENTAL_CXX0X__ || __cplusplus >= 201103L
583 // Compiling in at least C++11 mode.
584 #  define GTEST_LANG_CXX11 1
585 # else
586 #  define GTEST_LANG_CXX11 0
587 # endif
588 #endif
589 
590 // Distinct from C++11 language support, some environments don't provide
591 // proper C++11 library support. Notably, it's possible to build in
592 // C++11 mode when targeting Mac OS X 10.6, which has an old libstdc++
593 // with no C++11 support.
594 //
595 // libstdc++ has sufficient C++11 support as of GCC 4.6.0, __GLIBCXX__
596 // 20110325, but maintenance releases in the 4.4 and 4.5 series followed
597 // this date, so check for those versions by their date stamps.
598 // https://gcc.gnu.org/onlinedocs/libstdc++/manual/abi.html#abi.versioning
599 #if GTEST_LANG_CXX11 && \
600     (!defined(__GLIBCXX__) || ( \
601         __GLIBCXX__ >= 20110325ul &&  /* GCC >= 4.6.0 */ \
602         /* Blacklist of patch releases of older branches: */ \
603         __GLIBCXX__ != 20110416ul &&  /* GCC 4.4.6 */ \
604         __GLIBCXX__ != 20120313ul &&  /* GCC 4.4.7 */ \
605         __GLIBCXX__ != 20110428ul &&  /* GCC 4.5.3 */ \
606         __GLIBCXX__ != 20120702ul))   /* GCC 4.5.4 */
607 # define GTEST_STDLIB_CXX11 1
608 #endif
609 
610 // Only use C++11 library features if the library provides them.
611 #if GTEST_STDLIB_CXX11
612 # define GTEST_HAS_STD_BEGIN_AND_END_ 1
613 # define GTEST_HAS_STD_FORWARD_LIST_ 1
614 # define GTEST_HAS_STD_FUNCTION_ 1
615 # define GTEST_HAS_STD_INITIALIZER_LIST_ 1
616 # define GTEST_HAS_STD_MOVE_ 1
617 # define GTEST_HAS_STD_SHARED_PTR_ 1
618 # define GTEST_HAS_STD_TYPE_TRAITS_ 1
619 # define GTEST_HAS_STD_UNIQUE_PTR_ 1
620 #endif
621 
622 // C++11 specifies that <tuple> provides std::tuple.
623 // Some platforms still might not have it, however.
624 #if GTEST_LANG_CXX11
625 # define GTEST_HAS_STD_TUPLE_ 1
626 # if defined(__clang__)
627 // Inspired by http://clang.llvm.org/docs/LanguageExtensions.html#__has_include
628 #  if defined(__has_include) && !__has_include(<tuple>)
629 #   undef GTEST_HAS_STD_TUPLE_
630 #  endif
631 # elif defined(_MSC_VER)
632 // Inspired by boost/config/stdlib/dinkumware.hpp
633 #  if defined(_CPPLIB_VER) && _CPPLIB_VER < 520
634 #   undef GTEST_HAS_STD_TUPLE_
635 #  endif
636 # elif defined(__GLIBCXX__)
637 // Inspired by boost/config/stdlib/libstdcpp3.hpp,
638 // http://gcc.gnu.org/gcc-4.2/changes.html and
639 // http://gcc.gnu.org/onlinedocs/libstdc++/manual/bk01pt01ch01.html#manual.intro.status.standard.200x
640 #  if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 2)
641 #   undef GTEST_HAS_STD_TUPLE_
642 #  endif
643 # endif
644 #endif
645 
646 // Brings in definitions for functions used in the testing::internal::posix
647 // namespace (read, write, close, chdir, isatty, stat). We do not currently
648 // use them on Windows Mobile.
649 #if GTEST_OS_WINDOWS
650 # if !GTEST_OS_WINDOWS_MOBILE
651 #  include <direct.h>
652 #  include <io.h>
653 # endif
654 // In order to avoid having to include <windows.h>, use forward declaration
655 // assuming CRITICAL_SECTION is a typedef of _RTL_CRITICAL_SECTION.
656 // This assumption is verified by
657 // WindowsTypesTest.CRITICAL_SECTIONIs_RTL_CRITICAL_SECTION.
658 struct _RTL_CRITICAL_SECTION;
659 #else
660 // This assumes that non-Windows OSes provide unistd.h. For OSes where this
661 // is not the case, we need to include headers that provide the functions
662 // mentioned above.
663 # include <unistd.h>
664 # include <strings.h>
665 #endif  // GTEST_OS_WINDOWS
666 
667 #if GTEST_OS_LINUX_ANDROID
668 // Used to define __ANDROID_API__ matching the target NDK API level.
669 #  include <android/api-level.h>  // NOLINT
670 #endif
671 
672 // Defines this to true iff Google Test can use POSIX regular expressions.
673 #ifndef GTEST_HAS_POSIX_RE
674 # if GTEST_OS_LINUX_ANDROID
675 // On Android, <regex.h> is only available starting with Gingerbread.
676 #  define GTEST_HAS_POSIX_RE (__ANDROID_API__ >= 9)
677 # else
678 #  define GTEST_HAS_POSIX_RE (!GTEST_OS_WINDOWS)
679 # endif
680 #endif
681 
682 #if GTEST_USES_PCRE
683 // The appropriate headers have already been included.
684 
685 #elif GTEST_HAS_POSIX_RE
686 
687 // On some platforms, <regex.h> needs someone to define size_t, and
688 // won't compile otherwise.  We can #include it here as we already
689 // included <stdlib.h>, which is guaranteed to define size_t through
690 // <stddef.h>.
691 # include <regex.h>  // NOLINT
692 
693 # define GTEST_USES_POSIX_RE 1
694 
695 #elif GTEST_OS_WINDOWS
696 
697 // <regex.h> is not available on Windows.  Use our own simple regex
698 // implementation instead.
699 # define GTEST_USES_SIMPLE_RE 1
700 
701 #else
702 
703 // <regex.h> may not be available on this platform.  Use our own
704 // simple regex implementation instead.
705 # define GTEST_USES_SIMPLE_RE 1
706 
707 #endif  // GTEST_USES_PCRE
708 
709 #ifndef GTEST_HAS_EXCEPTIONS
710 // The user didn't tell us whether exceptions are enabled, so we need
711 // to figure it out.
712 # if defined(_MSC_VER) || defined(__BORLANDC__)
713 // MSVC's and C++Builder's implementations of the STL use the _HAS_EXCEPTIONS
714 // macro to enable exceptions, so we'll do the same.
715 // Assumes that exceptions are enabled by default.
716 #  ifndef _HAS_EXCEPTIONS
717 #   define _HAS_EXCEPTIONS 1
718 #  endif  // _HAS_EXCEPTIONS
719 #  define GTEST_HAS_EXCEPTIONS _HAS_EXCEPTIONS
720 # elif defined(__clang__)
721 // clang defines __EXCEPTIONS iff exceptions are enabled before clang 220714,
722 // but iff cleanups are enabled after that. In Obj-C++ files, there can be
723 // cleanups for ObjC exceptions which also need cleanups, even if C++ exceptions
724 // are disabled. clang has __has_feature(cxx_exceptions) which checks for C++
725 // exceptions starting at clang r206352, but which checked for cleanups prior to
726 // that. To reliably check for C++ exception availability with clang, check for
727 // __EXCEPTIONS && __has_feature(cxx_exceptions).
728 #  define GTEST_HAS_EXCEPTIONS (__EXCEPTIONS && __has_feature(cxx_exceptions))
729 # elif defined(__GNUC__) && __EXCEPTIONS
730 // gcc defines __EXCEPTIONS to 1 iff exceptions are enabled.
731 #  define GTEST_HAS_EXCEPTIONS 1
732 # elif defined(__SUNPRO_CC)
733 // Sun Pro CC supports exceptions.  However, there is no compile-time way of
734 // detecting whether they are enabled or not.  Therefore, we assume that
735 // they are enabled unless the user tells us otherwise.
736 #  define GTEST_HAS_EXCEPTIONS 1
737 # elif defined(__IBMCPP__) && __EXCEPTIONS
738 // xlC defines __EXCEPTIONS to 1 iff exceptions are enabled.
739 #  define GTEST_HAS_EXCEPTIONS 1
740 # elif defined(__HP_aCC)
741 // Exception handling is in effect by default in HP aCC compiler. It has to
742 // be turned of by +noeh compiler option if desired.
743 #  define GTEST_HAS_EXCEPTIONS 1
744 # else
745 // For other compilers, we assume exceptions are disabled to be
746 // conservative.
747 #  define GTEST_HAS_EXCEPTIONS 0
748 # endif  // defined(_MSC_VER) || defined(__BORLANDC__)
749 #endif  // GTEST_HAS_EXCEPTIONS
750 
751 #if !defined(GTEST_HAS_STD_STRING)
752 // Even though we don't use this macro any longer, we keep it in case
753 // some clients still depend on it.
754 # define GTEST_HAS_STD_STRING 1
755 #elif !GTEST_HAS_STD_STRING
756 // The user told us that ::std::string isn't available.
757 # error "Google Test cannot be used where ::std::string isn't available."
758 #endif  // !defined(GTEST_HAS_STD_STRING)
759 
760 #ifndef GTEST_HAS_GLOBAL_STRING
761 // The user didn't tell us whether ::string is available, so we need
762 // to figure it out.
763 
764 # define GTEST_HAS_GLOBAL_STRING 0
765 
766 #endif  // GTEST_HAS_GLOBAL_STRING
767 
768 #ifndef GTEST_HAS_STD_WSTRING
769 // The user didn't tell us whether ::std::wstring is available, so we need
770 // to figure it out.
771 // TODO(wan@google.com): uses autoconf to detect whether ::std::wstring
772 //   is available.
773 
774 // Cygwin 1.7 and below doesn't support ::std::wstring.
775 // Solaris' libc++ doesn't support it either.  Android has
776 // no support for it at least as recent as Froyo (2.2).
777 # define GTEST_HAS_STD_WSTRING \
778     (!(GTEST_OS_LINUX_ANDROID || GTEST_OS_CYGWIN || GTEST_OS_SOLARIS))
779 
780 #endif  // GTEST_HAS_STD_WSTRING
781 
782 #ifndef GTEST_HAS_GLOBAL_WSTRING
783 // The user didn't tell us whether ::wstring is available, so we need
784 // to figure it out.
785 # define GTEST_HAS_GLOBAL_WSTRING \
786     (GTEST_HAS_STD_WSTRING && GTEST_HAS_GLOBAL_STRING)
787 #endif  // GTEST_HAS_GLOBAL_WSTRING
788 
789 // Determines whether RTTI is available.
790 #ifndef GTEST_HAS_RTTI
791 // The user didn't tell us whether RTTI is enabled, so we need to
792 // figure it out.
793 
794 # ifdef _MSC_VER
795 
796 #  ifdef _CPPRTTI  // MSVC defines this macro iff RTTI is enabled.
797 #   define GTEST_HAS_RTTI 1
798 #  else
799 #   define GTEST_HAS_RTTI 0
800 #  endif
801 
802 // Starting with version 4.3.2, gcc defines __GXX_RTTI iff RTTI is enabled.
803 # elif defined(__GNUC__) && (GTEST_GCC_VER_ >= 40302)
804 
805 #  ifdef __GXX_RTTI
806 // When building against STLport with the Android NDK and with
807 // -frtti -fno-exceptions, the build fails at link time with undefined
808 // references to __cxa_bad_typeid. Note sure if STL or toolchain bug,
809 // so disable RTTI when detected.
810 #   if GTEST_OS_LINUX_ANDROID && defined(_STLPORT_MAJOR) && \
811        !defined(__EXCEPTIONS)
812 #    define GTEST_HAS_RTTI 0
813 #   else
814 #    define GTEST_HAS_RTTI 1
815 #   endif  // GTEST_OS_LINUX_ANDROID && __STLPORT_MAJOR && !__EXCEPTIONS
816 #  else
817 #   define GTEST_HAS_RTTI 0
818 #  endif  // __GXX_RTTI
819 
820 // Clang defines __GXX_RTTI starting with version 3.0, but its manual recommends
821 // using has_feature instead. has_feature(cxx_rtti) is supported since 2.7, the
822 // first version with C++ support.
823 # elif defined(__clang__)
824 
825 #  define GTEST_HAS_RTTI __has_feature(cxx_rtti)
826 
827 // Starting with version 9.0 IBM Visual Age defines __RTTI_ALL__ to 1 if
828 // both the typeid and dynamic_cast features are present.
829 # elif defined(__IBMCPP__) && (__IBMCPP__ >= 900)
830 
831 #  ifdef __RTTI_ALL__
832 #   define GTEST_HAS_RTTI 1
833 #  else
834 #   define GTEST_HAS_RTTI 0
835 #  endif
836 
837 # else
838 
839 // For all other compilers, we assume RTTI is enabled.
840 #  define GTEST_HAS_RTTI 1
841 
842 # endif  // _MSC_VER
843 
844 #endif  // GTEST_HAS_RTTI
845 
846 // It's this header's responsibility to #include <typeinfo> when RTTI
847 // is enabled.
848 #if GTEST_HAS_RTTI
849 # include <typeinfo>
850 #endif
851 
852 // Determines whether Google Test can use the pthreads library.
853 #ifndef GTEST_HAS_PTHREAD
854 // The user didn't tell us explicitly, so we make reasonable assumptions about
855 // which platforms have pthreads support.
856 //
857 // To disable threading support in Google Test, add -DGTEST_HAS_PTHREAD=0
858 // to your compiler flags.
859 # define GTEST_HAS_PTHREAD (GTEST_OS_LINUX || GTEST_OS_MAC || GTEST_OS_HPUX \
860     || GTEST_OS_QNX || GTEST_OS_FREEBSD || GTEST_OS_NACL)
861 #endif  // GTEST_HAS_PTHREAD
862 
863 #if GTEST_HAS_PTHREAD
864 // gtest-port.h guarantees to #include <pthread.h> when GTEST_HAS_PTHREAD is
865 // true.
866 # include <pthread.h>  // NOLINT
867 
868 // For timespec and nanosleep, used below.
869 # include <time.h>  // NOLINT
870 #endif
871 
872 // Determines if hash_map/hash_set are available.
873 // Only used for testing against those containers.
874 #if !defined(GTEST_HAS_HASH_MAP_)
875 # if _MSC_VER
876 #  define GTEST_HAS_HASH_MAP_ 1  // Indicates that hash_map is available.
877 #  define GTEST_HAS_HASH_SET_ 1  // Indicates that hash_set is available.
878 # endif  // _MSC_VER
879 #endif  // !defined(GTEST_HAS_HASH_MAP_)
880 
881 // Determines whether Google Test can use tr1/tuple.  You can define
882 // this macro to 0 to prevent Google Test from using tuple (any
883 // feature depending on tuple with be disabled in this mode).
884 #ifndef GTEST_HAS_TR1_TUPLE
885 # if GTEST_OS_LINUX_ANDROID && defined(_STLPORT_MAJOR)
886 // STLport, provided with the Android NDK, has neither <tr1/tuple> or <tuple>.
887 #  define GTEST_HAS_TR1_TUPLE 0
888 # else
889 // The user didn't tell us not to do it, so we assume it's OK.
890 #  define GTEST_HAS_TR1_TUPLE 1
891 # endif
892 #endif  // GTEST_HAS_TR1_TUPLE
893 
894 // Determines whether Google Test's own tr1 tuple implementation
895 // should be used.
896 #ifndef GTEST_USE_OWN_TR1_TUPLE
897 // The user didn't tell us, so we need to figure it out.
898 
899 // We use our own TR1 tuple if we aren't sure the user has an
900 // implementation of it already.  At this time, libstdc++ 4.0.0+ and
901 // MSVC 2010 are the only mainstream standard libraries that come
902 // with a TR1 tuple implementation.  NVIDIA's CUDA NVCC compiler
903 // pretends to be GCC by defining __GNUC__ and friends, but cannot
904 // compile GCC's tuple implementation.  MSVC 2008 (9.0) provides TR1
905 // tuple in a 323 MB Feature Pack download, which we cannot assume the
906 // user has.  QNX's QCC compiler is a modified GCC but it doesn't
907 // support TR1 tuple.  libc++ only provides std::tuple, in C++11 mode,
908 // and it can be used with some compilers that define __GNUC__.
909 # if (defined(__GNUC__) && !defined(__CUDACC__) && (GTEST_GCC_VER_ >= 40000) \
910       && !GTEST_OS_QNX && !defined(_LIBCPP_VERSION)) || _MSC_VER >= 1600
911 #  define GTEST_ENV_HAS_TR1_TUPLE_ 1
912 # endif
913 
914 // C++11 specifies that <tuple> provides std::tuple. Use that if gtest is used
915 // in C++11 mode and libstdc++ isn't very old (binaries targeting OS X 10.6
916 // can build with clang but need to use gcc4.2's libstdc++).
917 # if GTEST_LANG_CXX11 && (!defined(__GLIBCXX__) || __GLIBCXX__ > 20110325)
918 #  define GTEST_ENV_HAS_STD_TUPLE_ 1
919 # endif
920 
921 # if GTEST_ENV_HAS_TR1_TUPLE_ || GTEST_ENV_HAS_STD_TUPLE_
922 #  define GTEST_USE_OWN_TR1_TUPLE 0
923 # else
924 #  define GTEST_USE_OWN_TR1_TUPLE 1
925 # endif
926 
927 #endif  // GTEST_USE_OWN_TR1_TUPLE
928 
929 // To avoid conditional compilation everywhere, we make it
930 // gtest-port.h's responsibility to #include the header implementing
931 // tuple.
932 #if GTEST_HAS_STD_TUPLE_
933 # include <tuple>  // IWYU pragma: export
934 # define GTEST_TUPLE_NAMESPACE_ ::std
935 #endif  // GTEST_HAS_STD_TUPLE_
936 
937 // We include tr1::tuple even if std::tuple is available to define printers for
938 // them.
939 #if GTEST_HAS_TR1_TUPLE
940 # ifndef GTEST_TUPLE_NAMESPACE_
941 #  define GTEST_TUPLE_NAMESPACE_ ::std::tr1
942 # endif  // GTEST_TUPLE_NAMESPACE_
943 
944 # if GTEST_USE_OWN_TR1_TUPLE
945 // This file was GENERATED by command:
946 //     pump.py gtest-tuple.h.pump
947 // DO NOT EDIT BY HAND!!!
948 
949 // Copyright 2009 Google Inc.
950 // All Rights Reserved.
951 //
952 // Redistribution and use in source and binary forms, with or without
953 // modification, are permitted provided that the following conditions are
954 // met:
955 //
956 //     * Redistributions of source code must retain the above copyright
957 // notice, this list of conditions and the following disclaimer.
958 //     * Redistributions in binary form must reproduce the above
959 // copyright notice, this list of conditions and the following disclaimer
960 // in the documentation and/or other materials provided with the
961 // distribution.
962 //     * Neither the name of Google Inc. nor the names of its
963 // contributors may be used to endorse or promote products derived from
964 // this software without specific prior written permission.
965 //
966 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
967 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
968 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
969 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
970 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
971 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
972 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
973 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
974 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
975 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
976 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
977 //
978 // Author: wan@google.com (Zhanyong Wan)
979 
980 // Implements a subset of TR1 tuple needed by Google Test and Google Mock.
981 
982 #ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_TUPLE_H_
983 #define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_TUPLE_H_
984 
985 #include <utility>  // For ::std::pair.
986 
987 // The compiler used in Symbian has a bug that prevents us from declaring the
988 // tuple template as a friend (it complains that tuple is redefined).  This
989 // hack bypasses the bug by declaring the members that should otherwise be
990 // private as public.
991 // Sun Studio versions < 12 also have the above bug.
992 #if defined(__SYMBIAN32__) || (defined(__SUNPRO_CC) && __SUNPRO_CC < 0x590)
993 # define GTEST_DECLARE_TUPLE_AS_FRIEND_ public:
994 #else
995 # define GTEST_DECLARE_TUPLE_AS_FRIEND_ \
996     template <GTEST_10_TYPENAMES_(U)> friend class tuple; \
997    private:
998 #endif
999 
1000 // Visual Studio 2010, 2012, and 2013 define symbols in std::tr1 that conflict
1001 // with our own definitions. Therefore using our own tuple does not work on
1002 // those compilers.
1003 #if defined(_MSC_VER) && _MSC_VER >= 1600  /* 1600 is Visual Studio 2010 */
1004 # error "gtest's tuple doesn't compile on Visual Studio 2010 or later. \
1005 GTEST_USE_OWN_TR1_TUPLE must be set to 0 on those compilers."
1006 #endif
1007 
1008 // GTEST_n_TUPLE_(T) is the type of an n-tuple.
1009 #define GTEST_0_TUPLE_(T) tuple<>
1010 #define GTEST_1_TUPLE_(T) tuple<T##0, void, void, void, void, void, void, \
1011     void, void, void>
1012 #define GTEST_2_TUPLE_(T) tuple<T##0, T##1, void, void, void, void, void, \
1013     void, void, void>
1014 #define GTEST_3_TUPLE_(T) tuple<T##0, T##1, T##2, void, void, void, void, \
1015     void, void, void>
1016 #define GTEST_4_TUPLE_(T) tuple<T##0, T##1, T##2, T##3, void, void, void, \
1017     void, void, void>
1018 #define GTEST_5_TUPLE_(T) tuple<T##0, T##1, T##2, T##3, T##4, void, void, \
1019     void, void, void>
1020 #define GTEST_6_TUPLE_(T) tuple<T##0, T##1, T##2, T##3, T##4, T##5, void, \
1021     void, void, void>
1022 #define GTEST_7_TUPLE_(T) tuple<T##0, T##1, T##2, T##3, T##4, T##5, T##6, \
1023     void, void, void>
1024 #define GTEST_8_TUPLE_(T) tuple<T##0, T##1, T##2, T##3, T##4, T##5, T##6, \
1025     T##7, void, void>
1026 #define GTEST_9_TUPLE_(T) tuple<T##0, T##1, T##2, T##3, T##4, T##5, T##6, \
1027     T##7, T##8, void>
1028 #define GTEST_10_TUPLE_(T) tuple<T##0, T##1, T##2, T##3, T##4, T##5, T##6, \
1029     T##7, T##8, T##9>
1030 
1031 // GTEST_n_TYPENAMES_(T) declares a list of n typenames.
1032 #define GTEST_0_TYPENAMES_(T)
1033 #define GTEST_1_TYPENAMES_(T) typename T##0
1034 #define GTEST_2_TYPENAMES_(T) typename T##0, typename T##1
1035 #define GTEST_3_TYPENAMES_(T) typename T##0, typename T##1, typename T##2
1036 #define GTEST_4_TYPENAMES_(T) typename T##0, typename T##1, typename T##2, \
1037     typename T##3
1038 #define GTEST_5_TYPENAMES_(T) typename T##0, typename T##1, typename T##2, \
1039     typename T##3, typename T##4
1040 #define GTEST_6_TYPENAMES_(T) typename T##0, typename T##1, typename T##2, \
1041     typename T##3, typename T##4, typename T##5
1042 #define GTEST_7_TYPENAMES_(T) typename T##0, typename T##1, typename T##2, \
1043     typename T##3, typename T##4, typename T##5, typename T##6
1044 #define GTEST_8_TYPENAMES_(T) typename T##0, typename T##1, typename T##2, \
1045     typename T##3, typename T##4, typename T##5, typename T##6, typename T##7
1046 #define GTEST_9_TYPENAMES_(T) typename T##0, typename T##1, typename T##2, \
1047     typename T##3, typename T##4, typename T##5, typename T##6, \
1048     typename T##7, typename T##8
1049 #define GTEST_10_TYPENAMES_(T) typename T##0, typename T##1, typename T##2, \
1050     typename T##3, typename T##4, typename T##5, typename T##6, \
1051     typename T##7, typename T##8, typename T##9
1052 
1053 // In theory, defining stuff in the ::std namespace is undefined
1054 // behavior.  We can do this as we are playing the role of a standard
1055 // library vendor.
1056 namespace std {
1057 namespace tr1 {
1058 
1059 template <typename T0 = void, typename T1 = void, typename T2 = void,
1060     typename T3 = void, typename T4 = void, typename T5 = void,
1061     typename T6 = void, typename T7 = void, typename T8 = void,
1062     typename T9 = void>
1063 class tuple;
1064 
1065 // Anything in namespace gtest_internal is Google Test's INTERNAL
1066 // IMPLEMENTATION DETAIL and MUST NOT BE USED DIRECTLY in user code.
1067 namespace gtest_internal {
1068 
1069 // ByRef<T>::type is T if T is a reference; otherwise it's const T&.
1070 template <typename T>
1071 struct ByRef { typedef const T& type; };  // NOLINT
1072 template <typename T>
1073 struct ByRef<T&> { typedef T& type; };  // NOLINT
1074 
1075 // A handy wrapper for ByRef.
1076 #define GTEST_BY_REF_(T) typename ::std::tr1::gtest_internal::ByRef<T>::type
1077 
1078 // AddRef<T>::type is T if T is a reference; otherwise it's T&.  This
1079 // is the same as tr1::add_reference<T>::type.
1080 template <typename T>
1081 struct AddRef { typedef T& type; };  // NOLINT
1082 template <typename T>
1083 struct AddRef<T&> { typedef T& type; };  // NOLINT
1084 
1085 // A handy wrapper for AddRef.
1086 #define GTEST_ADD_REF_(T) typename ::std::tr1::gtest_internal::AddRef<T>::type
1087 
1088 // A helper for implementing get<k>().
1089 template <int k> class Get;
1090 
1091 // A helper for implementing tuple_element<k, T>.  kIndexValid is true
1092 // iff k < the number of fields in tuple type T.
1093 template <bool kIndexValid, int kIndex, class Tuple>
1094 struct TupleElement;
1095 
1096 template <GTEST_10_TYPENAMES_(T)>
1097 struct TupleElement<true, 0, GTEST_10_TUPLE_(T) > {
1098   typedef T0 type;
1099 };
1100 
1101 template <GTEST_10_TYPENAMES_(T)>
1102 struct TupleElement<true, 1, GTEST_10_TUPLE_(T) > {
1103   typedef T1 type;
1104 };
1105 
1106 template <GTEST_10_TYPENAMES_(T)>
1107 struct TupleElement<true, 2, GTEST_10_TUPLE_(T) > {
1108   typedef T2 type;
1109 };
1110 
1111 template <GTEST_10_TYPENAMES_(T)>
1112 struct TupleElement<true, 3, GTEST_10_TUPLE_(T) > {
1113   typedef T3 type;
1114 };
1115 
1116 template <GTEST_10_TYPENAMES_(T)>
1117 struct TupleElement<true, 4, GTEST_10_TUPLE_(T) > {
1118   typedef T4 type;
1119 };
1120 
1121 template <GTEST_10_TYPENAMES_(T)>
1122 struct TupleElement<true, 5, GTEST_10_TUPLE_(T) > {
1123   typedef T5 type;
1124 };
1125 
1126 template <GTEST_10_TYPENAMES_(T)>
1127 struct TupleElement<true, 6, GTEST_10_TUPLE_(T) > {
1128   typedef T6 type;
1129 };
1130 
1131 template <GTEST_10_TYPENAMES_(T)>
1132 struct TupleElement<true, 7, GTEST_10_TUPLE_(T) > {
1133   typedef T7 type;
1134 };
1135 
1136 template <GTEST_10_TYPENAMES_(T)>
1137 struct TupleElement<true, 8, GTEST_10_TUPLE_(T) > {
1138   typedef T8 type;
1139 };
1140 
1141 template <GTEST_10_TYPENAMES_(T)>
1142 struct TupleElement<true, 9, GTEST_10_TUPLE_(T) > {
1143   typedef T9 type;
1144 };
1145 
1146 }  // namespace gtest_internal
1147 
1148 template <>
1149 class tuple<> {
1150  public:
1151   tuple() {}
1152   tuple(const tuple& /* t */)  {}
1153   tuple& operator=(const tuple& /* t */) { return *this; }
1154 };
1155 
1156 template <GTEST_1_TYPENAMES_(T)>
1157 class GTEST_1_TUPLE_(T) {
1158  public:
1159   template <int k> friend class gtest_internal::Get;
1160 
1161   tuple() : f0_() {}
1162 
1163   explicit tuple(GTEST_BY_REF_(T0) f0) : f0_(f0) {}
1164 
1165   tuple(const tuple& t) : f0_(t.f0_) {}
1166 
1167   template <GTEST_1_TYPENAMES_(U)>
1168   tuple(const GTEST_1_TUPLE_(U)& t) : f0_(t.f0_) {}
1169 
1170   tuple& operator=(const tuple& t) { return CopyFrom(t); }
1171 
1172   template <GTEST_1_TYPENAMES_(U)>
1173   tuple& operator=(const GTEST_1_TUPLE_(U)& t) {
1174     return CopyFrom(t);
1175   }
1176 
1177   GTEST_DECLARE_TUPLE_AS_FRIEND_
1178 
1179   template <GTEST_1_TYPENAMES_(U)>
1180   tuple& CopyFrom(const GTEST_1_TUPLE_(U)& t) {
1181     f0_ = t.f0_;
1182     return *this;
1183   }
1184 
1185   T0 f0_;
1186 };
1187 
1188 template <GTEST_2_TYPENAMES_(T)>
1189 class GTEST_2_TUPLE_(T) {
1190  public:
1191   template <int k> friend class gtest_internal::Get;
1192 
1193   tuple() : f0_(), f1_() {}
1194 
1195   explicit tuple(GTEST_BY_REF_(T0) f0, GTEST_BY_REF_(T1) f1) : f0_(f0),
1196       f1_(f1) {}
1197 
1198   tuple(const tuple& t) : f0_(t.f0_), f1_(t.f1_) {}
1199 
1200   template <GTEST_2_TYPENAMES_(U)>
1201   tuple(const GTEST_2_TUPLE_(U)& t) : f0_(t.f0_), f1_(t.f1_) {}
1202   template <typename U0, typename U1>
1203   tuple(const ::std::pair<U0, U1>& p) : f0_(p.first), f1_(p.second) {}
1204 
1205   tuple& operator=(const tuple& t) { return CopyFrom(t); }
1206 
1207   template <GTEST_2_TYPENAMES_(U)>
1208   tuple& operator=(const GTEST_2_TUPLE_(U)& t) {
1209     return CopyFrom(t);
1210   }
1211   template <typename U0, typename U1>
1212   tuple& operator=(const ::std::pair<U0, U1>& p) {
1213     f0_ = p.first;
1214     f1_ = p.second;
1215     return *this;
1216   }
1217 
1218   GTEST_DECLARE_TUPLE_AS_FRIEND_
1219 
1220   template <GTEST_2_TYPENAMES_(U)>
1221   tuple& CopyFrom(const GTEST_2_TUPLE_(U)& t) {
1222     f0_ = t.f0_;
1223     f1_ = t.f1_;
1224     return *this;
1225   }
1226 
1227   T0 f0_;
1228   T1 f1_;
1229 };
1230 
1231 template <GTEST_3_TYPENAMES_(T)>
1232 class GTEST_3_TUPLE_(T) {
1233  public:
1234   template <int k> friend class gtest_internal::Get;
1235 
1236   tuple() : f0_(), f1_(), f2_() {}
1237 
1238   explicit tuple(GTEST_BY_REF_(T0) f0, GTEST_BY_REF_(T1) f1,
1239       GTEST_BY_REF_(T2) f2) : f0_(f0), f1_(f1), f2_(f2) {}
1240 
1241   tuple(const tuple& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_) {}
1242 
1243   template <GTEST_3_TYPENAMES_(U)>
1244   tuple(const GTEST_3_TUPLE_(U)& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_) {}
1245 
1246   tuple& operator=(const tuple& t) { return CopyFrom(t); }
1247 
1248   template <GTEST_3_TYPENAMES_(U)>
1249   tuple& operator=(const GTEST_3_TUPLE_(U)& t) {
1250     return CopyFrom(t);
1251   }
1252 
1253   GTEST_DECLARE_TUPLE_AS_FRIEND_
1254 
1255   template <GTEST_3_TYPENAMES_(U)>
1256   tuple& CopyFrom(const GTEST_3_TUPLE_(U)& t) {
1257     f0_ = t.f0_;
1258     f1_ = t.f1_;
1259     f2_ = t.f2_;
1260     return *this;
1261   }
1262 
1263   T0 f0_;
1264   T1 f1_;
1265   T2 f2_;
1266 };
1267 
1268 template <GTEST_4_TYPENAMES_(T)>
1269 class GTEST_4_TUPLE_(T) {
1270  public:
1271   template <int k> friend class gtest_internal::Get;
1272 
1273   tuple() : f0_(), f1_(), f2_(), f3_() {}
1274 
1275   explicit tuple(GTEST_BY_REF_(T0) f0, GTEST_BY_REF_(T1) f1,
1276       GTEST_BY_REF_(T2) f2, GTEST_BY_REF_(T3) f3) : f0_(f0), f1_(f1), f2_(f2),
1277       f3_(f3) {}
1278 
1279   tuple(const tuple& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_), f3_(t.f3_) {}
1280 
1281   template <GTEST_4_TYPENAMES_(U)>
1282   tuple(const GTEST_4_TUPLE_(U)& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_),
1283       f3_(t.f3_) {}
1284 
1285   tuple& operator=(const tuple& t) { return CopyFrom(t); }
1286 
1287   template <GTEST_4_TYPENAMES_(U)>
1288   tuple& operator=(const GTEST_4_TUPLE_(U)& t) {
1289     return CopyFrom(t);
1290   }
1291 
1292   GTEST_DECLARE_TUPLE_AS_FRIEND_
1293 
1294   template <GTEST_4_TYPENAMES_(U)>
1295   tuple& CopyFrom(const GTEST_4_TUPLE_(U)& t) {
1296     f0_ = t.f0_;
1297     f1_ = t.f1_;
1298     f2_ = t.f2_;
1299     f3_ = t.f3_;
1300     return *this;
1301   }
1302 
1303   T0 f0_;
1304   T1 f1_;
1305   T2 f2_;
1306   T3 f3_;
1307 };
1308 
1309 template <GTEST_5_TYPENAMES_(T)>
1310 class GTEST_5_TUPLE_(T) {
1311  public:
1312   template <int k> friend class gtest_internal::Get;
1313 
1314   tuple() : f0_(), f1_(), f2_(), f3_(), f4_() {}
1315 
1316   explicit tuple(GTEST_BY_REF_(T0) f0, GTEST_BY_REF_(T1) f1,
1317       GTEST_BY_REF_(T2) f2, GTEST_BY_REF_(T3) f3,
1318       GTEST_BY_REF_(T4) f4) : f0_(f0), f1_(f1), f2_(f2), f3_(f3), f4_(f4) {}
1319 
1320   tuple(const tuple& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_), f3_(t.f3_),
1321       f4_(t.f4_) {}
1322 
1323   template <GTEST_5_TYPENAMES_(U)>
1324   tuple(const GTEST_5_TUPLE_(U)& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_),
1325       f3_(t.f3_), f4_(t.f4_) {}
1326 
1327   tuple& operator=(const tuple& t) { return CopyFrom(t); }
1328 
1329   template <GTEST_5_TYPENAMES_(U)>
1330   tuple& operator=(const GTEST_5_TUPLE_(U)& t) {
1331     return CopyFrom(t);
1332   }
1333 
1334   GTEST_DECLARE_TUPLE_AS_FRIEND_
1335 
1336   template <GTEST_5_TYPENAMES_(U)>
1337   tuple& CopyFrom(const GTEST_5_TUPLE_(U)& t) {
1338     f0_ = t.f0_;
1339     f1_ = t.f1_;
1340     f2_ = t.f2_;
1341     f3_ = t.f3_;
1342     f4_ = t.f4_;
1343     return *this;
1344   }
1345 
1346   T0 f0_;
1347   T1 f1_;
1348   T2 f2_;
1349   T3 f3_;
1350   T4 f4_;
1351 };
1352 
1353 template <GTEST_6_TYPENAMES_(T)>
1354 class GTEST_6_TUPLE_(T) {
1355  public:
1356   template <int k> friend class gtest_internal::Get;
1357 
1358   tuple() : f0_(), f1_(), f2_(), f3_(), f4_(), f5_() {}
1359 
1360   explicit tuple(GTEST_BY_REF_(T0) f0, GTEST_BY_REF_(T1) f1,
1361       GTEST_BY_REF_(T2) f2, GTEST_BY_REF_(T3) f3, GTEST_BY_REF_(T4) f4,
1362       GTEST_BY_REF_(T5) f5) : f0_(f0), f1_(f1), f2_(f2), f3_(f3), f4_(f4),
1363       f5_(f5) {}
1364 
1365   tuple(const tuple& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_), f3_(t.f3_),
1366       f4_(t.f4_), f5_(t.f5_) {}
1367 
1368   template <GTEST_6_TYPENAMES_(U)>
1369   tuple(const GTEST_6_TUPLE_(U)& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_),
1370       f3_(t.f3_), f4_(t.f4_), f5_(t.f5_) {}
1371 
1372   tuple& operator=(const tuple& t) { return CopyFrom(t); }
1373 
1374   template <GTEST_6_TYPENAMES_(U)>
1375   tuple& operator=(const GTEST_6_TUPLE_(U)& t) {
1376     return CopyFrom(t);
1377   }
1378 
1379   GTEST_DECLARE_TUPLE_AS_FRIEND_
1380 
1381   template <GTEST_6_TYPENAMES_(U)>
1382   tuple& CopyFrom(const GTEST_6_TUPLE_(U)& t) {
1383     f0_ = t.f0_;
1384     f1_ = t.f1_;
1385     f2_ = t.f2_;
1386     f3_ = t.f3_;
1387     f4_ = t.f4_;
1388     f5_ = t.f5_;
1389     return *this;
1390   }
1391 
1392   T0 f0_;
1393   T1 f1_;
1394   T2 f2_;
1395   T3 f3_;
1396   T4 f4_;
1397   T5 f5_;
1398 };
1399 
1400 template <GTEST_7_TYPENAMES_(T)>
1401 class GTEST_7_TUPLE_(T) {
1402  public:
1403   template <int k> friend class gtest_internal::Get;
1404 
1405   tuple() : f0_(), f1_(), f2_(), f3_(), f4_(), f5_(), f6_() {}
1406 
1407   explicit tuple(GTEST_BY_REF_(T0) f0, GTEST_BY_REF_(T1) f1,
1408       GTEST_BY_REF_(T2) f2, GTEST_BY_REF_(T3) f3, GTEST_BY_REF_(T4) f4,
1409       GTEST_BY_REF_(T5) f5, GTEST_BY_REF_(T6) f6) : f0_(f0), f1_(f1), f2_(f2),
1410       f3_(f3), f4_(f4), f5_(f5), f6_(f6) {}
1411 
1412   tuple(const tuple& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_), f3_(t.f3_),
1413       f4_(t.f4_), f5_(t.f5_), f6_(t.f6_) {}
1414 
1415   template <GTEST_7_TYPENAMES_(U)>
1416   tuple(const GTEST_7_TUPLE_(U)& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_),
1417       f3_(t.f3_), f4_(t.f4_), f5_(t.f5_), f6_(t.f6_) {}
1418 
1419   tuple& operator=(const tuple& t) { return CopyFrom(t); }
1420 
1421   template <GTEST_7_TYPENAMES_(U)>
1422   tuple& operator=(const GTEST_7_TUPLE_(U)& t) {
1423     return CopyFrom(t);
1424   }
1425 
1426   GTEST_DECLARE_TUPLE_AS_FRIEND_
1427 
1428   template <GTEST_7_TYPENAMES_(U)>
1429   tuple& CopyFrom(const GTEST_7_TUPLE_(U)& t) {
1430     f0_ = t.f0_;
1431     f1_ = t.f1_;
1432     f2_ = t.f2_;
1433     f3_ = t.f3_;
1434     f4_ = t.f4_;
1435     f5_ = t.f5_;
1436     f6_ = t.f6_;
1437     return *this;
1438   }
1439 
1440   T0 f0_;
1441   T1 f1_;
1442   T2 f2_;
1443   T3 f3_;
1444   T4 f4_;
1445   T5 f5_;
1446   T6 f6_;
1447 };
1448 
1449 template <GTEST_8_TYPENAMES_(T)>
1450 class GTEST_8_TUPLE_(T) {
1451  public:
1452   template <int k> friend class gtest_internal::Get;
1453 
1454   tuple() : f0_(), f1_(), f2_(), f3_(), f4_(), f5_(), f6_(), f7_() {}
1455 
1456   explicit tuple(GTEST_BY_REF_(T0) f0, GTEST_BY_REF_(T1) f1,
1457       GTEST_BY_REF_(T2) f2, GTEST_BY_REF_(T3) f3, GTEST_BY_REF_(T4) f4,
1458       GTEST_BY_REF_(T5) f5, GTEST_BY_REF_(T6) f6,
1459       GTEST_BY_REF_(T7) f7) : f0_(f0), f1_(f1), f2_(f2), f3_(f3), f4_(f4),
1460       f5_(f5), f6_(f6), f7_(f7) {}
1461 
1462   tuple(const tuple& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_), f3_(t.f3_),
1463       f4_(t.f4_), f5_(t.f5_), f6_(t.f6_), f7_(t.f7_) {}
1464 
1465   template <GTEST_8_TYPENAMES_(U)>
1466   tuple(const GTEST_8_TUPLE_(U)& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_),
1467       f3_(t.f3_), f4_(t.f4_), f5_(t.f5_), f6_(t.f6_), f7_(t.f7_) {}
1468 
1469   tuple& operator=(const tuple& t) { return CopyFrom(t); }
1470 
1471   template <GTEST_8_TYPENAMES_(U)>
1472   tuple& operator=(const GTEST_8_TUPLE_(U)& t) {
1473     return CopyFrom(t);
1474   }
1475 
1476   GTEST_DECLARE_TUPLE_AS_FRIEND_
1477 
1478   template <GTEST_8_TYPENAMES_(U)>
1479   tuple& CopyFrom(const GTEST_8_TUPLE_(U)& t) {
1480     f0_ = t.f0_;
1481     f1_ = t.f1_;
1482     f2_ = t.f2_;
1483     f3_ = t.f3_;
1484     f4_ = t.f4_;
1485     f5_ = t.f5_;
1486     f6_ = t.f6_;
1487     f7_ = t.f7_;
1488     return *this;
1489   }
1490 
1491   T0 f0_;
1492   T1 f1_;
1493   T2 f2_;
1494   T3 f3_;
1495   T4 f4_;
1496   T5 f5_;
1497   T6 f6_;
1498   T7 f7_;
1499 };
1500 
1501 template <GTEST_9_TYPENAMES_(T)>
1502 class GTEST_9_TUPLE_(T) {
1503  public:
1504   template <int k> friend class gtest_internal::Get;
1505 
1506   tuple() : f0_(), f1_(), f2_(), f3_(), f4_(), f5_(), f6_(), f7_(), f8_() {}
1507 
1508   explicit tuple(GTEST_BY_REF_(T0) f0, GTEST_BY_REF_(T1) f1,
1509       GTEST_BY_REF_(T2) f2, GTEST_BY_REF_(T3) f3, GTEST_BY_REF_(T4) f4,
1510       GTEST_BY_REF_(T5) f5, GTEST_BY_REF_(T6) f6, GTEST_BY_REF_(T7) f7,
1511       GTEST_BY_REF_(T8) f8) : f0_(f0), f1_(f1), f2_(f2), f3_(f3), f4_(f4),
1512       f5_(f5), f6_(f6), f7_(f7), f8_(f8) {}
1513 
1514   tuple(const tuple& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_), f3_(t.f3_),
1515       f4_(t.f4_), f5_(t.f5_), f6_(t.f6_), f7_(t.f7_), f8_(t.f8_) {}
1516 
1517   template <GTEST_9_TYPENAMES_(U)>
1518   tuple(const GTEST_9_TUPLE_(U)& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_),
1519       f3_(t.f3_), f4_(t.f4_), f5_(t.f5_), f6_(t.f6_), f7_(t.f7_), f8_(t.f8_) {}
1520 
1521   tuple& operator=(const tuple& t) { return CopyFrom(t); }
1522 
1523   template <GTEST_9_TYPENAMES_(U)>
1524   tuple& operator=(const GTEST_9_TUPLE_(U)& t) {
1525     return CopyFrom(t);
1526   }
1527 
1528   GTEST_DECLARE_TUPLE_AS_FRIEND_
1529 
1530   template <GTEST_9_TYPENAMES_(U)>
1531   tuple& CopyFrom(const GTEST_9_TUPLE_(U)& t) {
1532     f0_ = t.f0_;
1533     f1_ = t.f1_;
1534     f2_ = t.f2_;
1535     f3_ = t.f3_;
1536     f4_ = t.f4_;
1537     f5_ = t.f5_;
1538     f6_ = t.f6_;
1539     f7_ = t.f7_;
1540     f8_ = t.f8_;
1541     return *this;
1542   }
1543 
1544   T0 f0_;
1545   T1 f1_;
1546   T2 f2_;
1547   T3 f3_;
1548   T4 f4_;
1549   T5 f5_;
1550   T6 f6_;
1551   T7 f7_;
1552   T8 f8_;
1553 };
1554 
1555 template <GTEST_10_TYPENAMES_(T)>
1556 class tuple {
1557  public:
1558   template <int k> friend class gtest_internal::Get;
1559 
1560   tuple() : f0_(), f1_(), f2_(), f3_(), f4_(), f5_(), f6_(), f7_(), f8_(),
1561       f9_() {}
1562 
1563   explicit tuple(GTEST_BY_REF_(T0) f0, GTEST_BY_REF_(T1) f1,
1564       GTEST_BY_REF_(T2) f2, GTEST_BY_REF_(T3) f3, GTEST_BY_REF_(T4) f4,
1565       GTEST_BY_REF_(T5) f5, GTEST_BY_REF_(T6) f6, GTEST_BY_REF_(T7) f7,
1566       GTEST_BY_REF_(T8) f8, GTEST_BY_REF_(T9) f9) : f0_(f0), f1_(f1), f2_(f2),
1567       f3_(f3), f4_(f4), f5_(f5), f6_(f6), f7_(f7), f8_(f8), f9_(f9) {}
1568 
1569   tuple(const tuple& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_), f3_(t.f3_),
1570       f4_(t.f4_), f5_(t.f5_), f6_(t.f6_), f7_(t.f7_), f8_(t.f8_), f9_(t.f9_) {}
1571 
1572   template <GTEST_10_TYPENAMES_(U)>
1573   tuple(const GTEST_10_TUPLE_(U)& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_),
1574       f3_(t.f3_), f4_(t.f4_), f5_(t.f5_), f6_(t.f6_), f7_(t.f7_), f8_(t.f8_),
1575       f9_(t.f9_) {}
1576 
1577   tuple& operator=(const tuple& t) { return CopyFrom(t); }
1578 
1579   template <GTEST_10_TYPENAMES_(U)>
1580   tuple& operator=(const GTEST_10_TUPLE_(U)& t) {
1581     return CopyFrom(t);
1582   }
1583 
1584   GTEST_DECLARE_TUPLE_AS_FRIEND_
1585 
1586   template <GTEST_10_TYPENAMES_(U)>
1587   tuple& CopyFrom(const GTEST_10_TUPLE_(U)& t) {
1588     f0_ = t.f0_;
1589     f1_ = t.f1_;
1590     f2_ = t.f2_;
1591     f3_ = t.f3_;
1592     f4_ = t.f4_;
1593     f5_ = t.f5_;
1594     f6_ = t.f6_;
1595     f7_ = t.f7_;
1596     f8_ = t.f8_;
1597     f9_ = t.f9_;
1598     return *this;
1599   }
1600 
1601   T0 f0_;
1602   T1 f1_;
1603   T2 f2_;
1604   T3 f3_;
1605   T4 f4_;
1606   T5 f5_;
1607   T6 f6_;
1608   T7 f7_;
1609   T8 f8_;
1610   T9 f9_;
1611 };
1612 
1613 // 6.1.3.2 Tuple creation functions.
1614 
1615 // Known limitations: we don't support passing an
1616 // std::tr1::reference_wrapper<T> to make_tuple().  And we don't
1617 // implement tie().
1618 
1619 inline tuple<> make_tuple() { return tuple<>(); }
1620 
1621 template <GTEST_1_TYPENAMES_(T)>
1622 inline GTEST_1_TUPLE_(T) make_tuple(const T0& f0) {
1623   return GTEST_1_TUPLE_(T)(f0);
1624 }
1625 
1626 template <GTEST_2_TYPENAMES_(T)>
1627 inline GTEST_2_TUPLE_(T) make_tuple(const T0& f0, const T1& f1) {
1628   return GTEST_2_TUPLE_(T)(f0, f1);
1629 }
1630 
1631 template <GTEST_3_TYPENAMES_(T)>
1632 inline GTEST_3_TUPLE_(T) make_tuple(const T0& f0, const T1& f1, const T2& f2) {
1633   return GTEST_3_TUPLE_(T)(f0, f1, f2);
1634 }
1635 
1636 template <GTEST_4_TYPENAMES_(T)>
1637 inline GTEST_4_TUPLE_(T) make_tuple(const T0& f0, const T1& f1, const T2& f2,
1638     const T3& f3) {
1639   return GTEST_4_TUPLE_(T)(f0, f1, f2, f3);
1640 }
1641 
1642 template <GTEST_5_TYPENAMES_(T)>
1643 inline GTEST_5_TUPLE_(T) make_tuple(const T0& f0, const T1& f1, const T2& f2,
1644     const T3& f3, const T4& f4) {
1645   return GTEST_5_TUPLE_(T)(f0, f1, f2, f3, f4);
1646 }
1647 
1648 template <GTEST_6_TYPENAMES_(T)>
1649 inline GTEST_6_TUPLE_(T) make_tuple(const T0& f0, const T1& f1, const T2& f2,
1650     const T3& f3, const T4& f4, const T5& f5) {
1651   return GTEST_6_TUPLE_(T)(f0, f1, f2, f3, f4, f5);
1652 }
1653 
1654 template <GTEST_7_TYPENAMES_(T)>
1655 inline GTEST_7_TUPLE_(T) make_tuple(const T0& f0, const T1& f1, const T2& f2,
1656     const T3& f3, const T4& f4, const T5& f5, const T6& f6) {
1657   return GTEST_7_TUPLE_(T)(f0, f1, f2, f3, f4, f5, f6);
1658 }
1659 
1660 template <GTEST_8_TYPENAMES_(T)>
1661 inline GTEST_8_TUPLE_(T) make_tuple(const T0& f0, const T1& f1, const T2& f2,
1662     const T3& f3, const T4& f4, const T5& f5, const T6& f6, const T7& f7) {
1663   return GTEST_8_TUPLE_(T)(f0, f1, f2, f3, f4, f5, f6, f7);
1664 }
1665 
1666 template <GTEST_9_TYPENAMES_(T)>
1667 inline GTEST_9_TUPLE_(T) make_tuple(const T0& f0, const T1& f1, const T2& f2,
1668     const T3& f3, const T4& f4, const T5& f5, const T6& f6, const T7& f7,
1669     const T8& f8) {
1670   return GTEST_9_TUPLE_(T)(f0, f1, f2, f3, f4, f5, f6, f7, f8);
1671 }
1672 
1673 template <GTEST_10_TYPENAMES_(T)>
1674 inline GTEST_10_TUPLE_(T) make_tuple(const T0& f0, const T1& f1, const T2& f2,
1675     const T3& f3, const T4& f4, const T5& f5, const T6& f6, const T7& f7,
1676     const T8& f8, const T9& f9) {
1677   return GTEST_10_TUPLE_(T)(f0, f1, f2, f3, f4, f5, f6, f7, f8, f9);
1678 }
1679 
1680 // 6.1.3.3 Tuple helper classes.
1681 
1682 template <typename Tuple> struct tuple_size;
1683 
1684 template <GTEST_0_TYPENAMES_(T)>
1685 struct tuple_size<GTEST_0_TUPLE_(T) > {
1686   static const int value = 0;
1687 };
1688 
1689 template <GTEST_1_TYPENAMES_(T)>
1690 struct tuple_size<GTEST_1_TUPLE_(T) > {
1691   static const int value = 1;
1692 };
1693 
1694 template <GTEST_2_TYPENAMES_(T)>
1695 struct tuple_size<GTEST_2_TUPLE_(T) > {
1696   static const int value = 2;
1697 };
1698 
1699 template <GTEST_3_TYPENAMES_(T)>
1700 struct tuple_size<GTEST_3_TUPLE_(T) > {
1701   static const int value = 3;
1702 };
1703 
1704 template <GTEST_4_TYPENAMES_(T)>
1705 struct tuple_size<GTEST_4_TUPLE_(T) > {
1706   static const int value = 4;
1707 };
1708 
1709 template <GTEST_5_TYPENAMES_(T)>
1710 struct tuple_size<GTEST_5_TUPLE_(T) > {
1711   static const int value = 5;
1712 };
1713 
1714 template <GTEST_6_TYPENAMES_(T)>
1715 struct tuple_size<GTEST_6_TUPLE_(T) > {
1716   static const int value = 6;
1717 };
1718 
1719 template <GTEST_7_TYPENAMES_(T)>
1720 struct tuple_size<GTEST_7_TUPLE_(T) > {
1721   static const int value = 7;
1722 };
1723 
1724 template <GTEST_8_TYPENAMES_(T)>
1725 struct tuple_size<GTEST_8_TUPLE_(T) > {
1726   static const int value = 8;
1727 };
1728 
1729 template <GTEST_9_TYPENAMES_(T)>
1730 struct tuple_size<GTEST_9_TUPLE_(T) > {
1731   static const int value = 9;
1732 };
1733 
1734 template <GTEST_10_TYPENAMES_(T)>
1735 struct tuple_size<GTEST_10_TUPLE_(T) > {
1736   static const int value = 10;
1737 };
1738 
1739 template <int k, class Tuple>
1740 struct tuple_element {
1741   typedef typename gtest_internal::TupleElement<
1742       k < (tuple_size<Tuple>::value), k, Tuple>::type type;
1743 };
1744 
1745 #define GTEST_TUPLE_ELEMENT_(k, Tuple) typename tuple_element<k, Tuple >::type
1746 
1747 // 6.1.3.4 Element access.
1748 
1749 namespace gtest_internal {
1750 
1751 template <>
1752 class Get<0> {
1753  public:
1754   template <class Tuple>
1755   static GTEST_ADD_REF_(GTEST_TUPLE_ELEMENT_(0, Tuple))
1756   Field(Tuple& t) { return t.f0_; }  // NOLINT
1757 
1758   template <class Tuple>
1759   static GTEST_BY_REF_(GTEST_TUPLE_ELEMENT_(0, Tuple))
1760   ConstField(const Tuple& t) { return t.f0_; }
1761 };
1762 
1763 template <>
1764 class Get<1> {
1765  public:
1766   template <class Tuple>
1767   static GTEST_ADD_REF_(GTEST_TUPLE_ELEMENT_(1, Tuple))
1768   Field(Tuple& t) { return t.f1_; }  // NOLINT
1769 
1770   template <class Tuple>
1771   static GTEST_BY_REF_(GTEST_TUPLE_ELEMENT_(1, Tuple))
1772   ConstField(const Tuple& t) { return t.f1_; }
1773 };
1774 
1775 template <>
1776 class Get<2> {
1777  public:
1778   template <class Tuple>
1779   static GTEST_ADD_REF_(GTEST_TUPLE_ELEMENT_(2, Tuple))
1780   Field(Tuple& t) { return t.f2_; }  // NOLINT
1781 
1782   template <class Tuple>
1783   static GTEST_BY_REF_(GTEST_TUPLE_ELEMENT_(2, Tuple))
1784   ConstField(const Tuple& t) { return t.f2_; }
1785 };
1786 
1787 template <>
1788 class Get<3> {
1789  public:
1790   template <class Tuple>
1791   static GTEST_ADD_REF_(GTEST_TUPLE_ELEMENT_(3, Tuple))
1792   Field(Tuple& t) { return t.f3_; }  // NOLINT
1793 
1794   template <class Tuple>
1795   static GTEST_BY_REF_(GTEST_TUPLE_ELEMENT_(3, Tuple))
1796   ConstField(const Tuple& t) { return t.f3_; }
1797 };
1798 
1799 template <>
1800 class Get<4> {
1801  public:
1802   template <class Tuple>
1803   static GTEST_ADD_REF_(GTEST_TUPLE_ELEMENT_(4, Tuple))
1804   Field(Tuple& t) { return t.f4_; }  // NOLINT
1805 
1806   template <class Tuple>
1807   static GTEST_BY_REF_(GTEST_TUPLE_ELEMENT_(4, Tuple))
1808   ConstField(const Tuple& t) { return t.f4_; }
1809 };
1810 
1811 template <>
1812 class Get<5> {
1813  public:
1814   template <class Tuple>
1815   static GTEST_ADD_REF_(GTEST_TUPLE_ELEMENT_(5, Tuple))
1816   Field(Tuple& t) { return t.f5_; }  // NOLINT
1817 
1818   template <class Tuple>
1819   static GTEST_BY_REF_(GTEST_TUPLE_ELEMENT_(5, Tuple))
1820   ConstField(const Tuple& t) { return t.f5_; }
1821 };
1822 
1823 template <>
1824 class Get<6> {
1825  public:
1826   template <class Tuple>
1827   static GTEST_ADD_REF_(GTEST_TUPLE_ELEMENT_(6, Tuple))
1828   Field(Tuple& t) { return t.f6_; }  // NOLINT
1829 
1830   template <class Tuple>
1831   static GTEST_BY_REF_(GTEST_TUPLE_ELEMENT_(6, Tuple))
1832   ConstField(const Tuple& t) { return t.f6_; }
1833 };
1834 
1835 template <>
1836 class Get<7> {
1837  public:
1838   template <class Tuple>
1839   static GTEST_ADD_REF_(GTEST_TUPLE_ELEMENT_(7, Tuple))
1840   Field(Tuple& t) { return t.f7_; }  // NOLINT
1841 
1842   template <class Tuple>
1843   static GTEST_BY_REF_(GTEST_TUPLE_ELEMENT_(7, Tuple))
1844   ConstField(const Tuple& t) { return t.f7_; }
1845 };
1846 
1847 template <>
1848 class Get<8> {
1849  public:
1850   template <class Tuple>
1851   static GTEST_ADD_REF_(GTEST_TUPLE_ELEMENT_(8, Tuple))
1852   Field(Tuple& t) { return t.f8_; }  // NOLINT
1853 
1854   template <class Tuple>
1855   static GTEST_BY_REF_(GTEST_TUPLE_ELEMENT_(8, Tuple))
1856   ConstField(const Tuple& t) { return t.f8_; }
1857 };
1858 
1859 template <>
1860 class Get<9> {
1861  public:
1862   template <class Tuple>
1863   static GTEST_ADD_REF_(GTEST_TUPLE_ELEMENT_(9, Tuple))
1864   Field(Tuple& t) { return t.f9_; }  // NOLINT
1865 
1866   template <class Tuple>
1867   static GTEST_BY_REF_(GTEST_TUPLE_ELEMENT_(9, Tuple))
1868   ConstField(const Tuple& t) { return t.f9_; }
1869 };
1870 
1871 }  // namespace gtest_internal
1872 
1873 template <int k, GTEST_10_TYPENAMES_(T)>
1874 GTEST_ADD_REF_(GTEST_TUPLE_ELEMENT_(k, GTEST_10_TUPLE_(T)))
1875 get(GTEST_10_TUPLE_(T)& t) {
1876   return gtest_internal::Get<k>::Field(t);
1877 }
1878 
1879 template <int k, GTEST_10_TYPENAMES_(T)>
1880 GTEST_BY_REF_(GTEST_TUPLE_ELEMENT_(k,  GTEST_10_TUPLE_(T)))
1881 get(const GTEST_10_TUPLE_(T)& t) {
1882   return gtest_internal::Get<k>::ConstField(t);
1883 }
1884 
1885 // 6.1.3.5 Relational operators
1886 
1887 // We only implement == and !=, as we don't have a need for the rest yet.
1888 
1889 namespace gtest_internal {
1890 
1891 // SameSizeTuplePrefixComparator<k, k>::Eq(t1, t2) returns true if the
1892 // first k fields of t1 equals the first k fields of t2.
1893 // SameSizeTuplePrefixComparator(k1, k2) would be a compiler error if
1894 // k1 != k2.
1895 template <int kSize1, int kSize2>
1896 struct SameSizeTuplePrefixComparator;
1897 
1898 template <>
1899 struct SameSizeTuplePrefixComparator<0, 0> {
1900   template <class Tuple1, class Tuple2>
1901   static bool Eq(const Tuple1& /* t1 */, const Tuple2& /* t2 */) {
1902     return true;
1903   }
1904 };
1905 
1906 template <int k>
1907 struct SameSizeTuplePrefixComparator<k, k> {
1908   template <class Tuple1, class Tuple2>
1909   static bool Eq(const Tuple1& t1, const Tuple2& t2) {
1910     return SameSizeTuplePrefixComparator<k - 1, k - 1>::Eq(t1, t2) &&
1911         ::std::tr1::get<k - 1>(t1) == ::std::tr1::get<k - 1>(t2);
1912   }
1913 };
1914 
1915 }  // namespace gtest_internal
1916 
1917 template <GTEST_10_TYPENAMES_(T), GTEST_10_TYPENAMES_(U)>
1918 inline bool operator==(const GTEST_10_TUPLE_(T)& t,
1919                        const GTEST_10_TUPLE_(U)& u) {
1920   return gtest_internal::SameSizeTuplePrefixComparator<
1921       tuple_size<GTEST_10_TUPLE_(T) >::value,
1922       tuple_size<GTEST_10_TUPLE_(U) >::value>::Eq(t, u);
1923 }
1924 
1925 template <GTEST_10_TYPENAMES_(T), GTEST_10_TYPENAMES_(U)>
1926 inline bool operator!=(const GTEST_10_TUPLE_(T)& t,
1927                        const GTEST_10_TUPLE_(U)& u) { return !(t == u); }
1928 
1929 // 6.1.4 Pairs.
1930 // Unimplemented.
1931 
1932 }  // namespace tr1
1933 }  // namespace std
1934 
1935 #undef GTEST_0_TUPLE_
1936 #undef GTEST_1_TUPLE_
1937 #undef GTEST_2_TUPLE_
1938 #undef GTEST_3_TUPLE_
1939 #undef GTEST_4_TUPLE_
1940 #undef GTEST_5_TUPLE_
1941 #undef GTEST_6_TUPLE_
1942 #undef GTEST_7_TUPLE_
1943 #undef GTEST_8_TUPLE_
1944 #undef GTEST_9_TUPLE_
1945 #undef GTEST_10_TUPLE_
1946 
1947 #undef GTEST_0_TYPENAMES_
1948 #undef GTEST_1_TYPENAMES_
1949 #undef GTEST_2_TYPENAMES_
1950 #undef GTEST_3_TYPENAMES_
1951 #undef GTEST_4_TYPENAMES_
1952 #undef GTEST_5_TYPENAMES_
1953 #undef GTEST_6_TYPENAMES_
1954 #undef GTEST_7_TYPENAMES_
1955 #undef GTEST_8_TYPENAMES_
1956 #undef GTEST_9_TYPENAMES_
1957 #undef GTEST_10_TYPENAMES_
1958 
1959 #undef GTEST_DECLARE_TUPLE_AS_FRIEND_
1960 #undef GTEST_BY_REF_
1961 #undef GTEST_ADD_REF_
1962 #undef GTEST_TUPLE_ELEMENT_
1963 
1964 #endif  // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_TUPLE_H_
1965 # elif GTEST_ENV_HAS_STD_TUPLE_
1966 #  include <tuple>
1967 // C++11 puts its tuple into the ::std namespace rather than
1968 // ::std::tr1.  gtest expects tuple to live in ::std::tr1, so put it there.
1969 // This causes undefined behavior, but supported compilers react in
1970 // the way we intend.
1971 namespace std {
1972 namespace tr1 {
1973 using ::std::get;
1974 using ::std::make_tuple;
1975 using ::std::tuple;
1976 using ::std::tuple_element;
1977 using ::std::tuple_size;
1978 }
1979 }
1980 
1981 # elif GTEST_OS_SYMBIAN
1982 
1983 // On Symbian, BOOST_HAS_TR1_TUPLE causes Boost's TR1 tuple library to
1984 // use STLport's tuple implementation, which unfortunately doesn't
1985 // work as the copy of STLport distributed with Symbian is incomplete.
1986 // By making sure BOOST_HAS_TR1_TUPLE is undefined, we force Boost to
1987 // use its own tuple implementation.
1988 #  ifdef BOOST_HAS_TR1_TUPLE
1989 #   undef BOOST_HAS_TR1_TUPLE
1990 #  endif  // BOOST_HAS_TR1_TUPLE
1991 
1992 // This prevents <boost/tr1/detail/config.hpp>, which defines
1993 // BOOST_HAS_TR1_TUPLE, from being #included by Boost's <tuple>.
1994 #  define BOOST_TR1_DETAIL_CONFIG_HPP_INCLUDED
1995 #  include <tuple>  // IWYU pragma: export  // NOLINT
1996 
1997 # elif defined(__GNUC__) && (GTEST_GCC_VER_ >= 40000)
1998 // GCC 4.0+ implements tr1/tuple in the <tr1/tuple> header.  This does
1999 // not conform to the TR1 spec, which requires the header to be <tuple>.
2000 
2001 #  if !GTEST_HAS_RTTI && GTEST_GCC_VER_ < 40302
2002 // Until version 4.3.2, gcc has a bug that causes <tr1/functional>,
2003 // which is #included by <tr1/tuple>, to not compile when RTTI is
2004 // disabled.  _TR1_FUNCTIONAL is the header guard for
2005 // <tr1/functional>.  Hence the following #define is a hack to prevent
2006 // <tr1/functional> from being included.
2007 #   define _TR1_FUNCTIONAL 1
2008 #   include <tr1/tuple>
2009 #   undef _TR1_FUNCTIONAL  // Allows the user to #include
2010                         // <tr1/functional> if he chooses to.
2011 #  else
2012 #   include <tr1/tuple>  // NOLINT
2013 #  endif  // !GTEST_HAS_RTTI && GTEST_GCC_VER_ < 40302
2014 
2015 # else
2016 // If the compiler is not GCC 4.0+, we assume the user is using a
2017 // spec-conforming TR1 implementation.
2018 #  include <tuple>  // IWYU pragma: export  // NOLINT
2019 # endif  // GTEST_USE_OWN_TR1_TUPLE
2020 
2021 #endif  // GTEST_HAS_TR1_TUPLE
2022 
2023 // Determines whether clone(2) is supported.
2024 // Usually it will only be available on Linux, excluding
2025 // Linux on the Itanium architecture.
2026 // Also see http://linux.die.net/man/2/clone.
2027 #ifndef GTEST_HAS_CLONE
2028 // The user didn't tell us, so we need to figure it out.
2029 
2030 # if GTEST_OS_LINUX && !defined(__ia64__)
2031 #  if GTEST_OS_LINUX_ANDROID
2032 // On Android, clone() is only available on ARM starting with Gingerbread.
2033 #    if defined(__arm__) && __ANDROID_API__ >= 9
2034 #     define GTEST_HAS_CLONE 1
2035 #    else
2036 #     define GTEST_HAS_CLONE 0
2037 #    endif
2038 #  else
2039 #   define GTEST_HAS_CLONE 1
2040 #  endif
2041 # else
2042 #  define GTEST_HAS_CLONE 0
2043 # endif  // GTEST_OS_LINUX && !defined(__ia64__)
2044 
2045 #endif  // GTEST_HAS_CLONE
2046 
2047 // Determines whether to support stream redirection. This is used to test
2048 // output correctness and to implement death tests.
2049 #ifndef GTEST_HAS_STREAM_REDIRECTION
2050 // By default, we assume that stream redirection is supported on all
2051 // platforms except known mobile ones.
2052 # if GTEST_OS_WINDOWS_MOBILE || GTEST_OS_SYMBIAN || \
2053     GTEST_OS_WINDOWS_PHONE || GTEST_OS_WINDOWS_RT
2054 #  define GTEST_HAS_STREAM_REDIRECTION 0
2055 # else
2056 #  define GTEST_HAS_STREAM_REDIRECTION 1
2057 # endif  // !GTEST_OS_WINDOWS_MOBILE && !GTEST_OS_SYMBIAN
2058 #endif  // GTEST_HAS_STREAM_REDIRECTION
2059 
2060 // Determines whether to support death tests.
2061 // Google Test does not support death tests for VC 7.1 and earlier as
2062 // abort() in a VC 7.1 application compiled as GUI in debug config
2063 // pops up a dialog window that cannot be suppressed programmatically.
2064 #if (GTEST_OS_LINUX || GTEST_OS_CYGWIN || GTEST_OS_SOLARIS || \
2065      (GTEST_OS_MAC && !GTEST_OS_IOS) || \
2066      (GTEST_OS_WINDOWS_DESKTOP && _MSC_VER >= 1400) || \
2067      GTEST_OS_WINDOWS_MINGW || GTEST_OS_AIX || GTEST_OS_HPUX || \
2068      GTEST_OS_OPENBSD || GTEST_OS_QNX || GTEST_OS_FREEBSD)
2069 # define GTEST_HAS_DEATH_TEST 1
2070 #endif
2071 
2072 // We don't support MSVC 7.1 with exceptions disabled now.  Therefore
2073 // all the compilers we care about are adequate for supporting
2074 // value-parameterized tests.
2075 #define GTEST_HAS_PARAM_TEST 1
2076 
2077 // Determines whether to support type-driven tests.
2078 
2079 // Typed tests need <typeinfo> and variadic macros, which GCC, VC++ 8.0,
2080 // Sun Pro CC, IBM Visual Age, and HP aCC support.
2081 #if defined(__GNUC__) || (_MSC_VER >= 1400) || defined(__SUNPRO_CC) || \
2082     defined(__IBMCPP__) || defined(__HP_aCC)
2083 # define GTEST_HAS_TYPED_TEST 1
2084 # define GTEST_HAS_TYPED_TEST_P 1
2085 #endif
2086 
2087 // Determines whether to support Combine(). This only makes sense when
2088 // value-parameterized tests are enabled.  The implementation doesn't
2089 // work on Sun Studio since it doesn't understand templated conversion
2090 // operators.
2091 #if GTEST_HAS_PARAM_TEST && GTEST_HAS_TR1_TUPLE && !defined(__SUNPRO_CC)
2092 # define GTEST_HAS_COMBINE 1
2093 #endif
2094 
2095 // Determines whether the system compiler uses UTF-16 for encoding wide strings.
2096 #define GTEST_WIDE_STRING_USES_UTF16_ \
2097     (GTEST_OS_WINDOWS || GTEST_OS_CYGWIN || GTEST_OS_SYMBIAN || GTEST_OS_AIX)
2098 
2099 // Determines whether test results can be streamed to a socket.
2100 #if GTEST_OS_LINUX
2101 # define GTEST_CAN_STREAM_RESULTS_ 1
2102 #endif
2103 
2104 // Defines some utility macros.
2105 
2106 // The GNU compiler emits a warning if nested "if" statements are followed by
2107 // an "else" statement and braces are not used to explicitly disambiguate the
2108 // "else" binding.  This leads to problems with code like:
2109 //
2110 //   if (gate)
2111 //     ASSERT_*(condition) << "Some message";
2112 //
2113 // The "switch (0) case 0:" idiom is used to suppress this.
2114 #ifdef __INTEL_COMPILER
2115 # define GTEST_AMBIGUOUS_ELSE_BLOCKER_
2116 #else
2117 # define GTEST_AMBIGUOUS_ELSE_BLOCKER_ switch (0) case 0: default:  // NOLINT
2118 #endif
2119 
2120 // Use this annotation at the end of a struct/class definition to
2121 // prevent the compiler from optimizing away instances that are never
2122 // used.  This is useful when all interesting logic happens inside the
2123 // c'tor and / or d'tor.  Example:
2124 //
2125 //   struct Foo {
2126 //     Foo() { ... }
2127 //   } GTEST_ATTRIBUTE_UNUSED_;
2128 //
2129 // Also use it after a variable or parameter declaration to tell the
2130 // compiler the variable/parameter does not have to be used.
2131 #if defined(__GNUC__) && !defined(COMPILER_ICC)
2132 # define GTEST_ATTRIBUTE_UNUSED_ __attribute__ ((unused))
2133 #elif defined(__clang__)
2134 # if __has_attribute(unused)
2135 #  define GTEST_ATTRIBUTE_UNUSED_ __attribute__ ((unused))
2136 # endif
2137 #endif
2138 #ifndef GTEST_ATTRIBUTE_UNUSED_
2139 # define GTEST_ATTRIBUTE_UNUSED_
2140 #endif
2141 
2142 // A macro to disallow operator=
2143 // This should be used in the private: declarations for a class.
2144 #define GTEST_DISALLOW_ASSIGN_(type)\
2145   void operator=(type const &)
2146 
2147 // A macro to disallow copy constructor and operator=
2148 // This should be used in the private: declarations for a class.
2149 #define GTEST_DISALLOW_COPY_AND_ASSIGN_(type)\
2150   type(type const &);\
2151   GTEST_DISALLOW_ASSIGN_(type)
2152 
2153 // Tell the compiler to warn about unused return values for functions declared
2154 // with this macro.  The macro should be used on function declarations
2155 // following the argument list:
2156 //
2157 //   Sprocket* AllocateSprocket() GTEST_MUST_USE_RESULT_;
2158 #if defined(__GNUC__) && (GTEST_GCC_VER_ >= 30400) && !defined(COMPILER_ICC)
2159 # define GTEST_MUST_USE_RESULT_ __attribute__ ((warn_unused_result))
2160 #else
2161 # define GTEST_MUST_USE_RESULT_
2162 #endif  // __GNUC__ && (GTEST_GCC_VER_ >= 30400) && !COMPILER_ICC
2163 
2164 // MS C++ compiler emits warning when a conditional expression is compile time
2165 // constant. In some contexts this warning is false positive and needs to be
2166 // suppressed. Use the following two macros in such cases:
2167 //
2168 // GTEST_INTENTIONAL_CONST_COND_PUSH_()
2169 // while (true) {
2170 // GTEST_INTENTIONAL_CONST_COND_POP_()
2171 // }
2172 # define GTEST_INTENTIONAL_CONST_COND_PUSH_() \
2173     GTEST_DISABLE_MSC_WARNINGS_PUSH_(4127)
2174 # define GTEST_INTENTIONAL_CONST_COND_POP_() \
2175     GTEST_DISABLE_MSC_WARNINGS_POP_()
2176 
2177 // Determine whether the compiler supports Microsoft's Structured Exception
2178 // Handling.  This is supported by several Windows compilers but generally
2179 // does not exist on any other system.
2180 #ifndef GTEST_HAS_SEH
2181 // The user didn't tell us, so we need to figure it out.
2182 
2183 # if defined(_MSC_VER) || defined(__BORLANDC__)
2184 // These two compilers are known to support SEH.
2185 #  define GTEST_HAS_SEH 1
2186 # else
2187 // Assume no SEH.
2188 #  define GTEST_HAS_SEH 0
2189 # endif
2190 
2191 #define GTEST_IS_THREADSAFE \
2192     (GTEST_HAS_MUTEX_AND_THREAD_LOCAL_ \
2193      || (GTEST_OS_WINDOWS && !GTEST_OS_WINDOWS_PHONE && !GTEST_OS_WINDOWS_RT) \
2194      || GTEST_HAS_PTHREAD)
2195 
2196 #endif  // GTEST_HAS_SEH
2197 
2198 #ifdef _MSC_VER
2199 # if GTEST_LINKED_AS_SHARED_LIBRARY
2200 #  define GTEST_API_ __declspec(dllimport)
2201 # elif GTEST_CREATE_SHARED_LIBRARY
2202 #  define GTEST_API_ __declspec(dllexport)
2203 # endif
2204 #elif __GNUC__ >= 4 || defined(__clang__)
2205 # define GTEST_API_ __attribute__((visibility ("default")))
2206 #endif // _MSC_VER
2207 
2208 #ifndef GTEST_API_
2209 # define GTEST_API_
2210 #endif
2211 
2212 #ifdef __GNUC__
2213 // Ask the compiler to never inline a given function.
2214 # define GTEST_NO_INLINE_ __attribute__((noinline))
2215 #else
2216 # define GTEST_NO_INLINE_
2217 #endif
2218 
2219 // _LIBCPP_VERSION is defined by the libc++ library from the LLVM project.
2220 #if defined(__GLIBCXX__) || defined(_LIBCPP_VERSION)
2221 # define GTEST_HAS_CXXABI_H_ 1
2222 #else
2223 # define GTEST_HAS_CXXABI_H_ 0
2224 #endif
2225 
2226 // A function level attribute to disable checking for use of uninitialized
2227 // memory when built with MemorySanitizer.
2228 #if defined(__clang__)
2229 # if __has_feature(memory_sanitizer)
2230 #  define GTEST_ATTRIBUTE_NO_SANITIZE_MEMORY_ \
2231        __attribute__((no_sanitize_memory))
2232 # else
2233 #  define GTEST_ATTRIBUTE_NO_SANITIZE_MEMORY_
2234 # endif  // __has_feature(memory_sanitizer)
2235 #else
2236 # define GTEST_ATTRIBUTE_NO_SANITIZE_MEMORY_
2237 #endif  // __clang__
2238 
2239 // A function level attribute to disable AddressSanitizer instrumentation.
2240 #if defined(__clang__)
2241 # if __has_feature(address_sanitizer)
2242 #  define GTEST_ATTRIBUTE_NO_SANITIZE_ADDRESS_ \
2243        __attribute__((no_sanitize_address))
2244 # else
2245 #  define GTEST_ATTRIBUTE_NO_SANITIZE_ADDRESS_
2246 # endif  // __has_feature(address_sanitizer)
2247 #else
2248 # define GTEST_ATTRIBUTE_NO_SANITIZE_ADDRESS_
2249 #endif  // __clang__
2250 
2251 // A function level attribute to disable ThreadSanitizer instrumentation.
2252 #if defined(__clang__)
2253 # if __has_feature(thread_sanitizer)
2254 #  define GTEST_ATTRIBUTE_NO_SANITIZE_THREAD_ \
2255        __attribute__((no_sanitize_thread))
2256 # else
2257 #  define GTEST_ATTRIBUTE_NO_SANITIZE_THREAD_
2258 # endif  // __has_feature(thread_sanitizer)
2259 #else
2260 # define GTEST_ATTRIBUTE_NO_SANITIZE_THREAD_
2261 #endif  // __clang__
2262 
2263 namespace testing {
2264 
2265 class Message;
2266 
2267 #if defined(GTEST_TUPLE_NAMESPACE_)
2268 // Import tuple and friends into the ::testing namespace.
2269 // It is part of our interface, having them in ::testing allows us to change
2270 // their types as needed.
2271 using GTEST_TUPLE_NAMESPACE_::get;
2272 using GTEST_TUPLE_NAMESPACE_::make_tuple;
2273 using GTEST_TUPLE_NAMESPACE_::tuple;
2274 using GTEST_TUPLE_NAMESPACE_::tuple_size;
2275 using GTEST_TUPLE_NAMESPACE_::tuple_element;
2276 #endif  // defined(GTEST_TUPLE_NAMESPACE_)
2277 
2278 namespace internal {
2279 
2280 // A secret type that Google Test users don't know about.  It has no
2281 // definition on purpose.  Therefore it's impossible to create a
2282 // Secret object, which is what we want.
2283 class Secret;
2284 
2285 // The GTEST_COMPILE_ASSERT_ macro can be used to verify that a compile time
2286 // expression is true. For example, you could use it to verify the
2287 // size of a static array:
2288 //
2289 //   GTEST_COMPILE_ASSERT_(GTEST_ARRAY_SIZE_(names) == NUM_NAMES,
2290 //                         names_incorrect_size);
2291 //
2292 // or to make sure a struct is smaller than a certain size:
2293 //
2294 //   GTEST_COMPILE_ASSERT_(sizeof(foo) < 128, foo_too_large);
2295 //
2296 // The second argument to the macro is the name of the variable. If
2297 // the expression is false, most compilers will issue a warning/error
2298 // containing the name of the variable.
2299 
2300 #if GTEST_LANG_CXX11
2301 # define GTEST_COMPILE_ASSERT_(expr, msg) static_assert(expr, #msg)
2302 #else  // !GTEST_LANG_CXX11
2303 template <bool>
2304   struct CompileAssert {
2305 };
2306 
2307 # define GTEST_COMPILE_ASSERT_(expr, msg) \
2308   typedef ::testing::internal::CompileAssert<(static_cast<bool>(expr))> \
2309       msg[static_cast<bool>(expr) ? 1 : -1] GTEST_ATTRIBUTE_UNUSED_
2310 #endif  // !GTEST_LANG_CXX11
2311 
2312 // Implementation details of GTEST_COMPILE_ASSERT_:
2313 //
2314 // (In C++11, we simply use static_assert instead of the following)
2315 //
2316 // - GTEST_COMPILE_ASSERT_ works by defining an array type that has -1
2317 //   elements (and thus is invalid) when the expression is false.
2318 //
2319 // - The simpler definition
2320 //
2321 //    #define GTEST_COMPILE_ASSERT_(expr, msg) typedef char msg[(expr) ? 1 : -1]
2322 //
2323 //   does not work, as gcc supports variable-length arrays whose sizes
2324 //   are determined at run-time (this is gcc's extension and not part
2325 //   of the C++ standard).  As a result, gcc fails to reject the
2326 //   following code with the simple definition:
2327 //
2328 //     int foo;
2329 //     GTEST_COMPILE_ASSERT_(foo, msg); // not supposed to compile as foo is
2330 //                                      // not a compile-time constant.
2331 //
2332 // - By using the type CompileAssert<(bool(expr))>, we ensures that
2333 //   expr is a compile-time constant.  (Template arguments must be
2334 //   determined at compile-time.)
2335 //
2336 // - The outter parentheses in CompileAssert<(bool(expr))> are necessary
2337 //   to work around a bug in gcc 3.4.4 and 4.0.1.  If we had written
2338 //
2339 //     CompileAssert<bool(expr)>
2340 //
2341 //   instead, these compilers will refuse to compile
2342 //
2343 //     GTEST_COMPILE_ASSERT_(5 > 0, some_message);
2344 //
2345 //   (They seem to think the ">" in "5 > 0" marks the end of the
2346 //   template argument list.)
2347 //
2348 // - The array size is (bool(expr) ? 1 : -1), instead of simply
2349 //
2350 //     ((expr) ? 1 : -1).
2351 //
2352 //   This is to avoid running into a bug in MS VC 7.1, which
2353 //   causes ((0.0) ? 1 : -1) to incorrectly evaluate to 1.
2354 
2355 // StaticAssertTypeEqHelper is used by StaticAssertTypeEq defined in gtest.h.
2356 //
2357 // This template is declared, but intentionally undefined.
2358 template <typename T1, typename T2>
2359 struct StaticAssertTypeEqHelper;
2360 
2361 template <typename T>
2362 struct StaticAssertTypeEqHelper<T, T> {
2363   enum { value = true };
2364 };
2365 
2366 // Evaluates to the number of elements in 'array'.
2367 #define GTEST_ARRAY_SIZE_(array) (sizeof(array) / sizeof(array[0]))
2368 
2369 #if GTEST_HAS_GLOBAL_STRING
2370 typedef ::string string;
2371 #else
2372 typedef ::std::string string;
2373 #endif  // GTEST_HAS_GLOBAL_STRING
2374 
2375 #if GTEST_HAS_GLOBAL_WSTRING
2376 typedef ::wstring wstring;
2377 #elif GTEST_HAS_STD_WSTRING
2378 typedef ::std::wstring wstring;
2379 #endif  // GTEST_HAS_GLOBAL_WSTRING
2380 
2381 // A helper for suppressing warnings on constant condition.  It just
2382 // returns 'condition'.
2383 GTEST_API_ bool IsTrue(bool condition);
2384 
2385 // Defines scoped_ptr.
2386 
2387 // This implementation of scoped_ptr is PARTIAL - it only contains
2388 // enough stuff to satisfy Google Test's need.
2389 template <typename T>
2390 class scoped_ptr {
2391  public:
2392   typedef T element_type;
2393 
2394   explicit scoped_ptr(T* p = NULL) : ptr_(p) {}
2395   ~scoped_ptr() { reset(); }
2396 
2397   T& operator*() const { return *ptr_; }
2398   T* operator->() const { return ptr_; }
2399   T* get() const { return ptr_; }
2400 
2401   T* release() {
2402     T* const ptr = ptr_;
2403     ptr_ = NULL;
2404     return ptr;
2405   }
2406 
2407   void reset(T* p = NULL) {
2408     if (p != ptr_) {
2409       if (IsTrue(sizeof(T) > 0)) {  // Makes sure T is a complete type.
2410         delete ptr_;
2411       }
2412       ptr_ = p;
2413     }
2414   }
2415 
2416   friend void swap(scoped_ptr& a, scoped_ptr& b) {
2417     using std::swap;
2418     swap(a.ptr_, b.ptr_);
2419   }
2420 
2421  private:
2422   T* ptr_;
2423 
2424   GTEST_DISALLOW_COPY_AND_ASSIGN_(scoped_ptr);
2425 };
2426 
2427 // Defines RE.
2428 
2429 // A simple C++ wrapper for <regex.h>.  It uses the POSIX Extended
2430 // Regular Expression syntax.
2431 class GTEST_API_ RE {
2432  public:
2433   // A copy constructor is required by the Standard to initialize object
2434   // references from r-values.
2435   RE(const RE& other) { Init(other.pattern()); }
2436 
2437   // Constructs an RE from a string.
2438   RE(const ::std::string& regex) { Init(regex.c_str()); }  // NOLINT
2439 
2440 #if GTEST_HAS_GLOBAL_STRING
2441 
2442   RE(const ::string& regex) { Init(regex.c_str()); }  // NOLINT
2443 
2444 #endif  // GTEST_HAS_GLOBAL_STRING
2445 
2446   RE(const char* regex) { Init(regex); }  // NOLINT
2447   ~RE();
2448 
2449   // Returns the string representation of the regex.
2450   const char* pattern() const { return pattern_; }
2451 
2452   // FullMatch(str, re) returns true iff regular expression re matches
2453   // the entire str.
2454   // PartialMatch(str, re) returns true iff regular expression re
2455   // matches a substring of str (including str itself).
2456   //
2457   // TODO(wan@google.com): make FullMatch() and PartialMatch() work
2458   // when str contains NUL characters.
2459   static bool FullMatch(const ::std::string& str, const RE& re) {
2460     return FullMatch(str.c_str(), re);
2461   }
2462   static bool PartialMatch(const ::std::string& str, const RE& re) {
2463     return PartialMatch(str.c_str(), re);
2464   }
2465 
2466 #if GTEST_HAS_GLOBAL_STRING
2467 
2468   static bool FullMatch(const ::string& str, const RE& re) {
2469     return FullMatch(str.c_str(), re);
2470   }
2471   static bool PartialMatch(const ::string& str, const RE& re) {
2472     return PartialMatch(str.c_str(), re);
2473   }
2474 
2475 #endif  // GTEST_HAS_GLOBAL_STRING
2476 
2477   static bool FullMatch(const char* str, const RE& re);
2478   static bool PartialMatch(const char* str, const RE& re);
2479 
2480  private:
2481   void Init(const char* regex);
2482 
2483   // We use a const char* instead of an std::string, as Google Test used to be
2484   // used where std::string is not available.  TODO(wan@google.com): change to
2485   // std::string.
2486   const char* pattern_;
2487   bool is_valid_;
2488 
2489 #if GTEST_USES_POSIX_RE
2490 
2491   regex_t full_regex_;     // For FullMatch().
2492   regex_t partial_regex_;  // For PartialMatch().
2493 
2494 #else  // GTEST_USES_SIMPLE_RE
2495 
2496   const char* full_pattern_;  // For FullMatch();
2497 
2498 #endif
2499 
2500   GTEST_DISALLOW_ASSIGN_(RE);
2501 };
2502 
2503 // Formats a source file path and a line number as they would appear
2504 // in an error message from the compiler used to compile this code.
2505 GTEST_API_ ::std::string FormatFileLocation(const char* file, int line);
2506 
2507 // Formats a file location for compiler-independent XML output.
2508 // Although this function is not platform dependent, we put it next to
2509 // FormatFileLocation in order to contrast the two functions.
2510 GTEST_API_ ::std::string FormatCompilerIndependentFileLocation(const char* file,
2511                                                                int line);
2512 
2513 // Defines logging utilities:
2514 //   GTEST_LOG_(severity) - logs messages at the specified severity level. The
2515 //                          message itself is streamed into the macro.
2516 //   LogToStderr()  - directs all log messages to stderr.
2517 //   FlushInfoLog() - flushes informational log messages.
2518 
2519 enum GTestLogSeverity {
2520   GTEST_INFO,
2521   GTEST_WARNING,
2522   GTEST_ERROR,
2523   GTEST_FATAL
2524 };
2525 
2526 // Formats log entry severity, provides a stream object for streaming the
2527 // log message, and terminates the message with a newline when going out of
2528 // scope.
2529 class GTEST_API_ GTestLog {
2530  public:
2531   GTestLog(GTestLogSeverity severity, const char* file, int line);
2532 
2533   // Flushes the buffers and, if severity is GTEST_FATAL, aborts the program.
2534   ~GTestLog();
2535 
2536   ::std::ostream& GetStream() { return ::std::cerr; }
2537 
2538  private:
2539   const GTestLogSeverity severity_;
2540 
2541   GTEST_DISALLOW_COPY_AND_ASSIGN_(GTestLog);
2542 };
2543 
2544 #if !defined(GTEST_LOG_)
2545 
2546 # define GTEST_LOG_(severity) \
2547     ::testing::internal::GTestLog(::testing::internal::GTEST_##severity, \
2548                                   __FILE__, __LINE__).GetStream()
2549 
2550 inline void LogToStderr() {}
2551 inline void FlushInfoLog() { fflush(NULL); }
2552 
2553 #endif  // !defined(GTEST_LOG_)
2554 
2555 #if !defined(GTEST_CHECK_)
2556 // INTERNAL IMPLEMENTATION - DO NOT USE.
2557 //
2558 // GTEST_CHECK_ is an all-mode assert. It aborts the program if the condition
2559 // is not satisfied.
2560 //  Synopsys:
2561 //    GTEST_CHECK_(boolean_condition);
2562 //     or
2563 //    GTEST_CHECK_(boolean_condition) << "Additional message";
2564 //
2565 //    This checks the condition and if the condition is not satisfied
2566 //    it prints message about the condition violation, including the
2567 //    condition itself, plus additional message streamed into it, if any,
2568 //    and then it aborts the program. It aborts the program irrespective of
2569 //    whether it is built in the debug mode or not.
2570 # define GTEST_CHECK_(condition) \
2571     GTEST_AMBIGUOUS_ELSE_BLOCKER_ \
2572     if (::testing::internal::IsTrue(condition)) \
2573       ; \
2574     else \
2575       GTEST_LOG_(FATAL) << "Condition " #condition " failed. "
2576 #endif  // !defined(GTEST_CHECK_)
2577 
2578 // An all-mode assert to verify that the given POSIX-style function
2579 // call returns 0 (indicating success).  Known limitation: this
2580 // doesn't expand to a balanced 'if' statement, so enclose the macro
2581 // in {} if you need to use it as the only statement in an 'if'
2582 // branch.
2583 #define GTEST_CHECK_POSIX_SUCCESS_(posix_call) \
2584   if (const int gtest_error = (posix_call)) \
2585     GTEST_LOG_(FATAL) << #posix_call << "failed with error " \
2586                       << gtest_error
2587 
2588 #if GTEST_HAS_STD_MOVE_
2589 using std::move;
2590 #else  // GTEST_HAS_STD_MOVE_
2591 template <typename T>
2592 const T& move(const T& t) {
2593   return t;
2594 }
2595 #endif  // GTEST_HAS_STD_MOVE_
2596 
2597 // INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.
2598 //
2599 // Use ImplicitCast_ as a safe version of static_cast for upcasting in
2600 // the type hierarchy (e.g. casting a Foo* to a SuperclassOfFoo* or a
2601 // const Foo*).  When you use ImplicitCast_, the compiler checks that
2602 // the cast is safe.  Such explicit ImplicitCast_s are necessary in
2603 // surprisingly many situations where C++ demands an exact type match
2604 // instead of an argument type convertable to a target type.
2605 //
2606 // The syntax for using ImplicitCast_ is the same as for static_cast:
2607 //
2608 //   ImplicitCast_<ToType>(expr)
2609 //
2610 // ImplicitCast_ would have been part of the C++ standard library,
2611 // but the proposal was submitted too late.  It will probably make
2612 // its way into the language in the future.
2613 //
2614 // This relatively ugly name is intentional. It prevents clashes with
2615 // similar functions users may have (e.g., implicit_cast). The internal
2616 // namespace alone is not enough because the function can be found by ADL.
2617 template<typename To>
2618 inline To ImplicitCast_(To x) { return x; }
2619 
2620 // When you upcast (that is, cast a pointer from type Foo to type
2621 // SuperclassOfFoo), it's fine to use ImplicitCast_<>, since upcasts
2622 // always succeed.  When you downcast (that is, cast a pointer from
2623 // type Foo to type SubclassOfFoo), static_cast<> isn't safe, because
2624 // how do you know the pointer is really of type SubclassOfFoo?  It
2625 // could be a bare Foo, or of type DifferentSubclassOfFoo.  Thus,
2626 // when you downcast, you should use this macro.  In debug mode, we
2627 // use dynamic_cast<> to double-check the downcast is legal (we die
2628 // if it's not).  In normal mode, we do the efficient static_cast<>
2629 // instead.  Thus, it's important to test in debug mode to make sure
2630 // the cast is legal!
2631 //    This is the only place in the code we should use dynamic_cast<>.
2632 // In particular, you SHOULDN'T be using dynamic_cast<> in order to
2633 // do RTTI (eg code like this:
2634 //    if (dynamic_cast<Subclass1>(foo)) HandleASubclass1Object(foo);
2635 //    if (dynamic_cast<Subclass2>(foo)) HandleASubclass2Object(foo);
2636 // You should design the code some other way not to need this.
2637 //
2638 // This relatively ugly name is intentional. It prevents clashes with
2639 // similar functions users may have (e.g., down_cast). The internal
2640 // namespace alone is not enough because the function can be found by ADL.
2641 template<typename To, typename From>  // use like this: DownCast_<T*>(foo);
2642 inline To DownCast_(From* f) {  // so we only accept pointers
2643   // Ensures that To is a sub-type of From *.  This test is here only
2644   // for compile-time type checking, and has no overhead in an
2645   // optimized build at run-time, as it will be optimized away
2646   // completely.
2647   GTEST_INTENTIONAL_CONST_COND_PUSH_()
2648   if (false) {
2649   GTEST_INTENTIONAL_CONST_COND_POP_()
2650     const To to = NULL;
2651     ::testing::internal::ImplicitCast_<From*>(to);
2652   }
2653 
2654 #if GTEST_HAS_RTTI
2655   // RTTI: debug mode only!
2656   GTEST_CHECK_(f == NULL || dynamic_cast<To>(f) != NULL);
2657 #endif
2658   return static_cast<To>(f);
2659 }
2660 
2661 // Downcasts the pointer of type Base to Derived.
2662 // Derived must be a subclass of Base. The parameter MUST
2663 // point to a class of type Derived, not any subclass of it.
2664 // When RTTI is available, the function performs a runtime
2665 // check to enforce this.
2666 template <class Derived, class Base>
2667 Derived* CheckedDowncastToActualType(Base* base) {
2668 #if GTEST_HAS_RTTI
2669   GTEST_CHECK_(typeid(*base) == typeid(Derived));
2670 #endif
2671 
2672 #if GTEST_HAS_DOWNCAST_
2673   return ::down_cast<Derived*>(base);
2674 #elif GTEST_HAS_RTTI
2675   return dynamic_cast<Derived*>(base);  // NOLINT
2676 #else
2677   return static_cast<Derived*>(base);  // Poor man's downcast.
2678 #endif
2679 }
2680 
2681 #if GTEST_HAS_STREAM_REDIRECTION
2682 
2683 // Defines the stderr capturer:
2684 //   CaptureStdout     - starts capturing stdout.
2685 //   GetCapturedStdout - stops capturing stdout and returns the captured string.
2686 //   CaptureStderr     - starts capturing stderr.
2687 //   GetCapturedStderr - stops capturing stderr and returns the captured string.
2688 //
2689 GTEST_API_ void CaptureStdout();
2690 GTEST_API_ std::string GetCapturedStdout();
2691 GTEST_API_ void CaptureStderr();
2692 GTEST_API_ std::string GetCapturedStderr();
2693 
2694 #endif  // GTEST_HAS_STREAM_REDIRECTION
2695 
2696 // Returns a path to temporary directory.
2697 GTEST_API_ std::string TempDir();
2698 
2699 // Returns the size (in bytes) of a file.
2700 GTEST_API_ size_t GetFileSize(FILE* file);
2701 
2702 // Reads the entire content of a file as a string.
2703 GTEST_API_ std::string ReadEntireFile(FILE* file);
2704 
2705 // All command line arguments.
2706 GTEST_API_ const ::std::vector<testing::internal::string>& GetArgvs();
2707 
2708 #if GTEST_HAS_DEATH_TEST
2709 
2710 const ::std::vector<testing::internal::string>& GetInjectableArgvs();
2711 void SetInjectableArgvs(const ::std::vector<testing::internal::string>*
2712                              new_argvs);
2713 
2714 
2715 #endif  // GTEST_HAS_DEATH_TEST
2716 
2717 // Defines synchronization primitives.
2718 #if GTEST_IS_THREADSAFE
2719 # if GTEST_HAS_PTHREAD
2720 // Sleeps for (roughly) n milliseconds.  This function is only for testing
2721 // Google Test's own constructs.  Don't use it in user tests, either
2722 // directly or indirectly.
2723 inline void SleepMilliseconds(int n) {
2724   const timespec time = {
2725     0,                  // 0 seconds.
2726     n * 1000L * 1000L,  // And n ms.
2727   };
2728   nanosleep(&time, NULL);
2729 }
2730 # endif  // GTEST_HAS_PTHREAD
2731 
2732 # if GTEST_HAS_NOTIFICATION_
2733 // Notification has already been imported into the namespace.
2734 // Nothing to do here.
2735 
2736 # elif GTEST_HAS_PTHREAD
2737 // Allows a controller thread to pause execution of newly created
2738 // threads until notified.  Instances of this class must be created
2739 // and destroyed in the controller thread.
2740 //
2741 // This class is only for testing Google Test's own constructs. Do not
2742 // use it in user tests, either directly or indirectly.
2743 class Notification {
2744  public:
2745   Notification() : notified_(false) {
2746     GTEST_CHECK_POSIX_SUCCESS_(pthread_mutex_init(&mutex_, NULL));
2747   }
2748   ~Notification() {
2749     pthread_mutex_destroy(&mutex_);
2750   }
2751 
2752   // Notifies all threads created with this notification to start. Must
2753   // be called from the controller thread.
2754   void Notify() {
2755     pthread_mutex_lock(&mutex_);
2756     notified_ = true;
2757     pthread_mutex_unlock(&mutex_);
2758   }
2759 
2760   // Blocks until the controller thread notifies. Must be called from a test
2761   // thread.
2762   void WaitForNotification() {
2763     for (;;) {
2764       pthread_mutex_lock(&mutex_);
2765       const bool notified = notified_;
2766       pthread_mutex_unlock(&mutex_);
2767       if (notified)
2768         break;
2769       SleepMilliseconds(10);
2770     }
2771   }
2772 
2773  private:
2774   pthread_mutex_t mutex_;
2775   bool notified_;
2776 
2777   GTEST_DISALLOW_COPY_AND_ASSIGN_(Notification);
2778 };
2779 
2780 # elif GTEST_OS_WINDOWS && !GTEST_OS_WINDOWS_PHONE && !GTEST_OS_WINDOWS_RT
2781 
2782 GTEST_API_ void SleepMilliseconds(int n);
2783 
2784 // Provides leak-safe Windows kernel handle ownership.
2785 // Used in death tests and in threading support.
2786 class GTEST_API_ AutoHandle {
2787  public:
2788   // Assume that Win32 HANDLE type is equivalent to void*. Doing so allows us to
2789   // avoid including <windows.h> in this header file. Including <windows.h> is
2790   // undesirable because it defines a lot of symbols and macros that tend to
2791   // conflict with client code. This assumption is verified by
2792   // WindowsTypesTest.HANDLEIsVoidStar.
2793   typedef void* Handle;
2794   AutoHandle();
2795   explicit AutoHandle(Handle handle);
2796 
2797   ~AutoHandle();
2798 
2799   Handle Get() const;
2800   void Reset();
2801   void Reset(Handle handle);
2802 
2803  private:
2804   // Returns true iff the handle is a valid handle object that can be closed.
2805   bool IsCloseable() const;
2806 
2807   Handle handle_;
2808 
2809   GTEST_DISALLOW_COPY_AND_ASSIGN_(AutoHandle);
2810 };
2811 
2812 // Allows a controller thread to pause execution of newly created
2813 // threads until notified.  Instances of this class must be created
2814 // and destroyed in the controller thread.
2815 //
2816 // This class is only for testing Google Test's own constructs. Do not
2817 // use it in user tests, either directly or indirectly.
2818 class GTEST_API_ Notification {
2819  public:
2820   Notification();
2821   void Notify();
2822   void WaitForNotification();
2823 
2824  private:
2825   AutoHandle event_;
2826 
2827   GTEST_DISALLOW_COPY_AND_ASSIGN_(Notification);
2828 };
2829 # endif  // GTEST_HAS_NOTIFICATION_
2830 
2831 // On MinGW, we can have both GTEST_OS_WINDOWS and GTEST_HAS_PTHREAD
2832 // defined, but we don't want to use MinGW's pthreads implementation, which
2833 // has conformance problems with some versions of the POSIX standard.
2834 # if GTEST_HAS_PTHREAD && !GTEST_OS_WINDOWS_MINGW
2835 
2836 // As a C-function, ThreadFuncWithCLinkage cannot be templated itself.
2837 // Consequently, it cannot select a correct instantiation of ThreadWithParam
2838 // in order to call its Run(). Introducing ThreadWithParamBase as a
2839 // non-templated base class for ThreadWithParam allows us to bypass this
2840 // problem.
2841 class ThreadWithParamBase {
2842  public:
2843   virtual ~ThreadWithParamBase() {}
2844   virtual void Run() = 0;
2845 };
2846 
2847 // pthread_create() accepts a pointer to a function type with the C linkage.
2848 // According to the Standard (7.5/1), function types with different linkages
2849 // are different even if they are otherwise identical.  Some compilers (for
2850 // example, SunStudio) treat them as different types.  Since class methods
2851 // cannot be defined with C-linkage we need to define a free C-function to
2852 // pass into pthread_create().
2853 extern "C" inline void* ThreadFuncWithCLinkage(void* thread) {
2854   static_cast<ThreadWithParamBase*>(thread)->Run();
2855   return NULL;
2856 }
2857 
2858 // Helper class for testing Google Test's multi-threading constructs.
2859 // To use it, write:
2860 //
2861 //   void ThreadFunc(int param) { /* Do things with param */ }
2862 //   Notification thread_can_start;
2863 //   ...
2864 //   // The thread_can_start parameter is optional; you can supply NULL.
2865 //   ThreadWithParam<int> thread(&ThreadFunc, 5, &thread_can_start);
2866 //   thread_can_start.Notify();
2867 //
2868 // These classes are only for testing Google Test's own constructs. Do
2869 // not use them in user tests, either directly or indirectly.
2870 template <typename T>
2871 class ThreadWithParam : public ThreadWithParamBase {
2872  public:
2873   typedef void UserThreadFunc(T);
2874 
2875   ThreadWithParam(UserThreadFunc* func, T param, Notification* thread_can_start)
2876       : func_(func),
2877         param_(param),
2878         thread_can_start_(thread_can_start),
2879         finished_(false) {
2880     ThreadWithParamBase* const base = this;
2881     // The thread can be created only after all fields except thread_
2882     // have been initialized.
2883     GTEST_CHECK_POSIX_SUCCESS_(
2884         pthread_create(&thread_, 0, &ThreadFuncWithCLinkage, base));
2885   }
2886   ~ThreadWithParam() { Join(); }
2887 
2888   void Join() {
2889     if (!finished_) {
2890       GTEST_CHECK_POSIX_SUCCESS_(pthread_join(thread_, 0));
2891       finished_ = true;
2892     }
2893   }
2894 
2895   virtual void Run() {
2896     if (thread_can_start_ != NULL)
2897       thread_can_start_->WaitForNotification();
2898     func_(param_);
2899   }
2900 
2901  private:
2902   UserThreadFunc* const func_;  // User-supplied thread function.
2903   const T param_;  // User-supplied parameter to the thread function.
2904   // When non-NULL, used to block execution until the controller thread
2905   // notifies.
2906   Notification* const thread_can_start_;
2907   bool finished_;  // true iff we know that the thread function has finished.
2908   pthread_t thread_;  // The native thread object.
2909 
2910   GTEST_DISALLOW_COPY_AND_ASSIGN_(ThreadWithParam);
2911 };
2912 # endif  // !GTEST_OS_WINDOWS && GTEST_HAS_PTHREAD ||
2913          // GTEST_HAS_MUTEX_AND_THREAD_LOCAL_
2914 
2915 # if GTEST_HAS_MUTEX_AND_THREAD_LOCAL_
2916 // Mutex and ThreadLocal have already been imported into the namespace.
2917 // Nothing to do here.
2918 
2919 # elif GTEST_OS_WINDOWS && !GTEST_OS_WINDOWS_PHONE && !GTEST_OS_WINDOWS_RT
2920 
2921 // Mutex implements mutex on Windows platforms.  It is used in conjunction
2922 // with class MutexLock:
2923 //
2924 //   Mutex mutex;
2925 //   ...
2926 //   MutexLock lock(&mutex);  // Acquires the mutex and releases it at the
2927 //                            // end of the current scope.
2928 //
2929 // A static Mutex *must* be defined or declared using one of the following
2930 // macros:
2931 //   GTEST_DEFINE_STATIC_MUTEX_(g_some_mutex);
2932 //   GTEST_DECLARE_STATIC_MUTEX_(g_some_mutex);
2933 //
2934 // (A non-static Mutex is defined/declared in the usual way).
2935 class GTEST_API_ Mutex {
2936  public:
2937   enum MutexType { kStatic = 0, kDynamic = 1 };
2938   // We rely on kStaticMutex being 0 as it is to what the linker initializes
2939   // type_ in static mutexes.  critical_section_ will be initialized lazily
2940   // in ThreadSafeLazyInit().
2941   enum StaticConstructorSelector { kStaticMutex = 0 };
2942 
2943   // This constructor intentionally does nothing.  It relies on type_ being
2944   // statically initialized to 0 (effectively setting it to kStatic) and on
2945   // ThreadSafeLazyInit() to lazily initialize the rest of the members.
2946   explicit Mutex(StaticConstructorSelector /*dummy*/) {}
2947 
2948   Mutex();
2949   ~Mutex();
2950 
2951   void Lock();
2952 
2953   void Unlock();
2954 
2955   // Does nothing if the current thread holds the mutex. Otherwise, crashes
2956   // with high probability.
2957   void AssertHeld();
2958 
2959  private:
2960   // Initializes owner_thread_id_ and critical_section_ in static mutexes.
2961   void ThreadSafeLazyInit();
2962 
2963   // Per http://blogs.msdn.com/b/oldnewthing/archive/2004/02/23/78395.aspx,
2964   // we assume that 0 is an invalid value for thread IDs.
2965   unsigned int owner_thread_id_;
2966 
2967   // For static mutexes, we rely on these members being initialized to zeros
2968   // by the linker.
2969   MutexType type_;
2970   long critical_section_init_phase_;  // NOLINT
2971   _RTL_CRITICAL_SECTION* critical_section_;
2972 
2973   GTEST_DISALLOW_COPY_AND_ASSIGN_(Mutex);
2974 };
2975 
2976 # define GTEST_DECLARE_STATIC_MUTEX_(mutex) \
2977     extern ::testing::internal::Mutex mutex
2978 
2979 # define GTEST_DEFINE_STATIC_MUTEX_(mutex) \
2980     ::testing::internal::Mutex mutex(::testing::internal::Mutex::kStaticMutex)
2981 
2982 // We cannot name this class MutexLock because the ctor declaration would
2983 // conflict with a macro named MutexLock, which is defined on some
2984 // platforms. That macro is used as a defensive measure to prevent against
2985 // inadvertent misuses of MutexLock like "MutexLock(&mu)" rather than
2986 // "MutexLock l(&mu)".  Hence the typedef trick below.
2987 class GTestMutexLock {
2988  public:
2989   explicit GTestMutexLock(Mutex* mutex)
2990       : mutex_(mutex) { mutex_->Lock(); }
2991 
2992   ~GTestMutexLock() { mutex_->Unlock(); }
2993 
2994  private:
2995   Mutex* const mutex_;
2996 
2997   GTEST_DISALLOW_COPY_AND_ASSIGN_(GTestMutexLock);
2998 };
2999 
3000 typedef GTestMutexLock MutexLock;
3001 
3002 // Base class for ValueHolder<T>.  Allows a caller to hold and delete a value
3003 // without knowing its type.
3004 class ThreadLocalValueHolderBase {
3005  public:
3006   virtual ~ThreadLocalValueHolderBase() {}
3007 };
3008 
3009 // Provides a way for a thread to send notifications to a ThreadLocal
3010 // regardless of its parameter type.
3011 class ThreadLocalBase {
3012  public:
3013   // Creates a new ValueHolder<T> object holding a default value passed to
3014   // this ThreadLocal<T>'s constructor and returns it.  It is the caller's
3015   // responsibility not to call this when the ThreadLocal<T> instance already
3016   // has a value on the current thread.
3017   virtual ThreadLocalValueHolderBase* NewValueForCurrentThread() const = 0;
3018 
3019  protected:
3020   ThreadLocalBase() {}
3021   virtual ~ThreadLocalBase() {}
3022 
3023  private:
3024   GTEST_DISALLOW_COPY_AND_ASSIGN_(ThreadLocalBase);
3025 };
3026 
3027 // Maps a thread to a set of ThreadLocals that have values instantiated on that
3028 // thread and notifies them when the thread exits.  A ThreadLocal instance is
3029 // expected to persist until all threads it has values on have terminated.
3030 class GTEST_API_ ThreadLocalRegistry {
3031  public:
3032   // Registers thread_local_instance as having value on the current thread.
3033   // Returns a value that can be used to identify the thread from other threads.
3034   static ThreadLocalValueHolderBase* GetValueOnCurrentThread(
3035       const ThreadLocalBase* thread_local_instance);
3036 
3037   // Invoked when a ThreadLocal instance is destroyed.
3038   static void OnThreadLocalDestroyed(
3039       const ThreadLocalBase* thread_local_instance);
3040 };
3041 
3042 class GTEST_API_ ThreadWithParamBase {
3043  public:
3044   void Join();
3045 
3046  protected:
3047   class Runnable {
3048    public:
3049     virtual ~Runnable() {}
3050     virtual void Run() = 0;
3051   };
3052 
3053   ThreadWithParamBase(Runnable *runnable, Notification* thread_can_start);
3054   virtual ~ThreadWithParamBase();
3055 
3056  private:
3057   AutoHandle thread_;
3058 };
3059 
3060 // Helper class for testing Google Test's multi-threading constructs.
3061 template <typename T>
3062 class ThreadWithParam : public ThreadWithParamBase {
3063  public:
3064   typedef void UserThreadFunc(T);
3065 
3066   ThreadWithParam(UserThreadFunc* func, T param, Notification* thread_can_start)
3067       : ThreadWithParamBase(new RunnableImpl(func, param), thread_can_start) {
3068   }
3069   virtual ~ThreadWithParam() {}
3070 
3071  private:
3072   class RunnableImpl : public Runnable {
3073    public:
3074     RunnableImpl(UserThreadFunc* func, T param)
3075         : func_(func),
3076           param_(param) {
3077     }
3078     virtual ~RunnableImpl() {}
3079     virtual void Run() {
3080       func_(param_);
3081     }
3082 
3083    private:
3084     UserThreadFunc* const func_;
3085     const T param_;
3086 
3087     GTEST_DISALLOW_COPY_AND_ASSIGN_(RunnableImpl);
3088   };
3089 
3090   GTEST_DISALLOW_COPY_AND_ASSIGN_(ThreadWithParam);
3091 };
3092 
3093 // Implements thread-local storage on Windows systems.
3094 //
3095 //   // Thread 1
3096 //   ThreadLocal<int> tl(100);  // 100 is the default value for each thread.
3097 //
3098 //   // Thread 2
3099 //   tl.set(150);  // Changes the value for thread 2 only.
3100 //   EXPECT_EQ(150, tl.get());
3101 //
3102 //   // Thread 1
3103 //   EXPECT_EQ(100, tl.get());  // In thread 1, tl has the original value.
3104 //   tl.set(200);
3105 //   EXPECT_EQ(200, tl.get());
3106 //
3107 // The template type argument T must have a public copy constructor.
3108 // In addition, the default ThreadLocal constructor requires T to have
3109 // a public default constructor.
3110 //
3111 // The users of a TheadLocal instance have to make sure that all but one
3112 // threads (including the main one) using that instance have exited before
3113 // destroying it. Otherwise, the per-thread objects managed for them by the
3114 // ThreadLocal instance are not guaranteed to be destroyed on all platforms.
3115 //
3116 // Google Test only uses global ThreadLocal objects.  That means they
3117 // will die after main() has returned.  Therefore, no per-thread
3118 // object managed by Google Test will be leaked as long as all threads
3119 // using Google Test have exited when main() returns.
3120 template <typename T>
3121 class ThreadLocal : public ThreadLocalBase {
3122  public:
3123   ThreadLocal() : default_factory_(new DefaultValueHolderFactory()) {}
3124   explicit ThreadLocal(const T& value)
3125       : default_factory_(new InstanceValueHolderFactory(value)) {}
3126 
3127   ~ThreadLocal() { ThreadLocalRegistry::OnThreadLocalDestroyed(this); }
3128 
3129   T* pointer() { return GetOrCreateValue(); }
3130   const T* pointer() const { return GetOrCreateValue(); }
3131   const T& get() const { return *pointer(); }
3132   void set(const T& value) { *pointer() = value; }
3133 
3134  private:
3135   // Holds a value of T.  Can be deleted via its base class without the caller
3136   // knowing the type of T.
3137   class ValueHolder : public ThreadLocalValueHolderBase {
3138    public:
3139     ValueHolder() : value_() {}
3140     explicit ValueHolder(const T& value) : value_(value) {}
3141 
3142     T* pointer() { return &value_; }
3143 
3144    private:
3145     T value_;
3146     GTEST_DISALLOW_COPY_AND_ASSIGN_(ValueHolder);
3147   };
3148 
3149 
3150   T* GetOrCreateValue() const {
3151     return static_cast<ValueHolder*>(
3152         ThreadLocalRegistry::GetValueOnCurrentThread(this))->pointer();
3153   }
3154 
3155   virtual ThreadLocalValueHolderBase* NewValueForCurrentThread() const {
3156     return default_factory_->MakeNewHolder();
3157   }
3158 
3159   class ValueHolderFactory {
3160    public:
3161     ValueHolderFactory() {}
3162     virtual ~ValueHolderFactory() {}
3163     virtual ValueHolder* MakeNewHolder() const = 0;
3164 
3165    private:
3166     GTEST_DISALLOW_COPY_AND_ASSIGN_(ValueHolderFactory);
3167   };
3168 
3169   class DefaultValueHolderFactory : public ValueHolderFactory {
3170    public:
3171     DefaultValueHolderFactory() {}
3172     virtual ValueHolder* MakeNewHolder() const { return new ValueHolder(); }
3173 
3174    private:
3175     GTEST_DISALLOW_COPY_AND_ASSIGN_(DefaultValueHolderFactory);
3176   };
3177 
3178   class InstanceValueHolderFactory : public ValueHolderFactory {
3179    public:
3180     explicit InstanceValueHolderFactory(const T& value) : value_(value) {}
3181     virtual ValueHolder* MakeNewHolder() const {
3182       return new ValueHolder(value_);
3183     }
3184 
3185    private:
3186     const T value_;  // The value for each thread.
3187 
3188     GTEST_DISALLOW_COPY_AND_ASSIGN_(InstanceValueHolderFactory);
3189   };
3190 
3191   scoped_ptr<ValueHolderFactory> default_factory_;
3192 
3193   GTEST_DISALLOW_COPY_AND_ASSIGN_(ThreadLocal);
3194 };
3195 
3196 # elif GTEST_HAS_PTHREAD
3197 
3198 // MutexBase and Mutex implement mutex on pthreads-based platforms.
3199 class MutexBase {
3200  public:
3201   // Acquires this mutex.
3202   void Lock() {
3203     GTEST_CHECK_POSIX_SUCCESS_(pthread_mutex_lock(&mutex_));
3204     owner_ = pthread_self();
3205     has_owner_ = true;
3206   }
3207 
3208   // Releases this mutex.
3209   void Unlock() {
3210     // Since the lock is being released the owner_ field should no longer be
3211     // considered valid. We don't protect writing to has_owner_ here, as it's
3212     // the caller's responsibility to ensure that the current thread holds the
3213     // mutex when this is called.
3214     has_owner_ = false;
3215     GTEST_CHECK_POSIX_SUCCESS_(pthread_mutex_unlock(&mutex_));
3216   }
3217 
3218   // Does nothing if the current thread holds the mutex. Otherwise, crashes
3219   // with high probability.
3220   void AssertHeld() const {
3221     GTEST_CHECK_(has_owner_ && pthread_equal(owner_, pthread_self()))
3222         << "The current thread is not holding the mutex @" << this;
3223   }
3224 
3225   // A static mutex may be used before main() is entered.  It may even
3226   // be used before the dynamic initialization stage.  Therefore we
3227   // must be able to initialize a static mutex object at link time.
3228   // This means MutexBase has to be a POD and its member variables
3229   // have to be public.
3230  public:
3231   pthread_mutex_t mutex_;  // The underlying pthread mutex.
3232   // has_owner_ indicates whether the owner_ field below contains a valid thread
3233   // ID and is therefore safe to inspect (e.g., to use in pthread_equal()). All
3234   // accesses to the owner_ field should be protected by a check of this field.
3235   // An alternative might be to memset() owner_ to all zeros, but there's no
3236   // guarantee that a zero'd pthread_t is necessarily invalid or even different
3237   // from pthread_self().
3238   bool has_owner_;
3239   pthread_t owner_;  // The thread holding the mutex.
3240 };
3241 
3242 // Forward-declares a static mutex.
3243 #  define GTEST_DECLARE_STATIC_MUTEX_(mutex) \
3244      extern ::testing::internal::MutexBase mutex
3245 
3246 // Defines and statically (i.e. at link time) initializes a static mutex.
3247 #  define GTEST_DEFINE_STATIC_MUTEX_(mutex) \
3248      ::testing::internal::MutexBase mutex = { PTHREAD_MUTEX_INITIALIZER, false, pthread_t() }
3249 
3250 // The Mutex class can only be used for mutexes created at runtime. It
3251 // shares its API with MutexBase otherwise.
3252 class Mutex : public MutexBase {
3253  public:
3254   Mutex() {
3255     GTEST_CHECK_POSIX_SUCCESS_(pthread_mutex_init(&mutex_, NULL));
3256     has_owner_ = false;
3257   }
3258   ~Mutex() {
3259     GTEST_CHECK_POSIX_SUCCESS_(pthread_mutex_destroy(&mutex_));
3260   }
3261 
3262  private:
3263   GTEST_DISALLOW_COPY_AND_ASSIGN_(Mutex);
3264 };
3265 
3266 // We cannot name this class MutexLock because the ctor declaration would
3267 // conflict with a macro named MutexLock, which is defined on some
3268 // platforms. That macro is used as a defensive measure to prevent against
3269 // inadvertent misuses of MutexLock like "MutexLock(&mu)" rather than
3270 // "MutexLock l(&mu)".  Hence the typedef trick below.
3271 class GTestMutexLock {
3272  public:
3273   explicit GTestMutexLock(MutexBase* mutex)
3274       : mutex_(mutex) { mutex_->Lock(); }
3275 
3276   ~GTestMutexLock() { mutex_->Unlock(); }
3277 
3278  private:
3279   MutexBase* const mutex_;
3280 
3281   GTEST_DISALLOW_COPY_AND_ASSIGN_(GTestMutexLock);
3282 };
3283 
3284 typedef GTestMutexLock MutexLock;
3285 
3286 // Helpers for ThreadLocal.
3287 
3288 // pthread_key_create() requires DeleteThreadLocalValue() to have
3289 // C-linkage.  Therefore it cannot be templatized to access
3290 // ThreadLocal<T>.  Hence the need for class
3291 // ThreadLocalValueHolderBase.
3292 class ThreadLocalValueHolderBase {
3293  public:
3294   virtual ~ThreadLocalValueHolderBase() {}
3295 };
3296 
3297 // Called by pthread to delete thread-local data stored by
3298 // pthread_setspecific().
3299 extern "C" inline void DeleteThreadLocalValue(void* value_holder) {
3300   delete static_cast<ThreadLocalValueHolderBase*>(value_holder);
3301 }
3302 
3303 // Implements thread-local storage on pthreads-based systems.
3304 template <typename T>
3305 class ThreadLocal {
3306  public:
3307   ThreadLocal()
3308       : key_(CreateKey()), default_factory_(new DefaultValueHolderFactory()) {}
3309   explicit ThreadLocal(const T& value)
3310       : key_(CreateKey()),
3311         default_factory_(new InstanceValueHolderFactory(value)) {}
3312 
3313   ~ThreadLocal() {
3314     // Destroys the managed object for the current thread, if any.
3315     DeleteThreadLocalValue(pthread_getspecific(key_));
3316 
3317     // Releases resources associated with the key.  This will *not*
3318     // delete managed objects for other threads.
3319     GTEST_CHECK_POSIX_SUCCESS_(pthread_key_delete(key_));
3320   }
3321 
3322   T* pointer() { return GetOrCreateValue(); }
3323   const T* pointer() const { return GetOrCreateValue(); }
3324   const T& get() const { return *pointer(); }
3325   void set(const T& value) { *pointer() = value; }
3326 
3327  private:
3328   // Holds a value of type T.
3329   class ValueHolder : public ThreadLocalValueHolderBase {
3330    public:
3331     ValueHolder() : value_() {}
3332     explicit ValueHolder(const T& value) : value_(value) {}
3333 
3334     T* pointer() { return &value_; }
3335 
3336    private:
3337     T value_;
3338     GTEST_DISALLOW_COPY_AND_ASSIGN_(ValueHolder);
3339   };
3340 
3341   static pthread_key_t CreateKey() {
3342     pthread_key_t key;
3343     // When a thread exits, DeleteThreadLocalValue() will be called on
3344     // the object managed for that thread.
3345     GTEST_CHECK_POSIX_SUCCESS_(
3346         pthread_key_create(&key, &DeleteThreadLocalValue));
3347     return key;
3348   }
3349 
3350   T* GetOrCreateValue() const {
3351     ThreadLocalValueHolderBase* const holder =
3352         static_cast<ThreadLocalValueHolderBase*>(pthread_getspecific(key_));
3353     if (holder != NULL) {
3354       return CheckedDowncastToActualType<ValueHolder>(holder)->pointer();
3355     }
3356 
3357     ValueHolder* const new_holder = default_factory_->MakeNewHolder();
3358     ThreadLocalValueHolderBase* const holder_base = new_holder;
3359     GTEST_CHECK_POSIX_SUCCESS_(pthread_setspecific(key_, holder_base));
3360     return new_holder->pointer();
3361   }
3362 
3363   class ValueHolderFactory {
3364    public:
3365     ValueHolderFactory() {}
3366     virtual ~ValueHolderFactory() {}
3367     virtual ValueHolder* MakeNewHolder() const = 0;
3368 
3369    private:
3370     GTEST_DISALLOW_COPY_AND_ASSIGN_(ValueHolderFactory);
3371   };
3372 
3373   class DefaultValueHolderFactory : public ValueHolderFactory {
3374    public:
3375     DefaultValueHolderFactory() {}
3376     virtual ValueHolder* MakeNewHolder() const { return new ValueHolder(); }
3377 
3378    private:
3379     GTEST_DISALLOW_COPY_AND_ASSIGN_(DefaultValueHolderFactory);
3380   };
3381 
3382   class InstanceValueHolderFactory : public ValueHolderFactory {
3383    public:
3384     explicit InstanceValueHolderFactory(const T& value) : value_(value) {}
3385     virtual ValueHolder* MakeNewHolder() const {
3386       return new ValueHolder(value_);
3387     }
3388 
3389    private:
3390     const T value_;  // The value for each thread.
3391 
3392     GTEST_DISALLOW_COPY_AND_ASSIGN_(InstanceValueHolderFactory);
3393   };
3394 
3395   // A key pthreads uses for looking up per-thread values.
3396   const pthread_key_t key_;
3397   scoped_ptr<ValueHolderFactory> default_factory_;
3398 
3399   GTEST_DISALLOW_COPY_AND_ASSIGN_(ThreadLocal);
3400 };
3401 
3402 # endif  // GTEST_HAS_MUTEX_AND_THREAD_LOCAL_
3403 
3404 #else  // GTEST_IS_THREADSAFE
3405 
3406 // A dummy implementation of synchronization primitives (mutex, lock,
3407 // and thread-local variable).  Necessary for compiling Google Test where
3408 // mutex is not supported - using Google Test in multiple threads is not
3409 // supported on such platforms.
3410 
3411 class Mutex {
3412  public:
3413   Mutex() {}
3414   void Lock() {}
3415   void Unlock() {}
3416   void AssertHeld() const {}
3417 };
3418 
3419 # define GTEST_DECLARE_STATIC_MUTEX_(mutex) \
3420   extern ::testing::internal::Mutex mutex
3421 
3422 # define GTEST_DEFINE_STATIC_MUTEX_(mutex) ::testing::internal::Mutex mutex
3423 
3424 // We cannot name this class MutexLock because the ctor declaration would
3425 // conflict with a macro named MutexLock, which is defined on some
3426 // platforms. That macro is used as a defensive measure to prevent against
3427 // inadvertent misuses of MutexLock like "MutexLock(&mu)" rather than
3428 // "MutexLock l(&mu)".  Hence the typedef trick below.
3429 class GTestMutexLock {
3430  public:
3431   explicit GTestMutexLock(Mutex*) {}  // NOLINT
3432 };
3433 
3434 typedef GTestMutexLock MutexLock;
3435 
3436 template <typename T>
3437 class ThreadLocal {
3438  public:
3439   ThreadLocal() : value_() {}
3440   explicit ThreadLocal(const T& value) : value_(value) {}
3441   T* pointer() { return &value_; }
3442   const T* pointer() const { return &value_; }
3443   const T& get() const { return value_; }
3444   void set(const T& value) { value_ = value; }
3445  private:
3446   T value_;
3447 };
3448 
3449 #endif  // GTEST_IS_THREADSAFE
3450 
3451 // Returns the number of threads running in the process, or 0 to indicate that
3452 // we cannot detect it.
3453 GTEST_API_ size_t GetThreadCount();
3454 
3455 // Passing non-POD classes through ellipsis (...) crashes the ARM
3456 // compiler and generates a warning in Sun Studio.  The Nokia Symbian
3457 // and the IBM XL C/C++ compiler try to instantiate a copy constructor
3458 // for objects passed through ellipsis (...), failing for uncopyable
3459 // objects.  We define this to ensure that only POD is passed through
3460 // ellipsis on these systems.
3461 #if defined(__SYMBIAN32__) || defined(__IBMCPP__) || defined(__SUNPRO_CC)
3462 // We lose support for NULL detection where the compiler doesn't like
3463 // passing non-POD classes through ellipsis (...).
3464 # define GTEST_ELLIPSIS_NEEDS_POD_ 1
3465 #else
3466 # define GTEST_CAN_COMPARE_NULL 1
3467 #endif
3468 
3469 // The Nokia Symbian and IBM XL C/C++ compilers cannot decide between
3470 // const T& and const T* in a function template.  These compilers
3471 // _can_ decide between class template specializations for T and T*,
3472 // so a tr1::type_traits-like is_pointer works.
3473 #if defined(__SYMBIAN32__) || defined(__IBMCPP__)
3474 # define GTEST_NEEDS_IS_POINTER_ 1
3475 #endif
3476 
3477 template <bool bool_value>
3478 struct bool_constant {
3479   typedef bool_constant<bool_value> type;
3480   static const bool value = bool_value;
3481 };
3482 template <bool bool_value> const bool bool_constant<bool_value>::value;
3483 
3484 typedef bool_constant<false> false_type;
3485 typedef bool_constant<true> true_type;
3486 
3487 template <typename T>
3488 struct is_pointer : public false_type {};
3489 
3490 template <typename T>
3491 struct is_pointer<T*> : public true_type {};
3492 
3493 template <typename Iterator>
3494 struct IteratorTraits {
3495   typedef typename Iterator::value_type value_type;
3496 };
3497 
3498 template <typename T>
3499 struct IteratorTraits<T*> {
3500   typedef T value_type;
3501 };
3502 
3503 template <typename T>
3504 struct IteratorTraits<const T*> {
3505   typedef T value_type;
3506 };
3507 
3508 #if GTEST_OS_WINDOWS
3509 # define GTEST_PATH_SEP_ "\\"
3510 # define GTEST_HAS_ALT_PATH_SEP_ 1
3511 // The biggest signed integer type the compiler supports.
3512 typedef __int64 BiggestInt;
3513 #else
3514 # define GTEST_PATH_SEP_ "/"
3515 # define GTEST_HAS_ALT_PATH_SEP_ 0
3516 typedef long long BiggestInt;  // NOLINT
3517 #endif  // GTEST_OS_WINDOWS
3518 
3519 // Utilities for char.
3520 
3521 // isspace(int ch) and friends accept an unsigned char or EOF.  char
3522 // may be signed, depending on the compiler (or compiler flags).
3523 // Therefore we need to cast a char to unsigned char before calling
3524 // isspace(), etc.
3525 
3526 inline bool IsAlpha(char ch) {
3527   return isalpha(static_cast<unsigned char>(ch)) != 0;
3528 }
3529 inline bool IsAlNum(char ch) {
3530   return isalnum(static_cast<unsigned char>(ch)) != 0;
3531 }
3532 inline bool IsDigit(char ch) {
3533   return isdigit(static_cast<unsigned char>(ch)) != 0;
3534 }
3535 inline bool IsLower(char ch) {
3536   return islower(static_cast<unsigned char>(ch)) != 0;
3537 }
3538 inline bool IsSpace(char ch) {
3539   return isspace(static_cast<unsigned char>(ch)) != 0;
3540 }
3541 inline bool IsUpper(char ch) {
3542   return isupper(static_cast<unsigned char>(ch)) != 0;
3543 }
3544 inline bool IsXDigit(char ch) {
3545   return isxdigit(static_cast<unsigned char>(ch)) != 0;
3546 }
3547 inline bool IsXDigit(wchar_t ch) {
3548   const unsigned char low_byte = static_cast<unsigned char>(ch);
3549   return ch == low_byte && isxdigit(low_byte) != 0;
3550 }
3551 
3552 inline char ToLower(char ch) {
3553   return static_cast<char>(tolower(static_cast<unsigned char>(ch)));
3554 }
3555 inline char ToUpper(char ch) {
3556   return static_cast<char>(toupper(static_cast<unsigned char>(ch)));
3557 }
3558 
3559 inline std::string StripTrailingSpaces(std::string str) {
3560   std::string::iterator it = str.end();
3561   while (it != str.begin() && IsSpace(*--it))
3562     it = str.erase(it);
3563   return str;
3564 }
3565 
3566 // The testing::internal::posix namespace holds wrappers for common
3567 // POSIX functions.  These wrappers hide the differences between
3568 // Windows/MSVC and POSIX systems.  Since some compilers define these
3569 // standard functions as macros, the wrapper cannot have the same name
3570 // as the wrapped function.
3571 
3572 namespace posix {
3573 
3574 // Functions with a different name on Windows.
3575 
3576 #if GTEST_OS_WINDOWS
3577 
3578 typedef struct _stat StatStruct;
3579 
3580 # ifdef __BORLANDC__
3581 inline int IsATTY(int fd) { return isatty(fd); }
3582 inline int StrCaseCmp(const char* s1, const char* s2) {
3583   return stricmp(s1, s2);
3584 }
3585 inline char* StrDup(const char* src) { return strdup(src); }
3586 # else  // !__BORLANDC__
3587 #  if GTEST_OS_WINDOWS_MOBILE
3588 inline int IsATTY(int /* fd */) { return 0; }
3589 #  else
3590 inline int IsATTY(int fd) { return _isatty(fd); }
3591 #  endif  // GTEST_OS_WINDOWS_MOBILE
3592 inline int StrCaseCmp(const char* s1, const char* s2) {
3593   return _stricmp(s1, s2);
3594 }
3595 inline char* StrDup(const char* src) { return _strdup(src); }
3596 # endif  // __BORLANDC__
3597 
3598 # if GTEST_OS_WINDOWS_MOBILE
3599 inline int FileNo(FILE* file) { return reinterpret_cast<int>(_fileno(file)); }
3600 // Stat(), RmDir(), and IsDir() are not needed on Windows CE at this
3601 // time and thus not defined there.
3602 # else
3603 inline int FileNo(FILE* file) { return _fileno(file); }
3604 inline int Stat(const char* path, StatStruct* buf) { return _stat(path, buf); }
3605 inline int RmDir(const char* dir) { return _rmdir(dir); }
3606 inline bool IsDir(const StatStruct& st) {
3607   return (_S_IFDIR & st.st_mode) != 0;
3608 }
3609 # endif  // GTEST_OS_WINDOWS_MOBILE
3610 
3611 #else
3612 
3613 typedef struct stat StatStruct;
3614 
3615 inline int FileNo(FILE* file) { return fileno(file); }
3616 inline int IsATTY(int fd) { return isatty(fd); }
3617 inline int Stat(const char* path, StatStruct* buf) { return stat(path, buf); }
3618 inline int StrCaseCmp(const char* s1, const char* s2) {
3619   return strcasecmp(s1, s2);
3620 }
3621 inline char* StrDup(const char* src) { return strdup(src); }
3622 inline int RmDir(const char* dir) { return rmdir(dir); }
3623 inline bool IsDir(const StatStruct& st) { return S_ISDIR(st.st_mode); }
3624 
3625 #endif  // GTEST_OS_WINDOWS
3626 
3627 // Functions deprecated by MSVC 8.0.
3628 
3629 GTEST_DISABLE_MSC_WARNINGS_PUSH_(4996 /* deprecated function */)
3630 
3631 inline const char* StrNCpy(char* dest, const char* src, size_t n) {
3632   return strncpy(dest, src, n);
3633 }
3634 
3635 // ChDir(), FReopen(), FDOpen(), Read(), Write(), Close(), and
3636 // StrError() aren't needed on Windows CE at this time and thus not
3637 // defined there.
3638 
3639 #if !GTEST_OS_WINDOWS_MOBILE && !GTEST_OS_WINDOWS_PHONE && !GTEST_OS_WINDOWS_RT
3640 inline int ChDir(const char* dir) { return chdir(dir); }
3641 #endif
3642 inline FILE* FOpen(const char* path, const char* mode) {
3643   return fopen(path, mode);
3644 }
3645 #if !GTEST_OS_WINDOWS_MOBILE
3646 inline FILE *FReopen(const char* path, const char* mode, FILE* stream) {
3647   return freopen(path, mode, stream);
3648 }
3649 inline FILE* FDOpen(int fd, const char* mode) { return fdopen(fd, mode); }
3650 #endif
3651 inline int FClose(FILE* fp) { return fclose(fp); }
3652 #if !GTEST_OS_WINDOWS_MOBILE
3653 inline int Read(int fd, void* buf, unsigned int count) {
3654   return static_cast<int>(read(fd, buf, count));
3655 }
3656 inline int Write(int fd, const void* buf, unsigned int count) {
3657   return static_cast<int>(write(fd, buf, count));
3658 }
3659 inline int Close(int fd) { return close(fd); }
3660 inline const char* StrError(int errnum) { return strerror(errnum); }
3661 #endif
3662 inline const char* GetEnv(const char* name) {
3663 #if GTEST_OS_WINDOWS_MOBILE || GTEST_OS_WINDOWS_PHONE | GTEST_OS_WINDOWS_RT
3664   // We are on Windows CE, which has no environment variables.
3665   static_cast<void>(name);  // To prevent 'unused argument' warning.
3666   return NULL;
3667 #elif defined(__BORLANDC__) || defined(__SunOS_5_8) || defined(__SunOS_5_9)
3668   // Environment variables which we programmatically clear will be set to the
3669   // empty string rather than unset (NULL).  Handle that case.
3670   const char* const env = getenv(name);
3671   return (env != NULL && env[0] != '\0') ? env : NULL;
3672 #else
3673   return getenv(name);
3674 #endif
3675 }
3676 
3677 GTEST_DISABLE_MSC_WARNINGS_POP_()
3678 
3679 #if GTEST_OS_WINDOWS_MOBILE
3680 // Windows CE has no C library. The abort() function is used in
3681 // several places in Google Test. This implementation provides a reasonable
3682 // imitation of standard behaviour.
3683 void Abort();
3684 #else
3685 inline void Abort() { abort(); }
3686 #endif  // GTEST_OS_WINDOWS_MOBILE
3687 
3688 }  // namespace posix
3689 
3690 // MSVC "deprecates" snprintf and issues warnings wherever it is used.  In
3691 // order to avoid these warnings, we need to use _snprintf or _snprintf_s on
3692 // MSVC-based platforms.  We map the GTEST_SNPRINTF_ macro to the appropriate
3693 // function in order to achieve that.  We use macro definition here because
3694 // snprintf is a variadic function.
3695 #if _MSC_VER >= 1400 && !GTEST_OS_WINDOWS_MOBILE
3696 // MSVC 2005 and above support variadic macros.
3697 # define GTEST_SNPRINTF_(buffer, size, format, ...) \
3698      _snprintf_s(buffer, size, size, format, __VA_ARGS__)
3699 #elif defined(_MSC_VER)
3700 // Windows CE does not define _snprintf_s and MSVC prior to 2005 doesn't
3701 // complain about _snprintf.
3702 # define GTEST_SNPRINTF_ _snprintf
3703 #else
3704 # define GTEST_SNPRINTF_ snprintf
3705 #endif
3706 
3707 // The maximum number a BiggestInt can represent.  This definition
3708 // works no matter BiggestInt is represented in one's complement or
3709 // two's complement.
3710 //
3711 // We cannot rely on numeric_limits in STL, as __int64 and long long
3712 // are not part of standard C++ and numeric_limits doesn't need to be
3713 // defined for them.
3714 const BiggestInt kMaxBiggestInt =
3715     ~(static_cast<BiggestInt>(1) << (8*sizeof(BiggestInt) - 1));
3716 
3717 // This template class serves as a compile-time function from size to
3718 // type.  It maps a size in bytes to a primitive type with that
3719 // size. e.g.
3720 //
3721 //   TypeWithSize<4>::UInt
3722 //
3723 // is typedef-ed to be unsigned int (unsigned integer made up of 4
3724 // bytes).
3725 //
3726 // Such functionality should belong to STL, but I cannot find it
3727 // there.
3728 //
3729 // Google Test uses this class in the implementation of floating-point
3730 // comparison.
3731 //
3732 // For now it only handles UInt (unsigned int) as that's all Google Test
3733 // needs.  Other types can be easily added in the future if need
3734 // arises.
3735 template <size_t size>
3736 class TypeWithSize {
3737  public:
3738   // This prevents the user from using TypeWithSize<N> with incorrect
3739   // values of N.
3740   typedef void UInt;
3741 };
3742 
3743 // The specialization for size 4.
3744 template <>
3745 class TypeWithSize<4> {
3746  public:
3747   // unsigned int has size 4 in both gcc and MSVC.
3748   //
3749   // As base/basictypes.h doesn't compile on Windows, we cannot use
3750   // uint32, uint64, and etc here.
3751   typedef int Int;
3752   typedef unsigned int UInt;
3753 };
3754 
3755 // The specialization for size 8.
3756 template <>
3757 class TypeWithSize<8> {
3758  public:
3759 #if GTEST_OS_WINDOWS
3760   typedef __int64 Int;
3761   typedef unsigned __int64 UInt;
3762 #else
3763   typedef long long Int;  // NOLINT
3764   typedef unsigned long long UInt;  // NOLINT
3765 #endif  // GTEST_OS_WINDOWS
3766 };
3767 
3768 // Integer types of known sizes.
3769 typedef TypeWithSize<4>::Int Int32;
3770 typedef TypeWithSize<4>::UInt UInt32;
3771 typedef TypeWithSize<8>::Int Int64;
3772 typedef TypeWithSize<8>::UInt UInt64;
3773 typedef TypeWithSize<8>::Int TimeInMillis;  // Represents time in milliseconds.
3774 
3775 // Utilities for command line flags and environment variables.
3776 
3777 // Macro for referencing flags.
3778 #if !defined(GTEST_FLAG)
3779 # define GTEST_FLAG(name) FLAGS_gtest_##name
3780 #endif  // !defined(GTEST_FLAG)
3781 
3782 #if !defined(GTEST_USE_OWN_FLAGFILE_FLAG_)
3783 # define GTEST_USE_OWN_FLAGFILE_FLAG_ 1
3784 #endif  // !defined(GTEST_USE_OWN_FLAGFILE_FLAG_)
3785 
3786 #if !defined(GTEST_DECLARE_bool_)
3787 # define GTEST_FLAG_SAVER_ ::testing::internal::GTestFlagSaver
3788 
3789 // Macros for declaring flags.
3790 # define GTEST_DECLARE_bool_(name) GTEST_API_ extern bool GTEST_FLAG(name)
3791 # define GTEST_DECLARE_int32_(name) \
3792     GTEST_API_ extern ::testing::internal::Int32 GTEST_FLAG(name)
3793 #define GTEST_DECLARE_string_(name) \
3794     GTEST_API_ extern ::std::string GTEST_FLAG(name)
3795 
3796 // Macros for defining flags.
3797 #define GTEST_DEFINE_bool_(name, default_val, doc) \
3798     GTEST_API_ bool GTEST_FLAG(name) = (default_val)
3799 #define GTEST_DEFINE_int32_(name, default_val, doc) \
3800     GTEST_API_ ::testing::internal::Int32 GTEST_FLAG(name) = (default_val)
3801 #define GTEST_DEFINE_string_(name, default_val, doc) \
3802     GTEST_API_ ::std::string GTEST_FLAG(name) = (default_val)
3803 
3804 #endif  // !defined(GTEST_DECLARE_bool_)
3805 
3806 // Thread annotations
3807 #if !defined(GTEST_EXCLUSIVE_LOCK_REQUIRED_)
3808 # define GTEST_EXCLUSIVE_LOCK_REQUIRED_(locks)
3809 # define GTEST_LOCK_EXCLUDED_(locks)
3810 #endif  // !defined(GTEST_EXCLUSIVE_LOCK_REQUIRED_)
3811 
3812 // Parses 'str' for a 32-bit signed integer.  If successful, writes the result
3813 // to *value and returns true; otherwise leaves *value unchanged and returns
3814 // false.
3815 // TODO(chandlerc): Find a better way to refactor flag and environment parsing
3816 // out of both gtest-port.cc and gtest.cc to avoid exporting this utility
3817 // function.
3818 bool ParseInt32(const Message& src_text, const char* str, Int32* value);
3819 
3820 // Parses a bool/Int32/string from the environment variable
3821 // corresponding to the given Google Test flag.
3822 bool BoolFromGTestEnv(const char* flag, bool default_val);
3823 GTEST_API_ Int32 Int32FromGTestEnv(const char* flag, Int32 default_val);
3824 std::string StringFromGTestEnv(const char* flag, const char* default_val);
3825 
3826 }  // namespace internal
3827 }  // namespace testing
3828 
3829 #endif  // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PORT_H_
3830 
3831 #if GTEST_OS_LINUX
3832 # include <stdlib.h>
3833 # include <sys/types.h>
3834 # include <sys/wait.h>
3835 # include <unistd.h>
3836 #endif  // GTEST_OS_LINUX
3837 
3838 #if GTEST_HAS_EXCEPTIONS
3839 # include <stdexcept>
3840 #endif
3841 
3842 #include <ctype.h>
3843 #include <float.h>
3844 #include <string.h>
3845 #include <iomanip>
3846 #include <limits>
3847 #include <map>
3848 #include <set>
3849 #include <string>
3850 #include <vector>
3851 
3852 // Copyright 2005, Google Inc.
3853 // All rights reserved.
3854 //
3855 // Redistribution and use in source and binary forms, with or without
3856 // modification, are permitted provided that the following conditions are
3857 // met:
3858 //
3859 //     * Redistributions of source code must retain the above copyright
3860 // notice, this list of conditions and the following disclaimer.
3861 //     * Redistributions in binary form must reproduce the above
3862 // copyright notice, this list of conditions and the following disclaimer
3863 // in the documentation and/or other materials provided with the
3864 // distribution.
3865 //     * Neither the name of Google Inc. nor the names of its
3866 // contributors may be used to endorse or promote products derived from
3867 // this software without specific prior written permission.
3868 //
3869 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
3870 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
3871 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
3872 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
3873 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
3874 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
3875 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
3876 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
3877 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
3878 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
3879 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
3880 //
3881 // Author: wan@google.com (Zhanyong Wan)
3882 //
3883 // The Google C++ Testing Framework (Google Test)
3884 //
3885 // This header file defines the Message class.
3886 //
3887 // IMPORTANT NOTE: Due to limitation of the C++ language, we have to
3888 // leave some internal implementation details in this header file.
3889 // They are clearly marked by comments like this:
3890 //
3891 //   // INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
3892 //
3893 // Such code is NOT meant to be used by a user directly, and is subject
3894 // to CHANGE WITHOUT NOTICE.  Therefore DO NOT DEPEND ON IT in a user
3895 // program!
3896 
3897 #ifndef GTEST_INCLUDE_GTEST_GTEST_MESSAGE_H_
3898 #define GTEST_INCLUDE_GTEST_GTEST_MESSAGE_H_
3899 
3900 #include <limits>
3901 
3902 
3903 // Ensures that there is at least one operator<< in the global namespace.
3904 // See Message& operator<<(...) below for why.
3905 void operator<<(const testing::internal::Secret&, int);
3906 
3907 namespace testing {
3908 
3909 // The Message class works like an ostream repeater.
3910 //
3911 // Typical usage:
3912 //
3913 //   1. You stream a bunch of values to a Message object.
3914 //      It will remember the text in a stringstream.
3915 //   2. Then you stream the Message object to an ostream.
3916 //      This causes the text in the Message to be streamed
3917 //      to the ostream.
3918 //
3919 // For example;
3920 //
3921 //   testing::Message foo;
3922 //   foo << 1 << " != " << 2;
3923 //   std::cout << foo;
3924 //
3925 // will print "1 != 2".
3926 //
3927 // Message is not intended to be inherited from.  In particular, its
3928 // destructor is not virtual.
3929 //
3930 // Note that stringstream behaves differently in gcc and in MSVC.  You
3931 // can stream a NULL char pointer to it in the former, but not in the
3932 // latter (it causes an access violation if you do).  The Message
3933 // class hides this difference by treating a NULL char pointer as
3934 // "(null)".
3935 class GTEST_API_ Message {
3936  private:
3937   // The type of basic IO manipulators (endl, ends, and flush) for
3938   // narrow streams.
3939   typedef std::ostream& (*BasicNarrowIoManip)(std::ostream&);
3940 
3941  public:
3942   // Constructs an empty Message.
3943   Message();
3944 
3945   // Copy constructor.
3946   Message(const Message& msg) : ss_(new ::std::stringstream) {  // NOLINT
3947     *ss_ << msg.GetString();
3948   }
3949 
3950   // Constructs a Message from a C-string.
3951   explicit Message(const char* str) : ss_(new ::std::stringstream) {
3952     *ss_ << str;
3953   }
3954 
3955 #if GTEST_OS_SYMBIAN
3956   // Streams a value (either a pointer or not) to this object.
3957   template <typename T>
3958   inline Message& operator <<(const T& value) {
3959     StreamHelper(typename internal::is_pointer<T>::type(), value);
3960     return *this;
3961   }
3962 #else
3963   // Streams a non-pointer value to this object.
3964   template <typename T>
3965   inline Message& operator <<(const T& val) {
3966     // Some libraries overload << for STL containers.  These
3967     // overloads are defined in the global namespace instead of ::std.
3968     //
3969     // C++'s symbol lookup rule (i.e. Koenig lookup) says that these
3970     // overloads are visible in either the std namespace or the global
3971     // namespace, but not other namespaces, including the testing
3972     // namespace which Google Test's Message class is in.
3973     //
3974     // To allow STL containers (and other types that has a << operator
3975     // defined in the global namespace) to be used in Google Test
3976     // assertions, testing::Message must access the custom << operator
3977     // from the global namespace.  With this using declaration,
3978     // overloads of << defined in the global namespace and those
3979     // visible via Koenig lookup are both exposed in this function.
3980     using ::operator <<;
3981     *ss_ << val;
3982     return *this;
3983   }
3984 
3985   // Streams a pointer value to this object.
3986   //
3987   // This function is an overload of the previous one.  When you
3988   // stream a pointer to a Message, this definition will be used as it
3989   // is more specialized.  (The C++ Standard, section
3990   // [temp.func.order].)  If you stream a non-pointer, then the
3991   // previous definition will be used.
3992   //
3993   // The reason for this overload is that streaming a NULL pointer to
3994   // ostream is undefined behavior.  Depending on the compiler, you
3995   // may get "0", "(nil)", "(null)", or an access violation.  To
3996   // ensure consistent result across compilers, we always treat NULL
3997   // as "(null)".
3998   template <typename T>
3999   inline Message& operator <<(T* const& pointer) {  // NOLINT
4000     if (pointer == NULL) {
4001       *ss_ << "(null)";
4002     } else {
4003       *ss_ << pointer;
4004     }
4005     return *this;
4006   }
4007 #endif  // GTEST_OS_SYMBIAN
4008 
4009   // Since the basic IO manipulators are overloaded for both narrow
4010   // and wide streams, we have to provide this specialized definition
4011   // of operator <<, even though its body is the same as the
4012   // templatized version above.  Without this definition, streaming
4013   // endl or other basic IO manipulators to Message will confuse the
4014   // compiler.
4015   Message& operator <<(BasicNarrowIoManip val) {
4016     *ss_ << val;
4017     return *this;
4018   }
4019 
4020   // Instead of 1/0, we want to see true/false for bool values.
4021   Message& operator <<(bool b) {
4022     return *this << (b ? "true" : "false");
4023   }
4024 
4025   // These two overloads allow streaming a wide C string to a Message
4026   // using the UTF-8 encoding.
4027   Message& operator <<(const wchar_t* wide_c_str);
4028   Message& operator <<(wchar_t* wide_c_str);
4029 
4030 #if GTEST_HAS_STD_WSTRING
4031   // Converts the given wide string to a narrow string using the UTF-8
4032   // encoding, and streams the result to this Message object.
4033   Message& operator <<(const ::std::wstring& wstr);
4034 #endif  // GTEST_HAS_STD_WSTRING
4035 
4036 #if GTEST_HAS_GLOBAL_WSTRING
4037   // Converts the given wide string to a narrow string using the UTF-8
4038   // encoding, and streams the result to this Message object.
4039   Message& operator <<(const ::wstring& wstr);
4040 #endif  // GTEST_HAS_GLOBAL_WSTRING
4041 
4042   // Gets the text streamed to this object so far as an std::string.
4043   // Each '\0' character in the buffer is replaced with "\\0".
4044   //
4045   // INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
4046   std::string GetString() const;
4047 
4048  private:
4049 
4050 #if GTEST_OS_SYMBIAN
4051   // These are needed as the Nokia Symbian Compiler cannot decide between
4052   // const T& and const T* in a function template. The Nokia compiler _can_
4053   // decide between class template specializations for T and T*, so a
4054   // tr1::type_traits-like is_pointer works, and we can overload on that.
4055   template <typename T>
4056   inline void StreamHelper(internal::true_type /*is_pointer*/, T* pointer) {
4057     if (pointer == NULL) {
4058       *ss_ << "(null)";
4059     } else {
4060       *ss_ << pointer;
4061     }
4062   }
4063   template <typename T>
4064   inline void StreamHelper(internal::false_type /*is_pointer*/,
4065                            const T& value) {
4066     // See the comments in Message& operator <<(const T&) above for why
4067     // we need this using statement.
4068     using ::operator <<;
4069     *ss_ << value;
4070   }
4071 #endif  // GTEST_OS_SYMBIAN
4072 
4073   // We'll hold the text streamed to this object here.
4074   const internal::scoped_ptr< ::std::stringstream> ss_;
4075 
4076   // We declare (but don't implement) this to prevent the compiler
4077   // from implementing the assignment operator.
4078   void operator=(const Message&);
4079 };
4080 
4081 // Streams a Message to an ostream.
4082 inline std::ostream& operator <<(std::ostream& os, const Message& sb) {
4083   return os << sb.GetString();
4084 }
4085 
4086 namespace internal {
4087 
4088 // Converts a streamable value to an std::string.  A NULL pointer is
4089 // converted to "(null)".  When the input value is a ::string,
4090 // ::std::string, ::wstring, or ::std::wstring object, each NUL
4091 // character in it is replaced with "\\0".
4092 template <typename T>
4093 std::string StreamableToString(const T& streamable) {
4094   return (Message() << streamable).GetString();
4095 }
4096 
4097 }  // namespace internal
4098 }  // namespace testing
4099 
4100 #endif  // GTEST_INCLUDE_GTEST_GTEST_MESSAGE_H_
4101 // Copyright 2005, Google Inc.
4102 // All rights reserved.
4103 //
4104 // Redistribution and use in source and binary forms, with or without
4105 // modification, are permitted provided that the following conditions are
4106 // met:
4107 //
4108 //     * Redistributions of source code must retain the above copyright
4109 // notice, this list of conditions and the following disclaimer.
4110 //     * Redistributions in binary form must reproduce the above
4111 // copyright notice, this list of conditions and the following disclaimer
4112 // in the documentation and/or other materials provided with the
4113 // distribution.
4114 //     * Neither the name of Google Inc. nor the names of its
4115 // contributors may be used to endorse or promote products derived from
4116 // this software without specific prior written permission.
4117 //
4118 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
4119 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
4120 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
4121 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
4122 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
4123 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
4124 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
4125 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
4126 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
4127 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
4128 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
4129 //
4130 // Authors: wan@google.com (Zhanyong Wan), eefacm@gmail.com (Sean Mcafee)
4131 //
4132 // The Google C++ Testing Framework (Google Test)
4133 //
4134 // This header file declares the String class and functions used internally by
4135 // Google Test.  They are subject to change without notice. They should not used
4136 // by code external to Google Test.
4137 //
4138 // This header file is #included by <gtest/internal/gtest-internal.h>.
4139 // It should not be #included by other files.
4140 
4141 #ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_STRING_H_
4142 #define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_STRING_H_
4143 
4144 #ifdef __BORLANDC__
4145 // string.h is not guaranteed to provide strcpy on C++ Builder.
4146 # include <mem.h>
4147 #endif
4148 
4149 #include <string.h>
4150 #include <string>
4151 
4152 
4153 namespace testing {
4154 namespace internal {
4155 
4156 // String - an abstract class holding static string utilities.
4157 class GTEST_API_ String {
4158  public:
4159   // Static utility methods
4160 
4161   // Clones a 0-terminated C string, allocating memory using new.  The
4162   // caller is responsible for deleting the return value using
4163   // delete[].  Returns the cloned string, or NULL if the input is
4164   // NULL.
4165   //
4166   // This is different from strdup() in string.h, which allocates
4167   // memory using malloc().
4168   static const char* CloneCString(const char* c_str);
4169 
4170 #if GTEST_OS_WINDOWS_MOBILE
4171   // Windows CE does not have the 'ANSI' versions of Win32 APIs. To be
4172   // able to pass strings to Win32 APIs on CE we need to convert them
4173   // to 'Unicode', UTF-16.
4174 
4175   // Creates a UTF-16 wide string from the given ANSI string, allocating
4176   // memory using new. The caller is responsible for deleting the return
4177   // value using delete[]. Returns the wide string, or NULL if the
4178   // input is NULL.
4179   //
4180   // The wide string is created using the ANSI codepage (CP_ACP) to
4181   // match the behaviour of the ANSI versions of Win32 calls and the
4182   // C runtime.
4183   static LPCWSTR AnsiToUtf16(const char* c_str);
4184 
4185   // Creates an ANSI string from the given wide string, allocating
4186   // memory using new. The caller is responsible for deleting the return
4187   // value using delete[]. Returns the ANSI string, or NULL if the
4188   // input is NULL.
4189   //
4190   // The returned string is created using the ANSI codepage (CP_ACP) to
4191   // match the behaviour of the ANSI versions of Win32 calls and the
4192   // C runtime.
4193   static const char* Utf16ToAnsi(LPCWSTR utf16_str);
4194 #endif
4195 
4196   // Compares two C strings.  Returns true iff they have the same content.
4197   //
4198   // Unlike strcmp(), this function can handle NULL argument(s).  A
4199   // NULL C string is considered different to any non-NULL C string,
4200   // including the empty string.
4201   static bool CStringEquals(const char* lhs, const char* rhs);
4202 
4203   // Converts a wide C string to a String using the UTF-8 encoding.
4204   // NULL will be converted to "(null)".  If an error occurred during
4205   // the conversion, "(failed to convert from wide string)" is
4206   // returned.
4207   static std::string ShowWideCString(const wchar_t* wide_c_str);
4208 
4209   // Compares two wide C strings.  Returns true iff they have the same
4210   // content.
4211   //
4212   // Unlike wcscmp(), this function can handle NULL argument(s).  A
4213   // NULL C string is considered different to any non-NULL C string,
4214   // including the empty string.
4215   static bool WideCStringEquals(const wchar_t* lhs, const wchar_t* rhs);
4216 
4217   // Compares two C strings, ignoring case.  Returns true iff they
4218   // have the same content.
4219   //
4220   // Unlike strcasecmp(), this function can handle NULL argument(s).
4221   // A NULL C string is considered different to any non-NULL C string,
4222   // including the empty string.
4223   static bool CaseInsensitiveCStringEquals(const char* lhs,
4224                                            const char* rhs);
4225 
4226   // Compares two wide C strings, ignoring case.  Returns true iff they
4227   // have the same content.
4228   //
4229   // Unlike wcscasecmp(), this function can handle NULL argument(s).
4230   // A NULL C string is considered different to any non-NULL wide C string,
4231   // including the empty string.
4232   // NB: The implementations on different platforms slightly differ.
4233   // On windows, this method uses _wcsicmp which compares according to LC_CTYPE
4234   // environment variable. On GNU platform this method uses wcscasecmp
4235   // which compares according to LC_CTYPE category of the current locale.
4236   // On MacOS X, it uses towlower, which also uses LC_CTYPE category of the
4237   // current locale.
4238   static bool CaseInsensitiveWideCStringEquals(const wchar_t* lhs,
4239                                                const wchar_t* rhs);
4240 
4241   // Returns true iff the given string ends with the given suffix, ignoring
4242   // case. Any string is considered to end with an empty suffix.
4243   static bool EndsWithCaseInsensitive(
4244       const std::string& str, const std::string& suffix);
4245 
4246   // Formats an int value as "%02d".
4247   static std::string FormatIntWidth2(int value);  // "%02d" for width == 2
4248 
4249   // Formats an int value as "%X".
4250   static std::string FormatHexInt(int value);
4251 
4252   // Formats a byte as "%02X".
4253   static std::string FormatByte(unsigned char value);
4254 
4255  private:
4256   String();  // Not meant to be instantiated.
4257 };  // class String
4258 
4259 // Gets the content of the stringstream's buffer as an std::string.  Each '\0'
4260 // character in the buffer is replaced with "\\0".
4261 GTEST_API_ std::string StringStreamToString(::std::stringstream* stream);
4262 
4263 }  // namespace internal
4264 }  // namespace testing
4265 
4266 #endif  // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_STRING_H_
4267 // Copyright 2008, Google Inc.
4268 // All rights reserved.
4269 //
4270 // Redistribution and use in source and binary forms, with or without
4271 // modification, are permitted provided that the following conditions are
4272 // met:
4273 //
4274 //     * Redistributions of source code must retain the above copyright
4275 // notice, this list of conditions and the following disclaimer.
4276 //     * Redistributions in binary form must reproduce the above
4277 // copyright notice, this list of conditions and the following disclaimer
4278 // in the documentation and/or other materials provided with the
4279 // distribution.
4280 //     * Neither the name of Google Inc. nor the names of its
4281 // contributors may be used to endorse or promote products derived from
4282 // this software without specific prior written permission.
4283 //
4284 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
4285 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
4286 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
4287 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
4288 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
4289 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
4290 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
4291 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
4292 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
4293 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
4294 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
4295 //
4296 // Author: keith.ray@gmail.com (Keith Ray)
4297 //
4298 // Google Test filepath utilities
4299 //
4300 // This header file declares classes and functions used internally by
4301 // Google Test.  They are subject to change without notice.
4302 //
4303 // This file is #included in <gtest/internal/gtest-internal.h>.
4304 // Do not include this header file separately!
4305 
4306 #ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_FILEPATH_H_
4307 #define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_FILEPATH_H_
4308 
4309 
4310 namespace testing {
4311 namespace internal {
4312 
4313 // FilePath - a class for file and directory pathname manipulation which
4314 // handles platform-specific conventions (like the pathname separator).
4315 // Used for helper functions for naming files in a directory for xml output.
4316 // Except for Set methods, all methods are const or static, which provides an
4317 // "immutable value object" -- useful for peace of mind.
4318 // A FilePath with a value ending in a path separator ("like/this/") represents
4319 // a directory, otherwise it is assumed to represent a file. In either case,
4320 // it may or may not represent an actual file or directory in the file system.
4321 // Names are NOT checked for syntax correctness -- no checking for illegal
4322 // characters, malformed paths, etc.
4323 
4324 class GTEST_API_ FilePath {
4325  public:
4326   FilePath() : pathname_("") { }
4327   FilePath(const FilePath& rhs) : pathname_(rhs.pathname_) { }
4328 
4329   explicit FilePath(const std::string& pathname) : pathname_(pathname) {
4330     Normalize();
4331   }
4332 
4333   FilePath& operator=(const FilePath& rhs) {
4334     Set(rhs);
4335     return *this;
4336   }
4337 
4338   void Set(const FilePath& rhs) {
4339     pathname_ = rhs.pathname_;
4340   }
4341 
4342   const std::string& string() const { return pathname_; }
4343   const char* c_str() const { return pathname_.c_str(); }
4344 
4345   // Returns the current working directory, or "" if unsuccessful.
4346   static FilePath GetCurrentDir();
4347 
4348   // Given directory = "dir", base_name = "test", number = 0,
4349   // extension = "xml", returns "dir/test.xml". If number is greater
4350   // than zero (e.g., 12), returns "dir/test_12.xml".
4351   // On Windows platform, uses \ as the separator rather than /.
4352   static FilePath MakeFileName(const FilePath& directory,
4353                                const FilePath& base_name,
4354                                int number,
4355                                const char* extension);
4356 
4357   // Given directory = "dir", relative_path = "test.xml",
4358   // returns "dir/test.xml".
4359   // On Windows, uses \ as the separator rather than /.
4360   static FilePath ConcatPaths(const FilePath& directory,
4361                               const FilePath& relative_path);
4362 
4363   // Returns a pathname for a file that does not currently exist. The pathname
4364   // will be directory/base_name.extension or
4365   // directory/base_name_<number>.extension if directory/base_name.extension
4366   // already exists. The number will be incremented until a pathname is found
4367   // that does not already exist.
4368   // Examples: 'dir/foo_test.xml' or 'dir/foo_test_1.xml'.
4369   // There could be a race condition if two or more processes are calling this
4370   // function at the same time -- they could both pick the same filename.
4371   static FilePath GenerateUniqueFileName(const FilePath& directory,
4372                                          const FilePath& base_name,
4373                                          const char* extension);
4374 
4375   // Returns true iff the path is "".
4376   bool IsEmpty() const { return pathname_.empty(); }
4377 
4378   // If input name has a trailing separator character, removes it and returns
4379   // the name, otherwise return the name string unmodified.
4380   // On Windows platform, uses \ as the separator, other platforms use /.
4381   FilePath RemoveTrailingPathSeparator() const;
4382 
4383   // Returns a copy of the FilePath with the directory part removed.
4384   // Example: FilePath("path/to/file").RemoveDirectoryName() returns
4385   // FilePath("file"). If there is no directory part ("just_a_file"), it returns
4386   // the FilePath unmodified. If there is no file part ("just_a_dir/") it
4387   // returns an empty FilePath ("").
4388   // On Windows platform, '\' is the path separator, otherwise it is '/'.
4389   FilePath RemoveDirectoryName() const;
4390 
4391   // RemoveFileName returns the directory path with the filename removed.
4392   // Example: FilePath("path/to/file").RemoveFileName() returns "path/to/".
4393   // If the FilePath is "a_file" or "/a_file", RemoveFileName returns
4394   // FilePath("./") or, on Windows, FilePath(".\\"). If the filepath does
4395   // not have a file, like "just/a/dir/", it returns the FilePath unmodified.
4396   // On Windows platform, '\' is the path separator, otherwise it is '/'.
4397   FilePath RemoveFileName() const;
4398 
4399   // Returns a copy of the FilePath with the case-insensitive extension removed.
4400   // Example: FilePath("dir/file.exe").RemoveExtension("EXE") returns
4401   // FilePath("dir/file"). If a case-insensitive extension is not
4402   // found, returns a copy of the original FilePath.
4403   FilePath RemoveExtension(const char* extension) const;
4404 
4405   // Creates directories so that path exists. Returns true if successful or if
4406   // the directories already exist; returns false if unable to create
4407   // directories for any reason. Will also return false if the FilePath does
4408   // not represent a directory (that is, it doesn't end with a path separator).
4409   bool CreateDirectoriesRecursively() const;
4410 
4411   // Create the directory so that path exists. Returns true if successful or
4412   // if the directory already exists; returns false if unable to create the
4413   // directory for any reason, including if the parent directory does not
4414   // exist. Not named "CreateDirectory" because that's a macro on Windows.
4415   bool CreateFolder() const;
4416 
4417   // Returns true if FilePath describes something in the file-system,
4418   // either a file, directory, or whatever, and that something exists.
4419   bool FileOrDirectoryExists() const;
4420 
4421   // Returns true if pathname describes a directory in the file-system
4422   // that exists.
4423   bool DirectoryExists() const;
4424 
4425   // Returns true if FilePath ends with a path separator, which indicates that
4426   // it is intended to represent a directory. Returns false otherwise.
4427   // This does NOT check that a directory (or file) actually exists.
4428   bool IsDirectory() const;
4429 
4430   // Returns true if pathname describes a root directory. (Windows has one
4431   // root directory per disk drive.)
4432   bool IsRootDirectory() const;
4433 
4434   // Returns true if pathname describes an absolute path.
4435   bool IsAbsolutePath() const;
4436 
4437  private:
4438   // Replaces multiple consecutive separators with a single separator.
4439   // For example, "bar///foo" becomes "bar/foo". Does not eliminate other
4440   // redundancies that might be in a pathname involving "." or "..".
4441   //
4442   // A pathname with multiple consecutive separators may occur either through
4443   // user error or as a result of some scripts or APIs that generate a pathname
4444   // with a trailing separator. On other platforms the same API or script
4445   // may NOT generate a pathname with a trailing "/". Then elsewhere that
4446   // pathname may have another "/" and pathname components added to it,
4447   // without checking for the separator already being there.
4448   // The script language and operating system may allow paths like "foo//bar"
4449   // but some of the functions in FilePath will not handle that correctly. In
4450   // particular, RemoveTrailingPathSeparator() only removes one separator, and
4451   // it is called in CreateDirectoriesRecursively() assuming that it will change
4452   // a pathname from directory syntax (trailing separator) to filename syntax.
4453   //
4454   // On Windows this method also replaces the alternate path separator '/' with
4455   // the primary path separator '\\', so that for example "bar\\/\\foo" becomes
4456   // "bar\\foo".
4457 
4458   void Normalize();
4459 
4460   // Returns a pointer to the last occurence of a valid path separator in
4461   // the FilePath. On Windows, for example, both '/' and '\' are valid path
4462   // separators. Returns NULL if no path separator was found.
4463   const char* FindLastPathSeparator() const;
4464 
4465   std::string pathname_;
4466 };  // class FilePath
4467 
4468 }  // namespace internal
4469 }  // namespace testing
4470 
4471 #endif  // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_FILEPATH_H_
4472 // This file was GENERATED by command:
4473 //     pump.py gtest-type-util.h.pump
4474 // DO NOT EDIT BY HAND!!!
4475 
4476 // Copyright 2008 Google Inc.
4477 // All Rights Reserved.
4478 //
4479 // Redistribution and use in source and binary forms, with or without
4480 // modification, are permitted provided that the following conditions are
4481 // met:
4482 //
4483 //     * Redistributions of source code must retain the above copyright
4484 // notice, this list of conditions and the following disclaimer.
4485 //     * Redistributions in binary form must reproduce the above
4486 // copyright notice, this list of conditions and the following disclaimer
4487 // in the documentation and/or other materials provided with the
4488 // distribution.
4489 //     * Neither the name of Google Inc. nor the names of its
4490 // contributors may be used to endorse or promote products derived from
4491 // this software without specific prior written permission.
4492 //
4493 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
4494 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
4495 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
4496 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
4497 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
4498 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
4499 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
4500 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
4501 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
4502 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
4503 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
4504 //
4505 // Author: wan@google.com (Zhanyong Wan)
4506 
4507 // Type utilities needed for implementing typed and type-parameterized
4508 // tests.  This file is generated by a SCRIPT.  DO NOT EDIT BY HAND!
4509 //
4510 // Currently we support at most 50 types in a list, and at most 50
4511 // type-parameterized tests in one type-parameterized test case.
4512 // Please contact googletestframework@googlegroups.com if you need
4513 // more.
4514 
4515 #ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_TYPE_UTIL_H_
4516 #define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_TYPE_UTIL_H_
4517 
4518 
4519 // #ifdef __GNUC__ is too general here.  It is possible to use gcc without using
4520 // libstdc++ (which is where cxxabi.h comes from).
4521 # if GTEST_HAS_CXXABI_H_
4522 #  include <cxxabi.h>
4523 # elif defined(__HP_aCC)
4524 #  include <acxx_demangle.h>
4525 # endif  // GTEST_HASH_CXXABI_H_
4526 
4527 namespace testing {
4528 namespace internal {
4529 
4530 // GetTypeName<T>() returns a human-readable name of type T.
4531 // NB: This function is also used in Google Mock, so don't move it inside of
4532 // the typed-test-only section below.
4533 template <typename T>
4534 std::string GetTypeName() {
4535 # if GTEST_HAS_RTTI
4536 
4537   const char* const name = typeid(T).name();
4538 #  if GTEST_HAS_CXXABI_H_ || defined(__HP_aCC)
4539   int status = 0;
4540   // gcc's implementation of typeid(T).name() mangles the type name,
4541   // so we have to demangle it.
4542 #   if GTEST_HAS_CXXABI_H_
4543   using abi::__cxa_demangle;
4544 #   endif  // GTEST_HAS_CXXABI_H_
4545   char* const readable_name = __cxa_demangle(name, 0, 0, &status);
4546   const std::string name_str(status == 0 ? readable_name : name);
4547   free(readable_name);
4548   return name_str;
4549 #  else
4550   return name;
4551 #  endif  // GTEST_HAS_CXXABI_H_ || __HP_aCC
4552 
4553 # else
4554 
4555   return "<type>";
4556 
4557 # endif  // GTEST_HAS_RTTI
4558 }
4559 
4560 #if GTEST_HAS_TYPED_TEST || GTEST_HAS_TYPED_TEST_P
4561 
4562 // AssertyTypeEq<T1, T2>::type is defined iff T1 and T2 are the same
4563 // type.  This can be used as a compile-time assertion to ensure that
4564 // two types are equal.
4565 
4566 template <typename T1, typename T2>
4567 struct AssertTypeEq;
4568 
4569 template <typename T>
4570 struct AssertTypeEq<T, T> {
4571   typedef bool type;
4572 };
4573 
4574 // A unique type used as the default value for the arguments of class
4575 // template Types.  This allows us to simulate variadic templates
4576 // (e.g. Types<int>, Type<int, double>, and etc), which C++ doesn't
4577 // support directly.
4578 struct None {};
4579 
4580 // The following family of struct and struct templates are used to
4581 // represent type lists.  In particular, TypesN<T1, T2, ..., TN>
4582 // represents a type list with N types (T1, T2, ..., and TN) in it.
4583 // Except for Types0, every struct in the family has two member types:
4584 // Head for the first type in the list, and Tail for the rest of the
4585 // list.
4586 
4587 // The empty type list.
4588 struct Types0 {};
4589 
4590 // Type lists of length 1, 2, 3, and so on.
4591 
4592 template <typename T1>
4593 struct Types1 {
4594   typedef T1 Head;
4595   typedef Types0 Tail;
4596 };
4597 template <typename T1, typename T2>
4598 struct Types2 {
4599   typedef T1 Head;
4600   typedef Types1<T2> Tail;
4601 };
4602 
4603 template <typename T1, typename T2, typename T3>
4604 struct Types3 {
4605   typedef T1 Head;
4606   typedef Types2<T2, T3> Tail;
4607 };
4608 
4609 template <typename T1, typename T2, typename T3, typename T4>
4610 struct Types4 {
4611   typedef T1 Head;
4612   typedef Types3<T2, T3, T4> Tail;
4613 };
4614 
4615 template <typename T1, typename T2, typename T3, typename T4, typename T5>
4616 struct Types5 {
4617   typedef T1 Head;
4618   typedef Types4<T2, T3, T4, T5> Tail;
4619 };
4620 
4621 template <typename T1, typename T2, typename T3, typename T4, typename T5,
4622     typename T6>
4623 struct Types6 {
4624   typedef T1 Head;
4625   typedef Types5<T2, T3, T4, T5, T6> Tail;
4626 };
4627 
4628 template <typename T1, typename T2, typename T3, typename T4, typename T5,
4629     typename T6, typename T7>
4630 struct Types7 {
4631   typedef T1 Head;
4632   typedef Types6<T2, T3, T4, T5, T6, T7> Tail;
4633 };
4634 
4635 template <typename T1, typename T2, typename T3, typename T4, typename T5,
4636     typename T6, typename T7, typename T8>
4637 struct Types8 {
4638   typedef T1 Head;
4639   typedef Types7<T2, T3, T4, T5, T6, T7, T8> Tail;
4640 };
4641 
4642 template <typename T1, typename T2, typename T3, typename T4, typename T5,
4643     typename T6, typename T7, typename T8, typename T9>
4644 struct Types9 {
4645   typedef T1 Head;
4646   typedef Types8<T2, T3, T4, T5, T6, T7, T8, T9> Tail;
4647 };
4648 
4649 template <typename T1, typename T2, typename T3, typename T4, typename T5,
4650     typename T6, typename T7, typename T8, typename T9, typename T10>
4651 struct Types10 {
4652   typedef T1 Head;
4653   typedef Types9<T2, T3, T4, T5, T6, T7, T8, T9, T10> Tail;
4654 };
4655 
4656 template <typename T1, typename T2, typename T3, typename T4, typename T5,
4657     typename T6, typename T7, typename T8, typename T9, typename T10,
4658     typename T11>
4659 struct Types11 {
4660   typedef T1 Head;
4661   typedef Types10<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11> Tail;
4662 };
4663 
4664 template <typename T1, typename T2, typename T3, typename T4, typename T5,
4665     typename T6, typename T7, typename T8, typename T9, typename T10,
4666     typename T11, typename T12>
4667 struct Types12 {
4668   typedef T1 Head;
4669   typedef Types11<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12> Tail;
4670 };
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, typename T12, typename T13>
4675 struct Types13 {
4676   typedef T1 Head;
4677   typedef Types12<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13> Tail;
4678 };
4679 
4680 template <typename T1, typename T2, typename T3, typename T4, typename T5,
4681     typename T6, typename T7, typename T8, typename T9, typename T10,
4682     typename T11, typename T12, typename T13, typename T14>
4683 struct Types14 {
4684   typedef T1 Head;
4685   typedef Types13<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14> Tail;
4686 };
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, typename T13, typename T14, typename T15>
4691 struct Types15 {
4692   typedef T1 Head;
4693   typedef Types14<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
4694       T15> Tail;
4695 };
4696 
4697 template <typename T1, typename T2, typename T3, typename T4, typename T5,
4698     typename T6, typename T7, typename T8, typename T9, typename T10,
4699     typename T11, typename T12, typename T13, typename T14, typename T15,
4700     typename T16>
4701 struct Types16 {
4702   typedef T1 Head;
4703   typedef Types15<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
4704       T16> Tail;
4705 };
4706 
4707 template <typename T1, typename T2, typename T3, typename T4, typename T5,
4708     typename T6, typename T7, typename T8, typename T9, typename T10,
4709     typename T11, typename T12, typename T13, typename T14, typename T15,
4710     typename T16, typename T17>
4711 struct Types17 {
4712   typedef T1 Head;
4713   typedef Types16<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
4714       T16, T17> Tail;
4715 };
4716 
4717 template <typename T1, typename T2, typename T3, typename T4, typename T5,
4718     typename T6, typename T7, typename T8, typename T9, typename T10,
4719     typename T11, typename T12, typename T13, typename T14, typename T15,
4720     typename T16, typename T17, typename T18>
4721 struct Types18 {
4722   typedef T1 Head;
4723   typedef Types17<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
4724       T16, T17, T18> Tail;
4725 };
4726 
4727 template <typename T1, typename T2, typename T3, typename T4, typename T5,
4728     typename T6, typename T7, typename T8, typename T9, typename T10,
4729     typename T11, typename T12, typename T13, typename T14, typename T15,
4730     typename T16, typename T17, typename T18, typename T19>
4731 struct Types19 {
4732   typedef T1 Head;
4733   typedef Types18<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
4734       T16, T17, T18, T19> Tail;
4735 };
4736 
4737 template <typename T1, typename T2, typename T3, typename T4, typename T5,
4738     typename T6, typename T7, typename T8, typename T9, typename T10,
4739     typename T11, typename T12, typename T13, typename T14, typename T15,
4740     typename T16, typename T17, typename T18, typename T19, typename T20>
4741 struct Types20 {
4742   typedef T1 Head;
4743   typedef Types19<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
4744       T16, T17, T18, T19, T20> Tail;
4745 };
4746 
4747 template <typename T1, typename T2, typename T3, typename T4, typename T5,
4748     typename T6, typename T7, typename T8, typename T9, typename T10,
4749     typename T11, typename T12, typename T13, typename T14, typename T15,
4750     typename T16, typename T17, typename T18, typename T19, typename T20,
4751     typename T21>
4752 struct Types21 {
4753   typedef T1 Head;
4754   typedef Types20<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
4755       T16, T17, T18, T19, T20, T21> Tail;
4756 };
4757 
4758 template <typename T1, typename T2, typename T3, typename T4, typename T5,
4759     typename T6, typename T7, typename T8, typename T9, typename T10,
4760     typename T11, typename T12, typename T13, typename T14, typename T15,
4761     typename T16, typename T17, typename T18, typename T19, typename T20,
4762     typename T21, typename T22>
4763 struct Types22 {
4764   typedef T1 Head;
4765   typedef Types21<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
4766       T16, T17, T18, T19, T20, T21, T22> Tail;
4767 };
4768 
4769 template <typename T1, typename T2, typename T3, typename T4, typename T5,
4770     typename T6, typename T7, typename T8, typename T9, typename T10,
4771     typename T11, typename T12, typename T13, typename T14, typename T15,
4772     typename T16, typename T17, typename T18, typename T19, typename T20,
4773     typename T21, typename T22, typename T23>
4774 struct Types23 {
4775   typedef T1 Head;
4776   typedef Types22<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
4777       T16, T17, T18, T19, T20, T21, T22, T23> Tail;
4778 };
4779 
4780 template <typename T1, typename T2, typename T3, typename T4, typename T5,
4781     typename T6, typename T7, typename T8, typename T9, typename T10,
4782     typename T11, typename T12, typename T13, typename T14, typename T15,
4783     typename T16, typename T17, typename T18, typename T19, typename T20,
4784     typename T21, typename T22, typename T23, typename T24>
4785 struct Types24 {
4786   typedef T1 Head;
4787   typedef Types23<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
4788       T16, T17, T18, T19, T20, T21, T22, T23, T24> Tail;
4789 };
4790 
4791 template <typename T1, typename T2, typename T3, typename T4, typename T5,
4792     typename T6, typename T7, typename T8, typename T9, typename T10,
4793     typename T11, typename T12, typename T13, typename T14, typename T15,
4794     typename T16, typename T17, typename T18, typename T19, typename T20,
4795     typename T21, typename T22, typename T23, typename T24, typename T25>
4796 struct Types25 {
4797   typedef T1 Head;
4798   typedef Types24<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
4799       T16, T17, T18, T19, T20, T21, T22, T23, T24, T25> Tail;
4800 };
4801 
4802 template <typename T1, typename T2, typename T3, typename T4, typename T5,
4803     typename T6, typename T7, typename T8, typename T9, typename T10,
4804     typename T11, typename T12, typename T13, typename T14, typename T15,
4805     typename T16, typename T17, typename T18, typename T19, typename T20,
4806     typename T21, typename T22, typename T23, typename T24, typename T25,
4807     typename T26>
4808 struct Types26 {
4809   typedef T1 Head;
4810   typedef Types25<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
4811       T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26> Tail;
4812 };
4813 
4814 template <typename T1, typename T2, typename T3, typename T4, typename T5,
4815     typename T6, typename T7, typename T8, typename T9, typename T10,
4816     typename T11, typename T12, typename T13, typename T14, typename T15,
4817     typename T16, typename T17, typename T18, typename T19, typename T20,
4818     typename T21, typename T22, typename T23, typename T24, typename T25,
4819     typename T26, typename T27>
4820 struct Types27 {
4821   typedef T1 Head;
4822   typedef Types26<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
4823       T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27> Tail;
4824 };
4825 
4826 template <typename T1, typename T2, typename T3, typename T4, typename T5,
4827     typename T6, typename T7, typename T8, typename T9, typename T10,
4828     typename T11, typename T12, typename T13, typename T14, typename T15,
4829     typename T16, typename T17, typename T18, typename T19, typename T20,
4830     typename T21, typename T22, typename T23, typename T24, typename T25,
4831     typename T26, typename T27, typename T28>
4832 struct Types28 {
4833   typedef T1 Head;
4834   typedef Types27<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
4835       T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28> Tail;
4836 };
4837 
4838 template <typename T1, typename T2, typename T3, typename T4, typename T5,
4839     typename T6, typename T7, typename T8, typename T9, typename T10,
4840     typename T11, typename T12, typename T13, typename T14, typename T15,
4841     typename T16, typename T17, typename T18, typename T19, typename T20,
4842     typename T21, typename T22, typename T23, typename T24, typename T25,
4843     typename T26, typename T27, typename T28, typename T29>
4844 struct Types29 {
4845   typedef T1 Head;
4846   typedef Types28<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
4847       T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
4848       T29> Tail;
4849 };
4850 
4851 template <typename T1, typename T2, typename T3, typename T4, typename T5,
4852     typename T6, typename T7, typename T8, typename T9, typename T10,
4853     typename T11, typename T12, typename T13, typename T14, typename T15,
4854     typename T16, typename T17, typename T18, typename T19, typename T20,
4855     typename T21, typename T22, typename T23, typename T24, typename T25,
4856     typename T26, typename T27, typename T28, typename T29, typename T30>
4857 struct Types30 {
4858   typedef T1 Head;
4859   typedef Types29<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
4860       T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
4861       T30> Tail;
4862 };
4863 
4864 template <typename T1, typename T2, typename T3, typename T4, typename T5,
4865     typename T6, typename T7, typename T8, typename T9, typename T10,
4866     typename T11, typename T12, typename T13, typename T14, typename T15,
4867     typename T16, typename T17, typename T18, typename T19, typename T20,
4868     typename T21, typename T22, typename T23, typename T24, typename T25,
4869     typename T26, typename T27, typename T28, typename T29, typename T30,
4870     typename T31>
4871 struct Types31 {
4872   typedef T1 Head;
4873   typedef Types30<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
4874       T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
4875       T30, T31> Tail;
4876 };
4877 
4878 template <typename T1, typename T2, typename T3, typename T4, typename T5,
4879     typename T6, typename T7, typename T8, typename T9, typename T10,
4880     typename T11, typename T12, typename T13, typename T14, typename T15,
4881     typename T16, typename T17, typename T18, typename T19, typename T20,
4882     typename T21, typename T22, typename T23, typename T24, typename T25,
4883     typename T26, typename T27, typename T28, typename T29, typename T30,
4884     typename T31, typename T32>
4885 struct Types32 {
4886   typedef T1 Head;
4887   typedef Types31<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
4888       T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
4889       T30, T31, T32> Tail;
4890 };
4891 
4892 template <typename T1, typename T2, typename T3, typename T4, typename T5,
4893     typename T6, typename T7, typename T8, typename T9, typename T10,
4894     typename T11, typename T12, typename T13, typename T14, typename T15,
4895     typename T16, typename T17, typename T18, typename T19, typename T20,
4896     typename T21, typename T22, typename T23, typename T24, typename T25,
4897     typename T26, typename T27, typename T28, typename T29, typename T30,
4898     typename T31, typename T32, typename T33>
4899 struct Types33 {
4900   typedef T1 Head;
4901   typedef Types32<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
4902       T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
4903       T30, T31, T32, T33> Tail;
4904 };
4905 
4906 template <typename T1, typename T2, typename T3, typename T4, typename T5,
4907     typename T6, typename T7, typename T8, typename T9, typename T10,
4908     typename T11, typename T12, typename T13, typename T14, typename T15,
4909     typename T16, typename T17, typename T18, typename T19, typename T20,
4910     typename T21, typename T22, typename T23, typename T24, typename T25,
4911     typename T26, typename T27, typename T28, typename T29, typename T30,
4912     typename T31, typename T32, typename T33, typename T34>
4913 struct Types34 {
4914   typedef T1 Head;
4915   typedef Types33<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
4916       T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
4917       T30, T31, T32, T33, T34> Tail;
4918 };
4919 
4920 template <typename T1, typename T2, typename T3, typename T4, typename T5,
4921     typename T6, typename T7, typename T8, typename T9, typename T10,
4922     typename T11, typename T12, typename T13, typename T14, typename T15,
4923     typename T16, typename T17, typename T18, typename T19, typename T20,
4924     typename T21, typename T22, typename T23, typename T24, typename T25,
4925     typename T26, typename T27, typename T28, typename T29, typename T30,
4926     typename T31, typename T32, typename T33, typename T34, typename T35>
4927 struct Types35 {
4928   typedef T1 Head;
4929   typedef Types34<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
4930       T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
4931       T30, T31, T32, T33, T34, T35> Tail;
4932 };
4933 
4934 template <typename T1, typename T2, typename T3, typename T4, typename T5,
4935     typename T6, typename T7, typename T8, typename T9, typename T10,
4936     typename T11, typename T12, typename T13, typename T14, typename T15,
4937     typename T16, typename T17, typename T18, typename T19, typename T20,
4938     typename T21, typename T22, typename T23, typename T24, typename T25,
4939     typename T26, typename T27, typename T28, typename T29, typename T30,
4940     typename T31, typename T32, typename T33, typename T34, typename T35,
4941     typename T36>
4942 struct Types36 {
4943   typedef T1 Head;
4944   typedef Types35<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
4945       T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
4946       T30, T31, T32, T33, T34, T35, T36> Tail;
4947 };
4948 
4949 template <typename T1, typename T2, typename T3, typename T4, typename T5,
4950     typename T6, typename T7, typename T8, typename T9, typename T10,
4951     typename T11, typename T12, typename T13, typename T14, typename T15,
4952     typename T16, typename T17, typename T18, typename T19, typename T20,
4953     typename T21, typename T22, typename T23, typename T24, typename T25,
4954     typename T26, typename T27, typename T28, typename T29, typename T30,
4955     typename T31, typename T32, typename T33, typename T34, typename T35,
4956     typename T36, typename T37>
4957 struct Types37 {
4958   typedef T1 Head;
4959   typedef Types36<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
4960       T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
4961       T30, T31, T32, T33, T34, T35, T36, T37> Tail;
4962 };
4963 
4964 template <typename T1, typename T2, typename T3, typename T4, typename T5,
4965     typename T6, typename T7, typename T8, typename T9, typename T10,
4966     typename T11, typename T12, typename T13, typename T14, typename T15,
4967     typename T16, typename T17, typename T18, typename T19, typename T20,
4968     typename T21, typename T22, typename T23, typename T24, typename T25,
4969     typename T26, typename T27, typename T28, typename T29, typename T30,
4970     typename T31, typename T32, typename T33, typename T34, typename T35,
4971     typename T36, typename T37, typename T38>
4972 struct Types38 {
4973   typedef T1 Head;
4974   typedef Types37<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
4975       T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
4976       T30, T31, T32, T33, T34, T35, T36, T37, T38> Tail;
4977 };
4978 
4979 template <typename T1, typename T2, typename T3, typename T4, typename T5,
4980     typename T6, typename T7, typename T8, typename T9, typename T10,
4981     typename T11, typename T12, typename T13, typename T14, typename T15,
4982     typename T16, typename T17, typename T18, typename T19, typename T20,
4983     typename T21, typename T22, typename T23, typename T24, typename T25,
4984     typename T26, typename T27, typename T28, typename T29, typename T30,
4985     typename T31, typename T32, typename T33, typename T34, typename T35,
4986     typename T36, typename T37, typename T38, typename T39>
4987 struct Types39 {
4988   typedef T1 Head;
4989   typedef Types38<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
4990       T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
4991       T30, T31, T32, T33, T34, T35, T36, T37, T38, T39> Tail;
4992 };
4993 
4994 template <typename T1, typename T2, typename T3, typename T4, typename T5,
4995     typename T6, typename T7, typename T8, typename T9, typename T10,
4996     typename T11, typename T12, typename T13, typename T14, typename T15,
4997     typename T16, typename T17, typename T18, typename T19, typename T20,
4998     typename T21, typename T22, typename T23, typename T24, typename T25,
4999     typename T26, typename T27, typename T28, typename T29, typename T30,
5000     typename T31, typename T32, typename T33, typename T34, typename T35,
5001     typename T36, typename T37, typename T38, typename T39, typename T40>
5002 struct Types40 {
5003   typedef T1 Head;
5004   typedef Types39<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
5005       T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
5006       T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40> Tail;
5007 };
5008 
5009 template <typename T1, typename T2, typename T3, typename T4, typename T5,
5010     typename T6, typename T7, typename T8, typename T9, typename T10,
5011     typename T11, typename T12, typename T13, typename T14, typename T15,
5012     typename T16, typename T17, typename T18, typename T19, typename T20,
5013     typename T21, typename T22, typename T23, typename T24, typename T25,
5014     typename T26, typename T27, typename T28, typename T29, typename T30,
5015     typename T31, typename T32, typename T33, typename T34, typename T35,
5016     typename T36, typename T37, typename T38, typename T39, typename T40,
5017     typename T41>
5018 struct Types41 {
5019   typedef T1 Head;
5020   typedef Types40<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
5021       T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
5022       T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41> Tail;
5023 };
5024 
5025 template <typename T1, typename T2, typename T3, typename T4, typename T5,
5026     typename T6, typename T7, typename T8, typename T9, typename T10,
5027     typename T11, typename T12, typename T13, typename T14, typename T15,
5028     typename T16, typename T17, typename T18, typename T19, typename T20,
5029     typename T21, typename T22, typename T23, typename T24, typename T25,
5030     typename T26, typename T27, typename T28, typename T29, typename T30,
5031     typename T31, typename T32, typename T33, typename T34, typename T35,
5032     typename T36, typename T37, typename T38, typename T39, typename T40,
5033     typename T41, typename T42>
5034 struct Types42 {
5035   typedef T1 Head;
5036   typedef Types41<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
5037       T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
5038       T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42> Tail;
5039 };
5040 
5041 template <typename T1, typename T2, typename T3, typename T4, typename T5,
5042     typename T6, typename T7, typename T8, typename T9, typename T10,
5043     typename T11, typename T12, typename T13, typename T14, typename T15,
5044     typename T16, typename T17, typename T18, typename T19, typename T20,
5045     typename T21, typename T22, typename T23, typename T24, typename T25,
5046     typename T26, typename T27, typename T28, typename T29, typename T30,
5047     typename T31, typename T32, typename T33, typename T34, typename T35,
5048     typename T36, typename T37, typename T38, typename T39, typename T40,
5049     typename T41, typename T42, typename T43>
5050 struct Types43 {
5051   typedef T1 Head;
5052   typedef Types42<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
5053       T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
5054       T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42,
5055       T43> Tail;
5056 };
5057 
5058 template <typename T1, typename T2, typename T3, typename T4, typename T5,
5059     typename T6, typename T7, typename T8, typename T9, typename T10,
5060     typename T11, typename T12, typename T13, typename T14, typename T15,
5061     typename T16, typename T17, typename T18, typename T19, typename T20,
5062     typename T21, typename T22, typename T23, typename T24, typename T25,
5063     typename T26, typename T27, typename T28, typename T29, typename T30,
5064     typename T31, typename T32, typename T33, typename T34, typename T35,
5065     typename T36, typename T37, typename T38, typename T39, typename T40,
5066     typename T41, typename T42, typename T43, typename T44>
5067 struct Types44 {
5068   typedef T1 Head;
5069   typedef Types43<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
5070       T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
5071       T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43,
5072       T44> Tail;
5073 };
5074 
5075 template <typename T1, typename T2, typename T3, typename T4, typename T5,
5076     typename T6, typename T7, typename T8, typename T9, typename T10,
5077     typename T11, typename T12, typename T13, typename T14, typename T15,
5078     typename T16, typename T17, typename T18, typename T19, typename T20,
5079     typename T21, typename T22, typename T23, typename T24, typename T25,
5080     typename T26, typename T27, typename T28, typename T29, typename T30,
5081     typename T31, typename T32, typename T33, typename T34, typename T35,
5082     typename T36, typename T37, typename T38, typename T39, typename T40,
5083     typename T41, typename T42, typename T43, typename T44, typename T45>
5084 struct Types45 {
5085   typedef T1 Head;
5086   typedef Types44<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
5087       T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
5088       T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43,
5089       T44, T45> Tail;
5090 };
5091 
5092 template <typename T1, typename T2, typename T3, typename T4, typename T5,
5093     typename T6, typename T7, typename T8, typename T9, typename T10,
5094     typename T11, typename T12, typename T13, typename T14, typename T15,
5095     typename T16, typename T17, typename T18, typename T19, typename T20,
5096     typename T21, typename T22, typename T23, typename T24, typename T25,
5097     typename T26, typename T27, typename T28, typename T29, typename T30,
5098     typename T31, typename T32, typename T33, typename T34, typename T35,
5099     typename T36, typename T37, typename T38, typename T39, typename T40,
5100     typename T41, typename T42, typename T43, typename T44, typename T45,
5101     typename T46>
5102 struct Types46 {
5103   typedef T1 Head;
5104   typedef Types45<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
5105       T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
5106       T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43,
5107       T44, T45, T46> Tail;
5108 };
5109 
5110 template <typename T1, typename T2, typename T3, typename T4, typename T5,
5111     typename T6, typename T7, typename T8, typename T9, typename T10,
5112     typename T11, typename T12, typename T13, typename T14, typename T15,
5113     typename T16, typename T17, typename T18, typename T19, typename T20,
5114     typename T21, typename T22, typename T23, typename T24, typename T25,
5115     typename T26, typename T27, typename T28, typename T29, typename T30,
5116     typename T31, typename T32, typename T33, typename T34, typename T35,
5117     typename T36, typename T37, typename T38, typename T39, typename T40,
5118     typename T41, typename T42, typename T43, typename T44, typename T45,
5119     typename T46, typename T47>
5120 struct Types47 {
5121   typedef T1 Head;
5122   typedef Types46<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
5123       T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
5124       T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43,
5125       T44, T45, T46, T47> Tail;
5126 };
5127 
5128 template <typename T1, typename T2, typename T3, typename T4, typename T5,
5129     typename T6, typename T7, typename T8, typename T9, typename T10,
5130     typename T11, typename T12, typename T13, typename T14, typename T15,
5131     typename T16, typename T17, typename T18, typename T19, typename T20,
5132     typename T21, typename T22, typename T23, typename T24, typename T25,
5133     typename T26, typename T27, typename T28, typename T29, typename T30,
5134     typename T31, typename T32, typename T33, typename T34, typename T35,
5135     typename T36, typename T37, typename T38, typename T39, typename T40,
5136     typename T41, typename T42, typename T43, typename T44, typename T45,
5137     typename T46, typename T47, typename T48>
5138 struct Types48 {
5139   typedef T1 Head;
5140   typedef Types47<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
5141       T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
5142       T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43,
5143       T44, T45, T46, T47, T48> Tail;
5144 };
5145 
5146 template <typename T1, typename T2, typename T3, typename T4, typename T5,
5147     typename T6, typename T7, typename T8, typename T9, typename T10,
5148     typename T11, typename T12, typename T13, typename T14, typename T15,
5149     typename T16, typename T17, typename T18, typename T19, typename T20,
5150     typename T21, typename T22, typename T23, typename T24, typename T25,
5151     typename T26, typename T27, typename T28, typename T29, typename T30,
5152     typename T31, typename T32, typename T33, typename T34, typename T35,
5153     typename T36, typename T37, typename T38, typename T39, typename T40,
5154     typename T41, typename T42, typename T43, typename T44, typename T45,
5155     typename T46, typename T47, typename T48, typename T49>
5156 struct Types49 {
5157   typedef T1 Head;
5158   typedef Types48<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
5159       T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
5160       T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43,
5161       T44, T45, T46, T47, T48, T49> Tail;
5162 };
5163 
5164 template <typename T1, typename T2, typename T3, typename T4, typename T5,
5165     typename T6, typename T7, typename T8, typename T9, typename T10,
5166     typename T11, typename T12, typename T13, typename T14, typename T15,
5167     typename T16, typename T17, typename T18, typename T19, typename T20,
5168     typename T21, typename T22, typename T23, typename T24, typename T25,
5169     typename T26, typename T27, typename T28, typename T29, typename T30,
5170     typename T31, typename T32, typename T33, typename T34, typename T35,
5171     typename T36, typename T37, typename T38, typename T39, typename T40,
5172     typename T41, typename T42, typename T43, typename T44, typename T45,
5173     typename T46, typename T47, typename T48, typename T49, typename T50>
5174 struct Types50 {
5175   typedef T1 Head;
5176   typedef Types49<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
5177       T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
5178       T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43,
5179       T44, T45, T46, T47, T48, T49, T50> Tail;
5180 };
5181 
5182 
5183 }  // namespace internal
5184 
5185 // We don't want to require the users to write TypesN<...> directly,
5186 // as that would require them to count the length.  Types<...> is much
5187 // easier to write, but generates horrible messages when there is a
5188 // compiler error, as gcc insists on printing out each template
5189 // argument, even if it has the default value (this means Types<int>
5190 // will appear as Types<int, None, None, ..., None> in the compiler
5191 // errors).
5192 //
5193 // Our solution is to combine the best part of the two approaches: a
5194 // user would write Types<T1, ..., TN>, and Google Test will translate
5195 // that to TypesN<T1, ..., TN> internally to make error messages
5196 // readable.  The translation is done by the 'type' member of the
5197 // Types template.
5198 template <typename T1 = internal::None, typename T2 = internal::None,
5199     typename T3 = internal::None, typename T4 = internal::None,
5200     typename T5 = internal::None, typename T6 = internal::None,
5201     typename T7 = internal::None, typename T8 = internal::None,
5202     typename T9 = internal::None, typename T10 = internal::None,
5203     typename T11 = internal::None, typename T12 = internal::None,
5204     typename T13 = internal::None, typename T14 = internal::None,
5205     typename T15 = internal::None, typename T16 = internal::None,
5206     typename T17 = internal::None, typename T18 = internal::None,
5207     typename T19 = internal::None, typename T20 = internal::None,
5208     typename T21 = internal::None, typename T22 = internal::None,
5209     typename T23 = internal::None, typename T24 = internal::None,
5210     typename T25 = internal::None, typename T26 = internal::None,
5211     typename T27 = internal::None, typename T28 = internal::None,
5212     typename T29 = internal::None, typename T30 = internal::None,
5213     typename T31 = internal::None, typename T32 = internal::None,
5214     typename T33 = internal::None, typename T34 = internal::None,
5215     typename T35 = internal::None, typename T36 = internal::None,
5216     typename T37 = internal::None, typename T38 = internal::None,
5217     typename T39 = internal::None, typename T40 = internal::None,
5218     typename T41 = internal::None, typename T42 = internal::None,
5219     typename T43 = internal::None, typename T44 = internal::None,
5220     typename T45 = internal::None, typename T46 = internal::None,
5221     typename T47 = internal::None, typename T48 = internal::None,
5222     typename T49 = internal::None, typename T50 = internal::None>
5223 struct Types {
5224   typedef internal::Types50<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
5225       T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
5226       T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40,
5227       T41, T42, T43, T44, T45, T46, T47, T48, T49, T50> type;
5228 };
5229 
5230 template <>
5231 struct Types<internal::None, internal::None, internal::None, internal::None,
5232     internal::None, internal::None, internal::None, internal::None,
5233     internal::None, internal::None, internal::None, internal::None,
5234     internal::None, internal::None, internal::None, internal::None,
5235     internal::None, internal::None, internal::None, internal::None,
5236     internal::None, internal::None, internal::None, internal::None,
5237     internal::None, internal::None, internal::None, internal::None,
5238     internal::None, internal::None, internal::None, internal::None,
5239     internal::None, internal::None, internal::None, internal::None,
5240     internal::None, internal::None, internal::None, internal::None,
5241     internal::None, internal::None, internal::None, internal::None,
5242     internal::None, internal::None, internal::None, internal::None,
5243     internal::None, internal::None> {
5244   typedef internal::Types0 type;
5245 };
5246 template <typename T1>
5247 struct Types<T1, internal::None, internal::None, internal::None,
5248     internal::None, internal::None, internal::None, internal::None,
5249     internal::None, internal::None, internal::None, internal::None,
5250     internal::None, internal::None, internal::None, internal::None,
5251     internal::None, internal::None, internal::None, internal::None,
5252     internal::None, internal::None, internal::None, internal::None,
5253     internal::None, internal::None, internal::None, internal::None,
5254     internal::None, internal::None, internal::None, internal::None,
5255     internal::None, internal::None, internal::None, internal::None,
5256     internal::None, internal::None, internal::None, internal::None,
5257     internal::None, internal::None, internal::None, internal::None,
5258     internal::None, internal::None, internal::None, internal::None,
5259     internal::None, internal::None> {
5260   typedef internal::Types1<T1> type;
5261 };
5262 template <typename T1, typename T2>
5263 struct Types<T1, T2, internal::None, internal::None, internal::None,
5264     internal::None, internal::None, internal::None, internal::None,
5265     internal::None, internal::None, internal::None, internal::None,
5266     internal::None, internal::None, internal::None, internal::None,
5267     internal::None, internal::None, internal::None, internal::None,
5268     internal::None, internal::None, internal::None, internal::None,
5269     internal::None, internal::None, internal::None, internal::None,
5270     internal::None, internal::None, internal::None, internal::None,
5271     internal::None, internal::None, internal::None, internal::None,
5272     internal::None, internal::None, internal::None, internal::None,
5273     internal::None, internal::None, internal::None, internal::None,
5274     internal::None, internal::None, internal::None, internal::None,
5275     internal::None> {
5276   typedef internal::Types2<T1, T2> type;
5277 };
5278 template <typename T1, typename T2, typename T3>
5279 struct Types<T1, T2, T3, internal::None, internal::None, internal::None,
5280     internal::None, internal::None, internal::None, internal::None,
5281     internal::None, internal::None, internal::None, internal::None,
5282     internal::None, internal::None, internal::None, internal::None,
5283     internal::None, internal::None, internal::None, internal::None,
5284     internal::None, internal::None, internal::None, internal::None,
5285     internal::None, internal::None, internal::None, internal::None,
5286     internal::None, internal::None, internal::None, internal::None,
5287     internal::None, internal::None, internal::None, internal::None,
5288     internal::None, internal::None, internal::None, internal::None,
5289     internal::None, internal::None, internal::None, internal::None,
5290     internal::None, internal::None, internal::None, internal::None> {
5291   typedef internal::Types3<T1, T2, T3> type;
5292 };
5293 template <typename T1, typename T2, typename T3, typename T4>
5294 struct Types<T1, T2, T3, T4, internal::None, internal::None, internal::None,
5295     internal::None, internal::None, internal::None, internal::None,
5296     internal::None, internal::None, internal::None, internal::None,
5297     internal::None, internal::None, internal::None, internal::None,
5298     internal::None, internal::None, internal::None, internal::None,
5299     internal::None, internal::None, internal::None, internal::None,
5300     internal::None, internal::None, internal::None, internal::None,
5301     internal::None, internal::None, internal::None, internal::None,
5302     internal::None, internal::None, internal::None, internal::None,
5303     internal::None, internal::None, internal::None, internal::None,
5304     internal::None, internal::None, internal::None, internal::None,
5305     internal::None, internal::None, internal::None> {
5306   typedef internal::Types4<T1, T2, T3, T4> type;
5307 };
5308 template <typename T1, typename T2, typename T3, typename T4, typename T5>
5309 struct Types<T1, T2, T3, T4, T5, internal::None, internal::None,
5310     internal::None, internal::None, internal::None, internal::None,
5311     internal::None, internal::None, internal::None, internal::None,
5312     internal::None, internal::None, internal::None, internal::None,
5313     internal::None, internal::None, internal::None, internal::None,
5314     internal::None, internal::None, internal::None, internal::None,
5315     internal::None, internal::None, internal::None, internal::None,
5316     internal::None, internal::None, internal::None, internal::None,
5317     internal::None, internal::None, internal::None, internal::None,
5318     internal::None, internal::None, internal::None, internal::None,
5319     internal::None, internal::None, internal::None, internal::None,
5320     internal::None, internal::None, internal::None> {
5321   typedef internal::Types5<T1, T2, T3, T4, T5> type;
5322 };
5323 template <typename T1, typename T2, typename T3, typename T4, typename T5,
5324     typename T6>
5325 struct Types<T1, T2, T3, T4, T5, T6, internal::None, internal::None,
5326     internal::None, internal::None, internal::None, internal::None,
5327     internal::None, internal::None, internal::None, internal::None,
5328     internal::None, internal::None, internal::None, internal::None,
5329     internal::None, internal::None, internal::None, internal::None,
5330     internal::None, internal::None, internal::None, internal::None,
5331     internal::None, internal::None, internal::None, internal::None,
5332     internal::None, internal::None, internal::None, internal::None,
5333     internal::None, internal::None, internal::None, internal::None,
5334     internal::None, internal::None, internal::None, internal::None,
5335     internal::None, internal::None, internal::None, internal::None,
5336     internal::None, internal::None> {
5337   typedef internal::Types6<T1, T2, T3, T4, T5, T6> type;
5338 };
5339 template <typename T1, typename T2, typename T3, typename T4, typename T5,
5340     typename T6, typename T7>
5341 struct Types<T1, T2, T3, T4, T5, T6, T7, internal::None, internal::None,
5342     internal::None, internal::None, internal::None, internal::None,
5343     internal::None, internal::None, internal::None, internal::None,
5344     internal::None, internal::None, internal::None, internal::None,
5345     internal::None, internal::None, internal::None, internal::None,
5346     internal::None, internal::None, internal::None, internal::None,
5347     internal::None, internal::None, internal::None, internal::None,
5348     internal::None, internal::None, internal::None, internal::None,
5349     internal::None, internal::None, internal::None, internal::None,
5350     internal::None, internal::None, internal::None, internal::None,
5351     internal::None, internal::None, internal::None, internal::None,
5352     internal::None> {
5353   typedef internal::Types7<T1, T2, T3, T4, T5, T6, T7> type;
5354 };
5355 template <typename T1, typename T2, typename T3, typename T4, typename T5,
5356     typename T6, typename T7, typename T8>
5357 struct Types<T1, T2, T3, T4, T5, T6, T7, T8, internal::None, internal::None,
5358     internal::None, internal::None, internal::None, internal::None,
5359     internal::None, internal::None, internal::None, internal::None,
5360     internal::None, internal::None, internal::None, internal::None,
5361     internal::None, internal::None, internal::None, internal::None,
5362     internal::None, internal::None, internal::None, internal::None,
5363     internal::None, internal::None, internal::None, internal::None,
5364     internal::None, internal::None, internal::None, internal::None,
5365     internal::None, internal::None, internal::None, internal::None,
5366     internal::None, internal::None, internal::None, internal::None,
5367     internal::None, internal::None, internal::None, internal::None> {
5368   typedef internal::Types8<T1, T2, T3, T4, T5, T6, T7, T8> type;
5369 };
5370 template <typename T1, typename T2, typename T3, typename T4, typename T5,
5371     typename T6, typename T7, typename T8, typename T9>
5372 struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, internal::None,
5373     internal::None, internal::None, internal::None, internal::None,
5374     internal::None, internal::None, internal::None, internal::None,
5375     internal::None, internal::None, internal::None, internal::None,
5376     internal::None, internal::None, internal::None, internal::None,
5377     internal::None, internal::None, internal::None, internal::None,
5378     internal::None, internal::None, internal::None, internal::None,
5379     internal::None, internal::None, internal::None, internal::None,
5380     internal::None, internal::None, internal::None, internal::None,
5381     internal::None, internal::None, internal::None, internal::None,
5382     internal::None, internal::None, internal::None, internal::None> {
5383   typedef internal::Types9<T1, T2, T3, T4, T5, T6, T7, T8, T9> type;
5384 };
5385 template <typename T1, typename T2, typename T3, typename T4, typename T5,
5386     typename T6, typename T7, typename T8, typename T9, typename T10>
5387 struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, internal::None,
5388     internal::None, internal::None, internal::None, internal::None,
5389     internal::None, internal::None, internal::None, internal::None,
5390     internal::None, internal::None, internal::None, internal::None,
5391     internal::None, internal::None, internal::None, internal::None,
5392     internal::None, internal::None, internal::None, internal::None,
5393     internal::None, internal::None, internal::None, internal::None,
5394     internal::None, internal::None, internal::None, internal::None,
5395     internal::None, internal::None, internal::None, internal::None,
5396     internal::None, internal::None, internal::None, internal::None,
5397     internal::None, internal::None, internal::None> {
5398   typedef internal::Types10<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> type;
5399 };
5400 template <typename T1, typename T2, typename T3, typename T4, typename T5,
5401     typename T6, typename T7, typename T8, typename T9, typename T10,
5402     typename T11>
5403 struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, internal::None,
5404     internal::None, internal::None, internal::None, internal::None,
5405     internal::None, internal::None, internal::None, internal::None,
5406     internal::None, internal::None, internal::None, internal::None,
5407     internal::None, internal::None, internal::None, internal::None,
5408     internal::None, internal::None, internal::None, internal::None,
5409     internal::None, internal::None, internal::None, internal::None,
5410     internal::None, internal::None, internal::None, internal::None,
5411     internal::None, internal::None, internal::None, internal::None,
5412     internal::None, internal::None, internal::None, internal::None,
5413     internal::None, internal::None> {
5414   typedef internal::Types11<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11> type;
5415 };
5416 template <typename T1, typename T2, typename T3, typename T4, typename T5,
5417     typename T6, typename T7, typename T8, typename T9, typename T10,
5418     typename T11, typename T12>
5419 struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, internal::None,
5420     internal::None, internal::None, internal::None, internal::None,
5421     internal::None, internal::None, internal::None, internal::None,
5422     internal::None, internal::None, internal::None, internal::None,
5423     internal::None, internal::None, internal::None, internal::None,
5424     internal::None, internal::None, internal::None, internal::None,
5425     internal::None, internal::None, internal::None, internal::None,
5426     internal::None, internal::None, internal::None, internal::None,
5427     internal::None, internal::None, internal::None, internal::None,
5428     internal::None, internal::None, internal::None, internal::None,
5429     internal::None> {
5430   typedef internal::Types12<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
5431       T12> type;
5432 };
5433 template <typename T1, typename T2, typename T3, typename T4, typename T5,
5434     typename T6, typename T7, typename T8, typename T9, typename T10,
5435     typename T11, typename T12, typename T13>
5436 struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
5437     internal::None, internal::None, internal::None, internal::None,
5438     internal::None, internal::None, internal::None, internal::None,
5439     internal::None, internal::None, internal::None, internal::None,
5440     internal::None, internal::None, internal::None, internal::None,
5441     internal::None, internal::None, internal::None, internal::None,
5442     internal::None, internal::None, internal::None, internal::None,
5443     internal::None, internal::None, internal::None, internal::None,
5444     internal::None, internal::None, internal::None, internal::None,
5445     internal::None, internal::None, internal::None, internal::None,
5446     internal::None> {
5447   typedef internal::Types13<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
5448       T13> type;
5449 };
5450 template <typename T1, typename T2, typename T3, typename T4, typename T5,
5451     typename T6, typename T7, typename T8, typename T9, typename T10,
5452     typename T11, typename T12, typename T13, typename T14>
5453 struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
5454     internal::None, internal::None, internal::None, internal::None,
5455     internal::None, internal::None, internal::None, internal::None,
5456     internal::None, internal::None, internal::None, internal::None,
5457     internal::None, internal::None, internal::None, internal::None,
5458     internal::None, internal::None, internal::None, internal::None,
5459     internal::None, internal::None, internal::None, internal::None,
5460     internal::None, internal::None, internal::None, internal::None,
5461     internal::None, internal::None, internal::None, internal::None,
5462     internal::None, internal::None, internal::None, internal::None> {
5463   typedef internal::Types14<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
5464       T13, T14> type;
5465 };
5466 template <typename T1, typename T2, typename T3, typename T4, typename T5,
5467     typename T6, typename T7, typename T8, typename T9, typename T10,
5468     typename T11, typename T12, typename T13, typename T14, typename T15>
5469 struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
5470     internal::None, internal::None, internal::None, internal::None,
5471     internal::None, internal::None, internal::None, internal::None,
5472     internal::None, internal::None, internal::None, internal::None,
5473     internal::None, internal::None, internal::None, internal::None,
5474     internal::None, internal::None, internal::None, internal::None,
5475     internal::None, internal::None, internal::None, internal::None,
5476     internal::None, internal::None, internal::None, internal::None,
5477     internal::None, internal::None, internal::None, internal::None,
5478     internal::None, internal::None, internal::None> {
5479   typedef internal::Types15<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
5480       T13, T14, T15> type;
5481 };
5482 template <typename T1, typename T2, typename T3, typename T4, typename T5,
5483     typename T6, typename T7, typename T8, typename T9, typename T10,
5484     typename T11, typename T12, typename T13, typename T14, typename T15,
5485     typename T16>
5486 struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
5487     T16, internal::None, internal::None, internal::None, internal::None,
5488     internal::None, internal::None, internal::None, internal::None,
5489     internal::None, internal::None, internal::None, internal::None,
5490     internal::None, internal::None, internal::None, internal::None,
5491     internal::None, internal::None, internal::None, internal::None,
5492     internal::None, internal::None, internal::None, internal::None,
5493     internal::None, internal::None, internal::None, internal::None,
5494     internal::None, internal::None, internal::None, internal::None,
5495     internal::None, internal::None> {
5496   typedef internal::Types16<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
5497       T13, T14, T15, T16> type;
5498 };
5499 template <typename T1, typename T2, typename T3, typename T4, typename T5,
5500     typename T6, typename T7, typename T8, typename T9, typename T10,
5501     typename T11, typename T12, typename T13, typename T14, typename T15,
5502     typename T16, typename T17>
5503 struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
5504     T16, T17, internal::None, internal::None, internal::None, internal::None,
5505     internal::None, internal::None, internal::None, internal::None,
5506     internal::None, internal::None, internal::None, internal::None,
5507     internal::None, internal::None, internal::None, internal::None,
5508     internal::None, internal::None, internal::None, internal::None,
5509     internal::None, internal::None, internal::None, internal::None,
5510     internal::None, internal::None, internal::None, internal::None,
5511     internal::None, internal::None, internal::None, internal::None,
5512     internal::None> {
5513   typedef internal::Types17<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
5514       T13, T14, T15, T16, T17> type;
5515 };
5516 template <typename T1, typename T2, typename T3, typename T4, typename T5,
5517     typename T6, typename T7, typename T8, typename T9, typename T10,
5518     typename T11, typename T12, typename T13, typename T14, typename T15,
5519     typename T16, typename T17, typename T18>
5520 struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
5521     T16, T17, T18, internal::None, internal::None, internal::None,
5522     internal::None, internal::None, internal::None, internal::None,
5523     internal::None, internal::None, internal::None, internal::None,
5524     internal::None, internal::None, internal::None, internal::None,
5525     internal::None, internal::None, internal::None, internal::None,
5526     internal::None, internal::None, internal::None, internal::None,
5527     internal::None, internal::None, internal::None, internal::None,
5528     internal::None, internal::None, internal::None, internal::None,
5529     internal::None> {
5530   typedef internal::Types18<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
5531       T13, T14, T15, T16, T17, T18> type;
5532 };
5533 template <typename T1, typename T2, typename T3, typename T4, typename T5,
5534     typename T6, typename T7, typename T8, typename T9, typename T10,
5535     typename T11, typename T12, typename T13, typename T14, typename T15,
5536     typename T16, typename T17, typename T18, typename T19>
5537 struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
5538     T16, T17, T18, T19, internal::None, internal::None, internal::None,
5539     internal::None, internal::None, internal::None, internal::None,
5540     internal::None, internal::None, internal::None, internal::None,
5541     internal::None, internal::None, internal::None, internal::None,
5542     internal::None, internal::None, internal::None, internal::None,
5543     internal::None, internal::None, internal::None, internal::None,
5544     internal::None, internal::None, internal::None, internal::None,
5545     internal::None, internal::None, internal::None, internal::None> {
5546   typedef internal::Types19<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
5547       T13, T14, T15, T16, T17, T18, T19> type;
5548 };
5549 template <typename T1, typename T2, typename T3, typename T4, typename T5,
5550     typename T6, typename T7, typename T8, typename T9, typename T10,
5551     typename T11, typename T12, typename T13, typename T14, typename T15,
5552     typename T16, typename T17, typename T18, typename T19, typename T20>
5553 struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
5554     T16, T17, T18, T19, T20, internal::None, internal::None, internal::None,
5555     internal::None, internal::None, internal::None, internal::None,
5556     internal::None, internal::None, internal::None, internal::None,
5557     internal::None, internal::None, internal::None, internal::None,
5558     internal::None, internal::None, internal::None, internal::None,
5559     internal::None, internal::None, internal::None, internal::None,
5560     internal::None, internal::None, internal::None, internal::None,
5561     internal::None, internal::None, internal::None> {
5562   typedef internal::Types20<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
5563       T13, T14, T15, T16, T17, T18, T19, T20> type;
5564 };
5565 template <typename T1, typename T2, typename T3, typename T4, typename T5,
5566     typename T6, typename T7, typename T8, typename T9, typename T10,
5567     typename T11, typename T12, typename T13, typename T14, typename T15,
5568     typename T16, typename T17, typename T18, typename T19, typename T20,
5569     typename T21>
5570 struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
5571     T16, T17, T18, T19, T20, T21, internal::None, internal::None,
5572     internal::None, internal::None, internal::None, internal::None,
5573     internal::None, internal::None, internal::None, internal::None,
5574     internal::None, internal::None, internal::None, internal::None,
5575     internal::None, internal::None, internal::None, internal::None,
5576     internal::None, internal::None, internal::None, internal::None,
5577     internal::None, internal::None, internal::None, internal::None,
5578     internal::None, internal::None, internal::None> {
5579   typedef internal::Types21<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
5580       T13, T14, T15, T16, T17, T18, T19, T20, T21> type;
5581 };
5582 template <typename T1, typename T2, typename T3, typename T4, typename T5,
5583     typename T6, typename T7, typename T8, typename T9, typename T10,
5584     typename T11, typename T12, typename T13, typename T14, typename T15,
5585     typename T16, typename T17, typename T18, typename T19, typename T20,
5586     typename T21, typename T22>
5587 struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
5588     T16, T17, T18, T19, T20, T21, T22, internal::None, internal::None,
5589     internal::None, internal::None, internal::None, internal::None,
5590     internal::None, internal::None, internal::None, internal::None,
5591     internal::None, internal::None, internal::None, internal::None,
5592     internal::None, internal::None, internal::None, internal::None,
5593     internal::None, internal::None, internal::None, internal::None,
5594     internal::None, internal::None, internal::None, internal::None,
5595     internal::None, internal::None> {
5596   typedef internal::Types22<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
5597       T13, T14, T15, T16, T17, T18, T19, T20, T21, T22> type;
5598 };
5599 template <typename T1, typename T2, typename T3, typename T4, typename T5,
5600     typename T6, typename T7, typename T8, typename T9, typename T10,
5601     typename T11, typename T12, typename T13, typename T14, typename T15,
5602     typename T16, typename T17, typename T18, typename T19, typename T20,
5603     typename T21, typename T22, typename T23>
5604 struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
5605     T16, T17, T18, T19, T20, T21, T22, T23, internal::None, internal::None,
5606     internal::None, internal::None, internal::None, internal::None,
5607     internal::None, internal::None, internal::None, internal::None,
5608     internal::None, internal::None, internal::None, internal::None,
5609     internal::None, internal::None, internal::None, internal::None,
5610     internal::None, internal::None, internal::None, internal::None,
5611     internal::None, internal::None, internal::None, internal::None,
5612     internal::None> {
5613   typedef internal::Types23<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
5614       T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23> type;
5615 };
5616 template <typename T1, typename T2, typename T3, typename T4, typename T5,
5617     typename T6, typename T7, typename T8, typename T9, typename T10,
5618     typename T11, typename T12, typename T13, typename T14, typename T15,
5619     typename T16, typename T17, typename T18, typename T19, typename T20,
5620     typename T21, typename T22, typename T23, typename T24>
5621 struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
5622     T16, T17, T18, T19, T20, T21, T22, T23, T24, internal::None,
5623     internal::None, internal::None, internal::None, internal::None,
5624     internal::None, internal::None, internal::None, internal::None,
5625     internal::None, internal::None, internal::None, internal::None,
5626     internal::None, internal::None, internal::None, internal::None,
5627     internal::None, internal::None, internal::None, internal::None,
5628     internal::None, internal::None, internal::None, internal::None,
5629     internal::None> {
5630   typedef internal::Types24<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
5631       T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24> type;
5632 };
5633 template <typename T1, typename T2, typename T3, typename T4, typename T5,
5634     typename T6, typename T7, typename T8, typename T9, typename T10,
5635     typename T11, typename T12, typename T13, typename T14, typename T15,
5636     typename T16, typename T17, typename T18, typename T19, typename T20,
5637     typename T21, typename T22, typename T23, typename T24, typename T25>
5638 struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
5639     T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, internal::None,
5640     internal::None, internal::None, internal::None, internal::None,
5641     internal::None, internal::None, internal::None, internal::None,
5642     internal::None, internal::None, internal::None, internal::None,
5643     internal::None, internal::None, internal::None, internal::None,
5644     internal::None, internal::None, internal::None, internal::None,
5645     internal::None, internal::None, internal::None, internal::None> {
5646   typedef internal::Types25<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
5647       T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25> type;
5648 };
5649 template <typename T1, typename T2, typename T3, typename T4, typename T5,
5650     typename T6, typename T7, typename T8, typename T9, typename T10,
5651     typename T11, typename T12, typename T13, typename T14, typename T15,
5652     typename T16, typename T17, typename T18, typename T19, typename T20,
5653     typename T21, typename T22, typename T23, typename T24, typename T25,
5654     typename T26>
5655 struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
5656     T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, internal::None,
5657     internal::None, internal::None, internal::None, internal::None,
5658     internal::None, internal::None, internal::None, internal::None,
5659     internal::None, internal::None, internal::None, internal::None,
5660     internal::None, internal::None, internal::None, internal::None,
5661     internal::None, internal::None, internal::None, internal::None,
5662     internal::None, internal::None, internal::None> {
5663   typedef internal::Types26<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
5664       T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
5665       T26> type;
5666 };
5667 template <typename T1, typename T2, typename T3, typename T4, typename T5,
5668     typename T6, typename T7, typename T8, typename T9, typename T10,
5669     typename T11, typename T12, typename T13, typename T14, typename T15,
5670     typename T16, typename T17, typename T18, typename T19, typename T20,
5671     typename T21, typename T22, typename T23, typename T24, typename T25,
5672     typename T26, typename T27>
5673 struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
5674     T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, internal::None,
5675     internal::None, internal::None, internal::None, internal::None,
5676     internal::None, internal::None, internal::None, internal::None,
5677     internal::None, internal::None, internal::None, internal::None,
5678     internal::None, internal::None, internal::None, internal::None,
5679     internal::None, internal::None, internal::None, internal::None,
5680     internal::None, internal::None> {
5681   typedef internal::Types27<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
5682       T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
5683       T27> type;
5684 };
5685 template <typename T1, typename T2, typename T3, typename T4, typename T5,
5686     typename T6, typename T7, typename T8, typename T9, typename T10,
5687     typename T11, typename T12, typename T13, typename T14, typename T15,
5688     typename T16, typename T17, typename T18, typename T19, typename T20,
5689     typename T21, typename T22, typename T23, typename T24, typename T25,
5690     typename T26, typename T27, typename T28>
5691 struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
5692     T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
5693     internal::None, internal::None, internal::None, internal::None,
5694     internal::None, internal::None, internal::None, internal::None,
5695     internal::None, internal::None, internal::None, internal::None,
5696     internal::None, internal::None, internal::None, internal::None,
5697     internal::None, internal::None, internal::None, internal::None,
5698     internal::None, internal::None> {
5699   typedef internal::Types28<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
5700       T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
5701       T27, T28> type;
5702 };
5703 template <typename T1, typename T2, typename T3, typename T4, typename T5,
5704     typename T6, typename T7, typename T8, typename T9, typename T10,
5705     typename T11, typename T12, typename T13, typename T14, typename T15,
5706     typename T16, typename T17, typename T18, typename T19, typename T20,
5707     typename T21, typename T22, typename T23, typename T24, typename T25,
5708     typename T26, typename T27, typename T28, typename T29>
5709 struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
5710     T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
5711     internal::None, internal::None, internal::None, internal::None,
5712     internal::None, internal::None, internal::None, internal::None,
5713     internal::None, internal::None, internal::None, internal::None,
5714     internal::None, internal::None, internal::None, internal::None,
5715     internal::None, internal::None, internal::None, internal::None,
5716     internal::None> {
5717   typedef internal::Types29<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
5718       T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
5719       T27, T28, T29> type;
5720 };
5721 template <typename T1, typename T2, typename T3, typename T4, typename T5,
5722     typename T6, typename T7, typename T8, typename T9, typename T10,
5723     typename T11, typename T12, typename T13, typename T14, typename T15,
5724     typename T16, typename T17, typename T18, typename T19, typename T20,
5725     typename T21, typename T22, typename T23, typename T24, typename T25,
5726     typename T26, typename T27, typename T28, typename T29, typename T30>
5727 struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
5728     T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,
5729     internal::None, internal::None, internal::None, internal::None,
5730     internal::None, internal::None, internal::None, internal::None,
5731     internal::None, internal::None, internal::None, internal::None,
5732     internal::None, internal::None, internal::None, internal::None,
5733     internal::None, internal::None, internal::None, internal::None> {
5734   typedef internal::Types30<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
5735       T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
5736       T27, T28, T29, T30> type;
5737 };
5738 template <typename T1, typename T2, typename T3, typename T4, typename T5,
5739     typename T6, typename T7, typename T8, typename T9, typename T10,
5740     typename T11, typename T12, typename T13, typename T14, typename T15,
5741     typename T16, typename T17, typename T18, typename T19, typename T20,
5742     typename T21, typename T22, typename T23, typename T24, typename T25,
5743     typename T26, typename T27, typename T28, typename T29, typename T30,
5744     typename T31>
5745 struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
5746     T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,
5747     T31, internal::None, internal::None, internal::None, internal::None,
5748     internal::None, internal::None, internal::None, internal::None,
5749     internal::None, internal::None, internal::None, internal::None,
5750     internal::None, internal::None, internal::None, internal::None,
5751     internal::None, internal::None, internal::None> {
5752   typedef internal::Types31<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
5753       T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
5754       T27, T28, T29, T30, T31> type;
5755 };
5756 template <typename T1, typename T2, typename T3, typename T4, typename T5,
5757     typename T6, typename T7, typename T8, typename T9, typename T10,
5758     typename T11, typename T12, typename T13, typename T14, typename T15,
5759     typename T16, typename T17, typename T18, typename T19, typename T20,
5760     typename T21, typename T22, typename T23, typename T24, typename T25,
5761     typename T26, typename T27, typename T28, typename T29, typename T30,
5762     typename T31, typename T32>
5763 struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
5764     T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,
5765     T31, T32, internal::None, internal::None, internal::None, internal::None,
5766     internal::None, internal::None, internal::None, internal::None,
5767     internal::None, internal::None, internal::None, internal::None,
5768     internal::None, internal::None, internal::None, internal::None,
5769     internal::None, internal::None> {
5770   typedef internal::Types32<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
5771       T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
5772       T27, T28, T29, T30, T31, T32> type;
5773 };
5774 template <typename T1, typename T2, typename T3, typename T4, typename T5,
5775     typename T6, typename T7, typename T8, typename T9, typename T10,
5776     typename T11, typename T12, typename T13, typename T14, typename T15,
5777     typename T16, typename T17, typename T18, typename T19, typename T20,
5778     typename T21, typename T22, typename T23, typename T24, typename T25,
5779     typename T26, typename T27, typename T28, typename T29, typename T30,
5780     typename T31, typename T32, typename T33>
5781 struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
5782     T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,
5783     T31, T32, T33, internal::None, internal::None, internal::None,
5784     internal::None, internal::None, internal::None, internal::None,
5785     internal::None, internal::None, internal::None, internal::None,
5786     internal::None, internal::None, internal::None, internal::None,
5787     internal::None, internal::None> {
5788   typedef internal::Types33<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
5789       T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
5790       T27, T28, T29, T30, T31, T32, T33> type;
5791 };
5792 template <typename T1, typename T2, typename T3, typename T4, typename T5,
5793     typename T6, typename T7, typename T8, typename T9, typename T10,
5794     typename T11, typename T12, typename T13, typename T14, typename T15,
5795     typename T16, typename T17, typename T18, typename T19, typename T20,
5796     typename T21, typename T22, typename T23, typename T24, typename T25,
5797     typename T26, typename T27, typename T28, typename T29, typename T30,
5798     typename T31, typename T32, typename T33, typename T34>
5799 struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
5800     T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,
5801     T31, T32, T33, T34, internal::None, internal::None, internal::None,
5802     internal::None, internal::None, internal::None, internal::None,
5803     internal::None, internal::None, internal::None, internal::None,
5804     internal::None, internal::None, internal::None, internal::None,
5805     internal::None> {
5806   typedef internal::Types34<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
5807       T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
5808       T27, T28, T29, T30, T31, T32, T33, T34> type;
5809 };
5810 template <typename T1, typename T2, typename T3, typename T4, typename T5,
5811     typename T6, typename T7, typename T8, typename T9, typename T10,
5812     typename T11, typename T12, typename T13, typename T14, typename T15,
5813     typename T16, typename T17, typename T18, typename T19, typename T20,
5814     typename T21, typename T22, typename T23, typename T24, typename T25,
5815     typename T26, typename T27, typename T28, typename T29, typename T30,
5816     typename T31, typename T32, typename T33, typename T34, typename T35>
5817 struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
5818     T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,
5819     T31, T32, T33, T34, T35, internal::None, internal::None, internal::None,
5820     internal::None, internal::None, internal::None, internal::None,
5821     internal::None, internal::None, internal::None, internal::None,
5822     internal::None, internal::None, internal::None, internal::None> {
5823   typedef internal::Types35<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
5824       T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
5825       T27, T28, T29, T30, T31, T32, T33, T34, T35> type;
5826 };
5827 template <typename T1, typename T2, typename T3, typename T4, typename T5,
5828     typename T6, typename T7, typename T8, typename T9, typename T10,
5829     typename T11, typename T12, typename T13, typename T14, typename T15,
5830     typename T16, typename T17, typename T18, typename T19, typename T20,
5831     typename T21, typename T22, typename T23, typename T24, typename T25,
5832     typename T26, typename T27, typename T28, typename T29, typename T30,
5833     typename T31, typename T32, typename T33, typename T34, typename T35,
5834     typename T36>
5835 struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
5836     T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,
5837     T31, T32, T33, T34, T35, T36, internal::None, internal::None,
5838     internal::None, internal::None, internal::None, internal::None,
5839     internal::None, internal::None, internal::None, internal::None,
5840     internal::None, internal::None, internal::None, internal::None> {
5841   typedef internal::Types36<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
5842       T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
5843       T27, T28, T29, T30, T31, T32, T33, T34, T35, T36> type;
5844 };
5845 template <typename T1, typename T2, typename T3, typename T4, typename T5,
5846     typename T6, typename T7, typename T8, typename T9, typename T10,
5847     typename T11, typename T12, typename T13, typename T14, typename T15,
5848     typename T16, typename T17, typename T18, typename T19, typename T20,
5849     typename T21, typename T22, typename T23, typename T24, typename T25,
5850     typename T26, typename T27, typename T28, typename T29, typename T30,
5851     typename T31, typename T32, typename T33, typename T34, typename T35,
5852     typename T36, typename T37>
5853 struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
5854     T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,
5855     T31, T32, T33, T34, T35, T36, T37, internal::None, internal::None,
5856     internal::None, internal::None, internal::None, internal::None,
5857     internal::None, internal::None, internal::None, internal::None,
5858     internal::None, internal::None, internal::None> {
5859   typedef internal::Types37<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
5860       T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
5861       T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37> type;
5862 };
5863 template <typename T1, typename T2, typename T3, typename T4, typename T5,
5864     typename T6, typename T7, typename T8, typename T9, typename T10,
5865     typename T11, typename T12, typename T13, typename T14, typename T15,
5866     typename T16, typename T17, typename T18, typename T19, typename T20,
5867     typename T21, typename T22, typename T23, typename T24, typename T25,
5868     typename T26, typename T27, typename T28, typename T29, typename T30,
5869     typename T31, typename T32, typename T33, typename T34, typename T35,
5870     typename T36, typename T37, typename T38>
5871 struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
5872     T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,
5873     T31, T32, T33, T34, T35, T36, T37, T38, internal::None, internal::None,
5874     internal::None, internal::None, internal::None, internal::None,
5875     internal::None, internal::None, internal::None, internal::None,
5876     internal::None, internal::None> {
5877   typedef internal::Types38<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
5878       T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
5879       T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38> type;
5880 };
5881 template <typename T1, typename T2, typename T3, typename T4, typename T5,
5882     typename T6, typename T7, typename T8, typename T9, typename T10,
5883     typename T11, typename T12, typename T13, typename T14, typename T15,
5884     typename T16, typename T17, typename T18, typename T19, typename T20,
5885     typename T21, typename T22, typename T23, typename T24, typename T25,
5886     typename T26, typename T27, typename T28, typename T29, typename T30,
5887     typename T31, typename T32, typename T33, typename T34, typename T35,
5888     typename T36, typename T37, typename T38, typename T39>
5889 struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
5890     T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,
5891     T31, T32, T33, T34, T35, T36, T37, T38, T39, internal::None,
5892     internal::None, internal::None, internal::None, internal::None,
5893     internal::None, internal::None, internal::None, internal::None,
5894     internal::None, internal::None> {
5895   typedef internal::Types39<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
5896       T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
5897       T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39> type;
5898 };
5899 template <typename T1, typename T2, typename T3, typename T4, typename T5,
5900     typename T6, typename T7, typename T8, typename T9, typename T10,
5901     typename T11, typename T12, typename T13, typename T14, typename T15,
5902     typename T16, typename T17, typename T18, typename T19, typename T20,
5903     typename T21, typename T22, typename T23, typename T24, typename T25,
5904     typename T26, typename T27, typename T28, typename T29, typename T30,
5905     typename T31, typename T32, typename T33, typename T34, typename T35,
5906     typename T36, typename T37, typename T38, typename T39, typename T40>
5907 struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
5908     T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,
5909     T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, internal::None,
5910     internal::None, internal::None, internal::None, internal::None,
5911     internal::None, internal::None, internal::None, internal::None,
5912     internal::None> {
5913   typedef internal::Types40<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
5914       T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
5915       T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39,
5916       T40> type;
5917 };
5918 template <typename T1, typename T2, typename T3, typename T4, typename T5,
5919     typename T6, typename T7, typename T8, typename T9, typename T10,
5920     typename T11, typename T12, typename T13, typename T14, typename T15,
5921     typename T16, typename T17, typename T18, typename T19, typename T20,
5922     typename T21, typename T22, typename T23, typename T24, typename T25,
5923     typename T26, typename T27, typename T28, typename T29, typename T30,
5924     typename T31, typename T32, typename T33, typename T34, typename T35,
5925     typename T36, typename T37, typename T38, typename T39, typename T40,
5926     typename T41>
5927 struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
5928     T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,
5929     T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, internal::None,
5930     internal::None, internal::None, internal::None, internal::None,
5931     internal::None, internal::None, internal::None, internal::None> {
5932   typedef internal::Types41<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
5933       T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
5934       T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40,
5935       T41> type;
5936 };
5937 template <typename T1, typename T2, typename T3, typename T4, typename T5,
5938     typename T6, typename T7, typename T8, typename T9, typename T10,
5939     typename T11, typename T12, typename T13, typename T14, typename T15,
5940     typename T16, typename T17, typename T18, typename T19, typename T20,
5941     typename T21, typename T22, typename T23, typename T24, typename T25,
5942     typename T26, typename T27, typename T28, typename T29, typename T30,
5943     typename T31, typename T32, typename T33, typename T34, typename T35,
5944     typename T36, typename T37, typename T38, typename T39, typename T40,
5945     typename T41, typename T42>
5946 struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
5947     T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,
5948     T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, internal::None,
5949     internal::None, internal::None, internal::None, internal::None,
5950     internal::None, internal::None, internal::None> {
5951   typedef internal::Types42<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
5952       T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
5953       T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40,
5954       T41, T42> type;
5955 };
5956 template <typename T1, typename T2, typename T3, typename T4, typename T5,
5957     typename T6, typename T7, typename T8, typename T9, typename T10,
5958     typename T11, typename T12, typename T13, typename T14, typename T15,
5959     typename T16, typename T17, typename T18, typename T19, typename T20,
5960     typename T21, typename T22, typename T23, typename T24, typename T25,
5961     typename T26, typename T27, typename T28, typename T29, typename T30,
5962     typename T31, typename T32, typename T33, typename T34, typename T35,
5963     typename T36, typename T37, typename T38, typename T39, typename T40,
5964     typename T41, typename T42, typename T43>
5965 struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
5966     T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,
5967     T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43,
5968     internal::None, internal::None, internal::None, internal::None,
5969     internal::None, internal::None, internal::None> {
5970   typedef internal::Types43<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
5971       T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
5972       T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40,
5973       T41, T42, T43> type;
5974 };
5975 template <typename T1, typename T2, typename T3, typename T4, typename T5,
5976     typename T6, typename T7, typename T8, typename T9, typename T10,
5977     typename T11, typename T12, typename T13, typename T14, typename T15,
5978     typename T16, typename T17, typename T18, typename T19, typename T20,
5979     typename T21, typename T22, typename T23, typename T24, typename T25,
5980     typename T26, typename T27, typename T28, typename T29, typename T30,
5981     typename T31, typename T32, typename T33, typename T34, typename T35,
5982     typename T36, typename T37, typename T38, typename T39, typename T40,
5983     typename T41, typename T42, typename T43, typename T44>
5984 struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
5985     T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,
5986     T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, T44,
5987     internal::None, internal::None, internal::None, internal::None,
5988     internal::None, internal::None> {
5989   typedef internal::Types44<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
5990       T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
5991       T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40,
5992       T41, T42, T43, T44> type;
5993 };
5994 template <typename T1, typename T2, typename T3, typename T4, typename T5,
5995     typename T6, typename T7, typename T8, typename T9, typename T10,
5996     typename T11, typename T12, typename T13, typename T14, typename T15,
5997     typename T16, typename T17, typename T18, typename T19, typename T20,
5998     typename T21, typename T22, typename T23, typename T24, typename T25,
5999     typename T26, typename T27, typename T28, typename T29, typename T30,
6000     typename T31, typename T32, typename T33, typename T34, typename T35,
6001     typename T36, typename T37, typename T38, typename T39, typename T40,
6002     typename T41, typename T42, typename T43, typename T44, typename T45>
6003 struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
6004     T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,
6005     T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, T44, T45,
6006     internal::None, internal::None, internal::None, internal::None,
6007     internal::None> {
6008   typedef internal::Types45<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
6009       T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
6010       T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40,
6011       T41, T42, T43, T44, T45> type;
6012 };
6013 template <typename T1, typename T2, typename T3, typename T4, typename T5,
6014     typename T6, typename T7, typename T8, typename T9, typename T10,
6015     typename T11, typename T12, typename T13, typename T14, typename T15,
6016     typename T16, typename T17, typename T18, typename T19, typename T20,
6017     typename T21, typename T22, typename T23, typename T24, typename T25,
6018     typename T26, typename T27, typename T28, typename T29, typename T30,
6019     typename T31, typename T32, typename T33, typename T34, typename T35,
6020     typename T36, typename T37, typename T38, typename T39, typename T40,
6021     typename T41, typename T42, typename T43, typename T44, typename T45,
6022     typename T46>
6023 struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
6024     T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,
6025     T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, T44, T45,
6026     T46, internal::None, internal::None, internal::None, internal::None> {
6027   typedef internal::Types46<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
6028       T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
6029       T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40,
6030       T41, T42, T43, T44, T45, T46> type;
6031 };
6032 template <typename T1, typename T2, typename T3, typename T4, typename T5,
6033     typename T6, typename T7, typename T8, typename T9, typename T10,
6034     typename T11, typename T12, typename T13, typename T14, typename T15,
6035     typename T16, typename T17, typename T18, typename T19, typename T20,
6036     typename T21, typename T22, typename T23, typename T24, typename T25,
6037     typename T26, typename T27, typename T28, typename T29, typename T30,
6038     typename T31, typename T32, typename T33, typename T34, typename T35,
6039     typename T36, typename T37, typename T38, typename T39, typename T40,
6040     typename T41, typename T42, typename T43, typename T44, typename T45,
6041     typename T46, typename T47>
6042 struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
6043     T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,
6044     T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, T44, T45,
6045     T46, T47, internal::None, internal::None, internal::None> {
6046   typedef internal::Types47<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
6047       T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
6048       T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40,
6049       T41, T42, T43, T44, T45, T46, T47> type;
6050 };
6051 template <typename T1, typename T2, typename T3, typename T4, typename T5,
6052     typename T6, typename T7, typename T8, typename T9, typename T10,
6053     typename T11, typename T12, typename T13, typename T14, typename T15,
6054     typename T16, typename T17, typename T18, typename T19, typename T20,
6055     typename T21, typename T22, typename T23, typename T24, typename T25,
6056     typename T26, typename T27, typename T28, typename T29, typename T30,
6057     typename T31, typename T32, typename T33, typename T34, typename T35,
6058     typename T36, typename T37, typename T38, typename T39, typename T40,
6059     typename T41, typename T42, typename T43, typename T44, typename T45,
6060     typename T46, typename T47, typename T48>
6061 struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
6062     T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,
6063     T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, T44, T45,
6064     T46, T47, T48, internal::None, internal::None> {
6065   typedef internal::Types48<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
6066       T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
6067       T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40,
6068       T41, T42, T43, T44, T45, T46, T47, T48> type;
6069 };
6070 template <typename T1, typename T2, typename T3, typename T4, typename T5,
6071     typename T6, typename T7, typename T8, typename T9, typename T10,
6072     typename T11, typename T12, typename T13, typename T14, typename T15,
6073     typename T16, typename T17, typename T18, typename T19, typename T20,
6074     typename T21, typename T22, typename T23, typename T24, typename T25,
6075     typename T26, typename T27, typename T28, typename T29, typename T30,
6076     typename T31, typename T32, typename T33, typename T34, typename T35,
6077     typename T36, typename T37, typename T38, typename T39, typename T40,
6078     typename T41, typename T42, typename T43, typename T44, typename T45,
6079     typename T46, typename T47, typename T48, typename T49>
6080 struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
6081     T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,
6082     T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, T44, T45,
6083     T46, T47, T48, T49, internal::None> {
6084   typedef internal::Types49<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
6085       T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
6086       T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40,
6087       T41, T42, T43, T44, T45, T46, T47, T48, T49> type;
6088 };
6089 
6090 namespace internal {
6091 
6092 # define GTEST_TEMPLATE_ template <typename T> class
6093 
6094 // The template "selector" struct TemplateSel<Tmpl> is used to
6095 // represent Tmpl, which must be a class template with one type
6096 // parameter, as a type.  TemplateSel<Tmpl>::Bind<T>::type is defined
6097 // as the type Tmpl<T>.  This allows us to actually instantiate the
6098 // template "selected" by TemplateSel<Tmpl>.
6099 //
6100 // This trick is necessary for simulating typedef for class templates,
6101 // which C++ doesn't support directly.
6102 template <GTEST_TEMPLATE_ Tmpl>
6103 struct TemplateSel {
6104   template <typename T>
6105   struct Bind {
6106     typedef Tmpl<T> type;
6107   };
6108 };
6109 
6110 # define GTEST_BIND_(TmplSel, T) \
6111   TmplSel::template Bind<T>::type
6112 
6113 // A unique struct template used as the default value for the
6114 // arguments of class template Templates.  This allows us to simulate
6115 // variadic templates (e.g. Templates<int>, Templates<int, double>,
6116 // and etc), which C++ doesn't support directly.
6117 template <typename T>
6118 struct NoneT {};
6119 
6120 // The following family of struct and struct templates are used to
6121 // represent template lists.  In particular, TemplatesN<T1, T2, ...,
6122 // TN> represents a list of N templates (T1, T2, ..., and TN).  Except
6123 // for Templates0, every struct in the family has two member types:
6124 // Head for the selector of the first template in the list, and Tail
6125 // for the rest of the list.
6126 
6127 // The empty template list.
6128 struct Templates0 {};
6129 
6130 // Template lists of length 1, 2, 3, and so on.
6131 
6132 template <GTEST_TEMPLATE_ T1>
6133 struct Templates1 {
6134   typedef TemplateSel<T1> Head;
6135   typedef Templates0 Tail;
6136 };
6137 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2>
6138 struct Templates2 {
6139   typedef TemplateSel<T1> Head;
6140   typedef Templates1<T2> Tail;
6141 };
6142 
6143 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3>
6144 struct Templates3 {
6145   typedef TemplateSel<T1> Head;
6146   typedef Templates2<T2, T3> Tail;
6147 };
6148 
6149 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
6150     GTEST_TEMPLATE_ T4>
6151 struct Templates4 {
6152   typedef TemplateSel<T1> Head;
6153   typedef Templates3<T2, T3, T4> Tail;
6154 };
6155 
6156 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
6157     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5>
6158 struct Templates5 {
6159   typedef TemplateSel<T1> Head;
6160   typedef Templates4<T2, T3, T4, T5> Tail;
6161 };
6162 
6163 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
6164     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6>
6165 struct Templates6 {
6166   typedef TemplateSel<T1> Head;
6167   typedef Templates5<T2, T3, T4, T5, T6> Tail;
6168 };
6169 
6170 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
6171     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
6172     GTEST_TEMPLATE_ T7>
6173 struct Templates7 {
6174   typedef TemplateSel<T1> Head;
6175   typedef Templates6<T2, T3, T4, T5, T6, T7> Tail;
6176 };
6177 
6178 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
6179     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
6180     GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8>
6181 struct Templates8 {
6182   typedef TemplateSel<T1> Head;
6183   typedef Templates7<T2, T3, T4, T5, T6, T7, T8> Tail;
6184 };
6185 
6186 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
6187     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
6188     GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9>
6189 struct Templates9 {
6190   typedef TemplateSel<T1> Head;
6191   typedef Templates8<T2, T3, T4, T5, T6, T7, T8, T9> Tail;
6192 };
6193 
6194 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
6195     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
6196     GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
6197     GTEST_TEMPLATE_ T10>
6198 struct Templates10 {
6199   typedef TemplateSel<T1> Head;
6200   typedef Templates9<T2, T3, T4, T5, T6, T7, T8, T9, T10> Tail;
6201 };
6202 
6203 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
6204     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
6205     GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
6206     GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11>
6207 struct Templates11 {
6208   typedef TemplateSel<T1> Head;
6209   typedef Templates10<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11> Tail;
6210 };
6211 
6212 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
6213     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
6214     GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
6215     GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12>
6216 struct Templates12 {
6217   typedef TemplateSel<T1> Head;
6218   typedef Templates11<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12> Tail;
6219 };
6220 
6221 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
6222     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
6223     GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
6224     GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
6225     GTEST_TEMPLATE_ T13>
6226 struct Templates13 {
6227   typedef TemplateSel<T1> Head;
6228   typedef Templates12<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13> Tail;
6229 };
6230 
6231 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
6232     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
6233     GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
6234     GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
6235     GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14>
6236 struct Templates14 {
6237   typedef TemplateSel<T1> Head;
6238   typedef Templates13<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
6239       T14> Tail;
6240 };
6241 
6242 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
6243     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
6244     GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
6245     GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
6246     GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15>
6247 struct Templates15 {
6248   typedef TemplateSel<T1> Head;
6249   typedef Templates14<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
6250       T15> Tail;
6251 };
6252 
6253 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
6254     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
6255     GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
6256     GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
6257     GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
6258     GTEST_TEMPLATE_ T16>
6259 struct Templates16 {
6260   typedef TemplateSel<T1> Head;
6261   typedef Templates15<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
6262       T15, T16> Tail;
6263 };
6264 
6265 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
6266     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
6267     GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
6268     GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
6269     GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
6270     GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17>
6271 struct Templates17 {
6272   typedef TemplateSel<T1> Head;
6273   typedef Templates16<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
6274       T15, T16, T17> Tail;
6275 };
6276 
6277 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
6278     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
6279     GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
6280     GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
6281     GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
6282     GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18>
6283 struct Templates18 {
6284   typedef TemplateSel<T1> Head;
6285   typedef Templates17<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
6286       T15, T16, T17, T18> Tail;
6287 };
6288 
6289 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
6290     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
6291     GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
6292     GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
6293     GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
6294     GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
6295     GTEST_TEMPLATE_ T19>
6296 struct Templates19 {
6297   typedef TemplateSel<T1> Head;
6298   typedef Templates18<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
6299       T15, T16, T17, T18, T19> Tail;
6300 };
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, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
6306     GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
6307     GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
6308     GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20>
6309 struct Templates20 {
6310   typedef TemplateSel<T1> Head;
6311   typedef Templates19<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
6312       T15, T16, T17, T18, T19, T20> Tail;
6313 };
6314 
6315 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
6316     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
6317     GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
6318     GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
6319     GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
6320     GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
6321     GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21>
6322 struct Templates21 {
6323   typedef TemplateSel<T1> Head;
6324   typedef Templates20<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
6325       T15, T16, T17, T18, T19, T20, T21> Tail;
6326 };
6327 
6328 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
6329     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
6330     GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
6331     GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
6332     GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
6333     GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
6334     GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
6335     GTEST_TEMPLATE_ T22>
6336 struct Templates22 {
6337   typedef TemplateSel<T1> Head;
6338   typedef Templates21<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
6339       T15, T16, T17, T18, T19, T20, T21, T22> Tail;
6340 };
6341 
6342 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
6343     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
6344     GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
6345     GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
6346     GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
6347     GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
6348     GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
6349     GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23>
6350 struct Templates23 {
6351   typedef TemplateSel<T1> Head;
6352   typedef Templates22<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
6353       T15, T16, T17, T18, T19, T20, T21, T22, T23> Tail;
6354 };
6355 
6356 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
6357     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
6358     GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
6359     GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
6360     GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
6361     GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
6362     GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
6363     GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24>
6364 struct Templates24 {
6365   typedef TemplateSel<T1> Head;
6366   typedef Templates23<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
6367       T15, T16, T17, T18, T19, T20, T21, T22, T23, T24> Tail;
6368 };
6369 
6370 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
6371     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
6372     GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
6373     GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
6374     GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
6375     GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
6376     GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
6377     GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
6378     GTEST_TEMPLATE_ T25>
6379 struct Templates25 {
6380   typedef TemplateSel<T1> Head;
6381   typedef Templates24<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
6382       T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25> Tail;
6383 };
6384 
6385 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
6386     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
6387     GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
6388     GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
6389     GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
6390     GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
6391     GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
6392     GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
6393     GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26>
6394 struct Templates26 {
6395   typedef TemplateSel<T1> Head;
6396   typedef Templates25<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
6397       T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26> Tail;
6398 };
6399 
6400 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
6401     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
6402     GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
6403     GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
6404     GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
6405     GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
6406     GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
6407     GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
6408     GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27>
6409 struct Templates27 {
6410   typedef TemplateSel<T1> Head;
6411   typedef Templates26<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
6412       T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27> Tail;
6413 };
6414 
6415 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
6416     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
6417     GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
6418     GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
6419     GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
6420     GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
6421     GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
6422     GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
6423     GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
6424     GTEST_TEMPLATE_ T28>
6425 struct Templates28 {
6426   typedef TemplateSel<T1> Head;
6427   typedef Templates27<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
6428       T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
6429       T28> Tail;
6430 };
6431 
6432 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
6433     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
6434     GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
6435     GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
6436     GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
6437     GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
6438     GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
6439     GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
6440     GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
6441     GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29>
6442 struct Templates29 {
6443   typedef TemplateSel<T1> Head;
6444   typedef Templates28<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
6445       T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
6446       T29> Tail;
6447 };
6448 
6449 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
6450     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
6451     GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
6452     GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
6453     GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
6454     GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
6455     GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
6456     GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
6457     GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
6458     GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30>
6459 struct Templates30 {
6460   typedef TemplateSel<T1> Head;
6461   typedef Templates29<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
6462       T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
6463       T29, T30> Tail;
6464 };
6465 
6466 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
6467     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
6468     GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
6469     GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
6470     GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
6471     GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
6472     GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
6473     GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
6474     GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
6475     GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
6476     GTEST_TEMPLATE_ T31>
6477 struct Templates31 {
6478   typedef TemplateSel<T1> Head;
6479   typedef Templates30<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
6480       T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
6481       T29, T30, T31> Tail;
6482 };
6483 
6484 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
6485     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
6486     GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
6487     GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
6488     GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
6489     GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
6490     GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
6491     GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
6492     GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
6493     GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
6494     GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32>
6495 struct Templates32 {
6496   typedef TemplateSel<T1> Head;
6497   typedef Templates31<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
6498       T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
6499       T29, T30, T31, T32> Tail;
6500 };
6501 
6502 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
6503     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
6504     GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
6505     GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
6506     GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
6507     GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
6508     GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
6509     GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
6510     GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
6511     GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
6512     GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33>
6513 struct Templates33 {
6514   typedef TemplateSel<T1> Head;
6515   typedef Templates32<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
6516       T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
6517       T29, T30, T31, T32, T33> Tail;
6518 };
6519 
6520 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
6521     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
6522     GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
6523     GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
6524     GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
6525     GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
6526     GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
6527     GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
6528     GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
6529     GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
6530     GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
6531     GTEST_TEMPLATE_ T34>
6532 struct Templates34 {
6533   typedef TemplateSel<T1> Head;
6534   typedef Templates33<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
6535       T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
6536       T29, T30, T31, T32, T33, T34> Tail;
6537 };
6538 
6539 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
6540     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
6541     GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
6542     GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
6543     GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
6544     GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
6545     GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
6546     GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
6547     GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
6548     GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
6549     GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
6550     GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35>
6551 struct Templates35 {
6552   typedef TemplateSel<T1> Head;
6553   typedef Templates34<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
6554       T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
6555       T29, T30, T31, T32, T33, T34, T35> Tail;
6556 };
6557 
6558 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
6559     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
6560     GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
6561     GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
6562     GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
6563     GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
6564     GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
6565     GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
6566     GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
6567     GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
6568     GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
6569     GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36>
6570 struct Templates36 {
6571   typedef TemplateSel<T1> Head;
6572   typedef Templates35<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
6573       T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
6574       T29, T30, T31, T32, T33, T34, T35, T36> Tail;
6575 };
6576 
6577 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
6578     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
6579     GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
6580     GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
6581     GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
6582     GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
6583     GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
6584     GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
6585     GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
6586     GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
6587     GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
6588     GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
6589     GTEST_TEMPLATE_ T37>
6590 struct Templates37 {
6591   typedef TemplateSel<T1> Head;
6592   typedef Templates36<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
6593       T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
6594       T29, T30, T31, T32, T33, T34, T35, T36, T37> Tail;
6595 };
6596 
6597 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
6598     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
6599     GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
6600     GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
6601     GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
6602     GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
6603     GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
6604     GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
6605     GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
6606     GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
6607     GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
6608     GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
6609     GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38>
6610 struct Templates38 {
6611   typedef TemplateSel<T1> Head;
6612   typedef Templates37<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
6613       T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
6614       T29, T30, T31, T32, T33, T34, T35, T36, T37, T38> Tail;
6615 };
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, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
6628     GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
6629     GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39>
6630 struct Templates39 {
6631   typedef TemplateSel<T1> Head;
6632   typedef Templates38<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
6633       T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
6634       T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39> Tail;
6635 };
6636 
6637 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
6638     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
6639     GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
6640     GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
6641     GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
6642     GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
6643     GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
6644     GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
6645     GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
6646     GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
6647     GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
6648     GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
6649     GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,
6650     GTEST_TEMPLATE_ T40>
6651 struct Templates40 {
6652   typedef TemplateSel<T1> Head;
6653   typedef Templates39<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
6654       T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
6655       T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40> Tail;
6656 };
6657 
6658 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
6659     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
6660     GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
6661     GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
6662     GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
6663     GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
6664     GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
6665     GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
6666     GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
6667     GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
6668     GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
6669     GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
6670     GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,
6671     GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41>
6672 struct Templates41 {
6673   typedef TemplateSel<T1> Head;
6674   typedef Templates40<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
6675       T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
6676       T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41> Tail;
6677 };
6678 
6679 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
6680     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
6681     GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
6682     GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
6683     GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
6684     GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
6685     GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
6686     GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
6687     GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
6688     GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
6689     GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
6690     GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
6691     GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,
6692     GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42>
6693 struct Templates42 {
6694   typedef TemplateSel<T1> Head;
6695   typedef Templates41<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
6696       T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
6697       T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41,
6698       T42> Tail;
6699 };
6700 
6701 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
6702     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
6703     GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
6704     GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
6705     GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
6706     GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
6707     GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
6708     GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
6709     GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
6710     GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
6711     GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
6712     GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
6713     GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,
6714     GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42,
6715     GTEST_TEMPLATE_ T43>
6716 struct Templates43 {
6717   typedef TemplateSel<T1> Head;
6718   typedef Templates42<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
6719       T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
6720       T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42,
6721       T43> Tail;
6722 };
6723 
6724 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
6725     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
6726     GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
6727     GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
6728     GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
6729     GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
6730     GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
6731     GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
6732     GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
6733     GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
6734     GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
6735     GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
6736     GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,
6737     GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42,
6738     GTEST_TEMPLATE_ T43, GTEST_TEMPLATE_ T44>
6739 struct Templates44 {
6740   typedef TemplateSel<T1> Head;
6741   typedef Templates43<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
6742       T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
6743       T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42,
6744       T43, T44> Tail;
6745 };
6746 
6747 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
6748     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
6749     GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
6750     GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
6751     GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
6752     GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
6753     GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
6754     GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
6755     GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
6756     GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
6757     GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
6758     GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
6759     GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,
6760     GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42,
6761     GTEST_TEMPLATE_ T43, GTEST_TEMPLATE_ T44, GTEST_TEMPLATE_ T45>
6762 struct Templates45 {
6763   typedef TemplateSel<T1> Head;
6764   typedef Templates44<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
6765       T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
6766       T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42,
6767       T43, T44, T45> Tail;
6768 };
6769 
6770 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
6771     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
6772     GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
6773     GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
6774     GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
6775     GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
6776     GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
6777     GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
6778     GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
6779     GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
6780     GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
6781     GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
6782     GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,
6783     GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42,
6784     GTEST_TEMPLATE_ T43, GTEST_TEMPLATE_ T44, GTEST_TEMPLATE_ T45,
6785     GTEST_TEMPLATE_ T46>
6786 struct Templates46 {
6787   typedef TemplateSel<T1> Head;
6788   typedef Templates45<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
6789       T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
6790       T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42,
6791       T43, T44, T45, T46> Tail;
6792 };
6793 
6794 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
6795     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
6796     GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
6797     GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
6798     GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
6799     GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
6800     GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
6801     GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
6802     GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
6803     GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
6804     GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
6805     GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
6806     GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,
6807     GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42,
6808     GTEST_TEMPLATE_ T43, GTEST_TEMPLATE_ T44, GTEST_TEMPLATE_ T45,
6809     GTEST_TEMPLATE_ T46, GTEST_TEMPLATE_ T47>
6810 struct Templates47 {
6811   typedef TemplateSel<T1> Head;
6812   typedef Templates46<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
6813       T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
6814       T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42,
6815       T43, T44, T45, T46, T47> Tail;
6816 };
6817 
6818 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
6819     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
6820     GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
6821     GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
6822     GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
6823     GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
6824     GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
6825     GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
6826     GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
6827     GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
6828     GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
6829     GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
6830     GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,
6831     GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42,
6832     GTEST_TEMPLATE_ T43, GTEST_TEMPLATE_ T44, GTEST_TEMPLATE_ T45,
6833     GTEST_TEMPLATE_ T46, GTEST_TEMPLATE_ T47, GTEST_TEMPLATE_ T48>
6834 struct Templates48 {
6835   typedef TemplateSel<T1> Head;
6836   typedef Templates47<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
6837       T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
6838       T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42,
6839       T43, T44, T45, T46, T47, T48> Tail;
6840 };
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     GTEST_TEMPLATE_ T43, GTEST_TEMPLATE_ T44, GTEST_TEMPLATE_ T45,
6857     GTEST_TEMPLATE_ T46, GTEST_TEMPLATE_ T47, GTEST_TEMPLATE_ T48,
6858     GTEST_TEMPLATE_ T49>
6859 struct Templates49 {
6860   typedef TemplateSel<T1> Head;
6861   typedef Templates48<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
6862       T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
6863       T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42,
6864       T43, T44, T45, T46, T47, T48, T49> Tail;
6865 };
6866 
6867 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
6868     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
6869     GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
6870     GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
6871     GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
6872     GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
6873     GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
6874     GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
6875     GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
6876     GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
6877     GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
6878     GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
6879     GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,
6880     GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42,
6881     GTEST_TEMPLATE_ T43, GTEST_TEMPLATE_ T44, GTEST_TEMPLATE_ T45,
6882     GTEST_TEMPLATE_ T46, GTEST_TEMPLATE_ T47, GTEST_TEMPLATE_ T48,
6883     GTEST_TEMPLATE_ T49, GTEST_TEMPLATE_ T50>
6884 struct Templates50 {
6885   typedef TemplateSel<T1> Head;
6886   typedef Templates49<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
6887       T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
6888       T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42,
6889       T43, T44, T45, T46, T47, T48, T49, T50> Tail;
6890 };
6891 
6892 
6893 // We don't want to require the users to write TemplatesN<...> directly,
6894 // as that would require them to count the length.  Templates<...> is much
6895 // easier to write, but generates horrible messages when there is a
6896 // compiler error, as gcc insists on printing out each template
6897 // argument, even if it has the default value (this means Templates<list>
6898 // will appear as Templates<list, NoneT, NoneT, ..., NoneT> in the compiler
6899 // errors).
6900 //
6901 // Our solution is to combine the best part of the two approaches: a
6902 // user would write Templates<T1, ..., TN>, and Google Test will translate
6903 // that to TemplatesN<T1, ..., TN> internally to make error messages
6904 // readable.  The translation is done by the 'type' member of the
6905 // Templates template.
6906 template <GTEST_TEMPLATE_ T1 = NoneT, GTEST_TEMPLATE_ T2 = NoneT,
6907     GTEST_TEMPLATE_ T3 = NoneT, GTEST_TEMPLATE_ T4 = NoneT,
6908     GTEST_TEMPLATE_ T5 = NoneT, GTEST_TEMPLATE_ T6 = NoneT,
6909     GTEST_TEMPLATE_ T7 = NoneT, GTEST_TEMPLATE_ T8 = NoneT,
6910     GTEST_TEMPLATE_ T9 = NoneT, GTEST_TEMPLATE_ T10 = NoneT,
6911     GTEST_TEMPLATE_ T11 = NoneT, GTEST_TEMPLATE_ T12 = NoneT,
6912     GTEST_TEMPLATE_ T13 = NoneT, GTEST_TEMPLATE_ T14 = NoneT,
6913     GTEST_TEMPLATE_ T15 = NoneT, GTEST_TEMPLATE_ T16 = NoneT,
6914     GTEST_TEMPLATE_ T17 = NoneT, GTEST_TEMPLATE_ T18 = NoneT,
6915     GTEST_TEMPLATE_ T19 = NoneT, GTEST_TEMPLATE_ T20 = NoneT,
6916     GTEST_TEMPLATE_ T21 = NoneT, GTEST_TEMPLATE_ T22 = NoneT,
6917     GTEST_TEMPLATE_ T23 = NoneT, GTEST_TEMPLATE_ T24 = NoneT,
6918     GTEST_TEMPLATE_ T25 = NoneT, GTEST_TEMPLATE_ T26 = NoneT,
6919     GTEST_TEMPLATE_ T27 = NoneT, GTEST_TEMPLATE_ T28 = NoneT,
6920     GTEST_TEMPLATE_ T29 = NoneT, GTEST_TEMPLATE_ T30 = NoneT,
6921     GTEST_TEMPLATE_ T31 = NoneT, GTEST_TEMPLATE_ T32 = NoneT,
6922     GTEST_TEMPLATE_ T33 = NoneT, GTEST_TEMPLATE_ T34 = NoneT,
6923     GTEST_TEMPLATE_ T35 = NoneT, GTEST_TEMPLATE_ T36 = NoneT,
6924     GTEST_TEMPLATE_ T37 = NoneT, GTEST_TEMPLATE_ T38 = NoneT,
6925     GTEST_TEMPLATE_ T39 = NoneT, GTEST_TEMPLATE_ T40 = NoneT,
6926     GTEST_TEMPLATE_ T41 = NoneT, GTEST_TEMPLATE_ T42 = NoneT,
6927     GTEST_TEMPLATE_ T43 = NoneT, GTEST_TEMPLATE_ T44 = NoneT,
6928     GTEST_TEMPLATE_ T45 = NoneT, GTEST_TEMPLATE_ T46 = NoneT,
6929     GTEST_TEMPLATE_ T47 = NoneT, GTEST_TEMPLATE_ T48 = NoneT,
6930     GTEST_TEMPLATE_ T49 = NoneT, GTEST_TEMPLATE_ T50 = NoneT>
6931 struct Templates {
6932   typedef Templates50<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, T46, T47, T48, T49, T50> type;
6936 };
6937 
6938 template <>
6939 struct Templates<NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
6940     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
6941     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
6942     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
6943     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
6944     NoneT> {
6945   typedef Templates0 type;
6946 };
6947 template <GTEST_TEMPLATE_ T1>
6948 struct Templates<T1, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
6949     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
6950     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
6951     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
6952     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
6953     NoneT> {
6954   typedef Templates1<T1> type;
6955 };
6956 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2>
6957 struct Templates<T1, T2, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
6958     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
6959     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
6960     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
6961     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
6962     NoneT> {
6963   typedef Templates2<T1, T2> type;
6964 };
6965 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3>
6966 struct Templates<T1, T2, T3, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
6967     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
6968     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
6969     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
6970     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
6971   typedef Templates3<T1, T2, T3> type;
6972 };
6973 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
6974     GTEST_TEMPLATE_ T4>
6975 struct Templates<T1, T2, T3, T4, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
6976     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
6977     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
6978     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
6979     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
6980   typedef Templates4<T1, T2, T3, T4> type;
6981 };
6982 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
6983     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5>
6984 struct Templates<T1, T2, T3, T4, T5, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
6985     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
6986     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
6987     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
6988     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
6989   typedef Templates5<T1, T2, T3, T4, T5> type;
6990 };
6991 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
6992     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6>
6993 struct Templates<T1, T2, T3, T4, T5, T6, NoneT, NoneT, NoneT, NoneT, NoneT,
6994     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
6995     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
6996     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
6997     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
6998   typedef Templates6<T1, T2, T3, T4, T5, T6> type;
6999 };
7000 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
7001     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
7002     GTEST_TEMPLATE_ T7>
7003 struct Templates<T1, T2, T3, T4, T5, T6, T7, NoneT, NoneT, NoneT, NoneT, NoneT,
7004     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
7005     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
7006     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
7007     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
7008   typedef Templates7<T1, T2, T3, T4, T5, T6, T7> type;
7009 };
7010 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
7011     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
7012     GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8>
7013 struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, NoneT, NoneT, NoneT, NoneT,
7014     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
7015     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
7016     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
7017     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
7018   typedef Templates8<T1, T2, T3, T4, T5, T6, T7, T8> type;
7019 };
7020 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
7021     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
7022     GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9>
7023 struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, NoneT, NoneT, NoneT,
7024     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
7025     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
7026     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
7027     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
7028   typedef Templates9<T1, T2, T3, T4, T5, T6, T7, T8, T9> type;
7029 };
7030 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
7031     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
7032     GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
7033     GTEST_TEMPLATE_ T10>
7034 struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, NoneT, NoneT, NoneT,
7035     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
7036     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
7037     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
7038     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
7039   typedef Templates10<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> type;
7040 };
7041 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
7042     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
7043     GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
7044     GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11>
7045 struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, NoneT, NoneT,
7046     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
7047     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
7048     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
7049     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
7050   typedef Templates11<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11> type;
7051 };
7052 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
7053     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
7054     GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
7055     GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12>
7056 struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, NoneT,
7057     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
7058     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
7059     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
7060     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
7061   typedef Templates12<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12> type;
7062 };
7063 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
7064     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
7065     GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
7066     GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
7067     GTEST_TEMPLATE_ T13>
7068 struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, NoneT,
7069     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
7070     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
7071     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
7072     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
7073   typedef Templates13<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
7074       T13> type;
7075 };
7076 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
7077     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
7078     GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
7079     GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
7080     GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14>
7081 struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
7082     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
7083     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
7084     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
7085     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
7086   typedef Templates14<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
7087       T14> type;
7088 };
7089 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
7090     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
7091     GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
7092     GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
7093     GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15>
7094 struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
7095     T15, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
7096     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
7097     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
7098     NoneT, NoneT, NoneT, NoneT, NoneT> {
7099   typedef Templates15<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
7100       T14, T15> type;
7101 };
7102 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
7103     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
7104     GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
7105     GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
7106     GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
7107     GTEST_TEMPLATE_ T16>
7108 struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
7109     T15, T16, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
7110     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
7111     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
7112     NoneT, NoneT, NoneT, NoneT, NoneT> {
7113   typedef Templates16<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
7114       T14, T15, T16> type;
7115 };
7116 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
7117     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
7118     GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
7119     GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
7120     GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
7121     GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17>
7122 struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
7123     T15, T16, T17, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
7124     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
7125     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
7126     NoneT, NoneT, NoneT, NoneT, NoneT> {
7127   typedef Templates17<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
7128       T14, T15, T16, T17> type;
7129 };
7130 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
7131     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
7132     GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
7133     GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
7134     GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
7135     GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18>
7136 struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
7137     T15, T16, T17, T18, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
7138     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
7139     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
7140     NoneT, NoneT, NoneT, NoneT> {
7141   typedef Templates18<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
7142       T14, T15, T16, T17, T18> type;
7143 };
7144 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
7145     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
7146     GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
7147     GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
7148     GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
7149     GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
7150     GTEST_TEMPLATE_ T19>
7151 struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
7152     T15, T16, T17, T18, T19, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
7153     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
7154     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
7155     NoneT, NoneT, NoneT, NoneT> {
7156   typedef Templates19<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
7157       T14, T15, T16, T17, T18, T19> type;
7158 };
7159 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
7160     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
7161     GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
7162     GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
7163     GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
7164     GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
7165     GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20>
7166 struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
7167     T15, T16, T17, T18, T19, T20, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
7168     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
7169     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
7170     NoneT, NoneT, NoneT, NoneT> {
7171   typedef Templates20<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
7172       T14, T15, T16, T17, T18, T19, T20> type;
7173 };
7174 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
7175     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
7176     GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
7177     GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
7178     GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
7179     GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
7180     GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21>
7181 struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
7182     T15, T16, T17, T18, T19, T20, T21, NoneT, NoneT, NoneT, NoneT, NoneT,
7183     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
7184     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
7185     NoneT, NoneT, NoneT, NoneT> {
7186   typedef Templates21<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
7187       T14, T15, T16, T17, T18, T19, T20, T21> type;
7188 };
7189 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
7190     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
7191     GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
7192     GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
7193     GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
7194     GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
7195     GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
7196     GTEST_TEMPLATE_ T22>
7197 struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
7198     T15, T16, T17, T18, T19, T20, T21, T22, NoneT, NoneT, NoneT, NoneT, NoneT,
7199     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
7200     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
7201     NoneT, NoneT, NoneT> {
7202   typedef Templates22<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
7203       T14, T15, T16, T17, T18, T19, T20, T21, T22> type;
7204 };
7205 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
7206     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
7207     GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
7208     GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
7209     GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
7210     GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
7211     GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
7212     GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23>
7213 struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
7214     T15, T16, T17, T18, T19, T20, T21, T22, T23, NoneT, NoneT, NoneT, NoneT,
7215     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
7216     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
7217     NoneT, NoneT, NoneT> {
7218   typedef Templates23<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
7219       T14, T15, T16, T17, T18, T19, T20, T21, T22, T23> type;
7220 };
7221 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
7222     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
7223     GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
7224     GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
7225     GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
7226     GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
7227     GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
7228     GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24>
7229 struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
7230     T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, NoneT, NoneT, NoneT,
7231     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
7232     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
7233     NoneT, NoneT, NoneT> {
7234   typedef Templates24<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
7235       T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24> type;
7236 };
7237 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
7238     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
7239     GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
7240     GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
7241     GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
7242     GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
7243     GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
7244     GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
7245     GTEST_TEMPLATE_ T25>
7246 struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
7247     T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, NoneT, NoneT, NoneT,
7248     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
7249     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
7250     NoneT, NoneT> {
7251   typedef Templates25<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
7252       T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25> type;
7253 };
7254 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
7255     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
7256     GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
7257     GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
7258     GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
7259     GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
7260     GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
7261     GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
7262     GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26>
7263 struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
7264     T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, NoneT, NoneT,
7265     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
7266     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
7267     NoneT, NoneT> {
7268   typedef Templates26<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
7269       T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26> type;
7270 };
7271 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
7272     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
7273     GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
7274     GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
7275     GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
7276     GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
7277     GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
7278     GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
7279     GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27>
7280 struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
7281     T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, NoneT,
7282     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
7283     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
7284     NoneT, NoneT> {
7285   typedef Templates27<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
7286       T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
7287       T27> type;
7288 };
7289 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
7290     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
7291     GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
7292     GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
7293     GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
7294     GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
7295     GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
7296     GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
7297     GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
7298     GTEST_TEMPLATE_ T28>
7299 struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
7300     T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
7301     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
7302     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
7303     NoneT, NoneT> {
7304   typedef Templates28<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
7305       T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
7306       T28> type;
7307 };
7308 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
7309     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
7310     GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
7311     GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
7312     GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
7313     GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
7314     GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
7315     GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
7316     GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
7317     GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29>
7318 struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
7319     T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
7320     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
7321     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
7322     NoneT> {
7323   typedef Templates29<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
7324       T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
7325       T28, T29> type;
7326 };
7327 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
7328     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
7329     GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
7330     GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
7331     GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
7332     GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
7333     GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
7334     GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
7335     GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
7336     GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30>
7337 struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
7338     T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
7339     T30, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
7340     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
7341   typedef Templates30<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
7342       T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
7343       T28, T29, T30> type;
7344 };
7345 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
7346     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
7347     GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
7348     GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
7349     GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
7350     GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
7351     GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
7352     GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
7353     GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
7354     GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
7355     GTEST_TEMPLATE_ T31>
7356 struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
7357     T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
7358     T30, T31, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
7359     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
7360   typedef Templates31<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
7361       T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
7362       T28, T29, T30, T31> type;
7363 };
7364 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
7365     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
7366     GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
7367     GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
7368     GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
7369     GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
7370     GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
7371     GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
7372     GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
7373     GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
7374     GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32>
7375 struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
7376     T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
7377     T30, T31, T32, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
7378     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
7379   typedef Templates32<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
7380       T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
7381       T28, T29, T30, T31, T32> type;
7382 };
7383 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
7384     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
7385     GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
7386     GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
7387     GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
7388     GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
7389     GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
7390     GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
7391     GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
7392     GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
7393     GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33>
7394 struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
7395     T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
7396     T30, T31, T32, T33, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
7397     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
7398   typedef Templates33<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
7399       T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
7400       T28, T29, T30, T31, T32, T33> type;
7401 };
7402 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
7403     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
7404     GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
7405     GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
7406     GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
7407     GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
7408     GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
7409     GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
7410     GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
7411     GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
7412     GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
7413     GTEST_TEMPLATE_ T34>
7414 struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
7415     T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
7416     T30, T31, T32, T33, T34, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
7417     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
7418   typedef Templates34<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
7419       T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
7420       T28, T29, T30, T31, T32, T33, T34> type;
7421 };
7422 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
7423     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
7424     GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
7425     GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
7426     GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
7427     GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
7428     GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
7429     GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
7430     GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
7431     GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
7432     GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
7433     GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35>
7434 struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
7435     T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
7436     T30, T31, T32, T33, T34, T35, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
7437     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
7438   typedef Templates35<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
7439       T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
7440       T28, T29, T30, T31, T32, T33, T34, T35> type;
7441 };
7442 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
7443     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
7444     GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
7445     GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
7446     GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
7447     GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
7448     GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
7449     GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
7450     GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
7451     GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
7452     GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
7453     GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36>
7454 struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
7455     T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
7456     T30, T31, T32, T33, T34, T35, T36, NoneT, NoneT, NoneT, NoneT, NoneT,
7457     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
7458   typedef Templates36<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
7459       T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
7460       T28, T29, T30, T31, T32, T33, T34, T35, T36> type;
7461 };
7462 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
7463     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
7464     GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
7465     GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
7466     GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
7467     GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
7468     GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
7469     GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
7470     GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
7471     GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
7472     GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
7473     GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
7474     GTEST_TEMPLATE_ T37>
7475 struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
7476     T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
7477     T30, T31, T32, T33, T34, T35, T36, T37, NoneT, NoneT, NoneT, NoneT, NoneT,
7478     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
7479   typedef Templates37<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
7480       T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
7481       T28, T29, T30, T31, T32, T33, T34, T35, T36, T37> type;
7482 };
7483 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
7484     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
7485     GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
7486     GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
7487     GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
7488     GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
7489     GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
7490     GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
7491     GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
7492     GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
7493     GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
7494     GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
7495     GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38>
7496 struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
7497     T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
7498     T30, T31, T32, T33, T34, T35, T36, T37, T38, NoneT, NoneT, NoneT, NoneT,
7499     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
7500   typedef Templates38<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
7501       T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
7502       T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38> type;
7503 };
7504 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
7505     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
7506     GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
7507     GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
7508     GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
7509     GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
7510     GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
7511     GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
7512     GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
7513     GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
7514     GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
7515     GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
7516     GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39>
7517 struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
7518     T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
7519     T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, NoneT, NoneT, NoneT,
7520     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
7521   typedef Templates39<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
7522       T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
7523       T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39> type;
7524 };
7525 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
7526     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
7527     GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
7528     GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
7529     GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
7530     GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
7531     GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
7532     GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
7533     GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
7534     GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
7535     GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
7536     GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
7537     GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,
7538     GTEST_TEMPLATE_ T40>
7539 struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
7540     T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
7541     T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, NoneT, NoneT, NoneT,
7542     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
7543   typedef Templates40<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
7544       T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
7545       T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40> type;
7546 };
7547 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
7548     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
7549     GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
7550     GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
7551     GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
7552     GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
7553     GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
7554     GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
7555     GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
7556     GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
7557     GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
7558     GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
7559     GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,
7560     GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41>
7561 struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
7562     T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
7563     T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, NoneT, NoneT,
7564     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
7565   typedef Templates41<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
7566       T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
7567       T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40,
7568       T41> type;
7569 };
7570 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
7571     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
7572     GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
7573     GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
7574     GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
7575     GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
7576     GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
7577     GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
7578     GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
7579     GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
7580     GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
7581     GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
7582     GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,
7583     GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42>
7584 struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
7585     T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
7586     T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, NoneT,
7587     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
7588   typedef Templates42<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
7589       T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
7590       T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41,
7591       T42> type;
7592 };
7593 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
7594     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
7595     GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
7596     GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
7597     GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
7598     GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
7599     GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
7600     GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
7601     GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
7602     GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
7603     GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
7604     GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
7605     GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,
7606     GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42,
7607     GTEST_TEMPLATE_ T43>
7608 struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
7609     T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
7610     T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43,
7611     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
7612   typedef Templates43<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
7613       T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
7614       T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41,
7615       T42, T43> type;
7616 };
7617 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
7618     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
7619     GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
7620     GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
7621     GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
7622     GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
7623     GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
7624     GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
7625     GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
7626     GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
7627     GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
7628     GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
7629     GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,
7630     GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42,
7631     GTEST_TEMPLATE_ T43, GTEST_TEMPLATE_ T44>
7632 struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
7633     T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
7634     T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, T44,
7635     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
7636   typedef Templates44<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
7637       T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
7638       T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41,
7639       T42, T43, T44> type;
7640 };
7641 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
7642     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
7643     GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
7644     GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
7645     GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
7646     GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
7647     GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
7648     GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
7649     GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
7650     GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
7651     GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
7652     GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
7653     GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,
7654     GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42,
7655     GTEST_TEMPLATE_ T43, GTEST_TEMPLATE_ T44, GTEST_TEMPLATE_ T45>
7656 struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
7657     T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
7658     T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, T44,
7659     T45, NoneT, NoneT, NoneT, NoneT, NoneT> {
7660   typedef Templates45<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
7661       T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
7662       T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41,
7663       T42, T43, T44, T45> type;
7664 };
7665 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
7666     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
7667     GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
7668     GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
7669     GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
7670     GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
7671     GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
7672     GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
7673     GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
7674     GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
7675     GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
7676     GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
7677     GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,
7678     GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42,
7679     GTEST_TEMPLATE_ T43, GTEST_TEMPLATE_ T44, GTEST_TEMPLATE_ T45,
7680     GTEST_TEMPLATE_ T46>
7681 struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
7682     T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
7683     T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, T44,
7684     T45, T46, NoneT, NoneT, NoneT, NoneT> {
7685   typedef Templates46<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
7686       T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
7687       T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41,
7688       T42, T43, T44, T45, T46> type;
7689 };
7690 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
7691     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
7692     GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
7693     GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
7694     GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
7695     GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
7696     GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
7697     GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
7698     GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
7699     GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
7700     GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
7701     GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
7702     GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,
7703     GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42,
7704     GTEST_TEMPLATE_ T43, GTEST_TEMPLATE_ T44, GTEST_TEMPLATE_ T45,
7705     GTEST_TEMPLATE_ T46, GTEST_TEMPLATE_ T47>
7706 struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
7707     T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
7708     T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, T44,
7709     T45, T46, T47, NoneT, NoneT, NoneT> {
7710   typedef Templates47<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
7711       T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
7712       T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41,
7713       T42, T43, T44, T45, T46, T47> type;
7714 };
7715 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
7716     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
7717     GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
7718     GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
7719     GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
7720     GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
7721     GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
7722     GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
7723     GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
7724     GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
7725     GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
7726     GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
7727     GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,
7728     GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42,
7729     GTEST_TEMPLATE_ T43, GTEST_TEMPLATE_ T44, GTEST_TEMPLATE_ T45,
7730     GTEST_TEMPLATE_ T46, GTEST_TEMPLATE_ T47, GTEST_TEMPLATE_ T48>
7731 struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
7732     T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
7733     T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, T44,
7734     T45, T46, T47, T48, NoneT, NoneT> {
7735   typedef Templates48<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
7736       T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
7737       T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41,
7738       T42, T43, T44, T45, T46, T47, T48> type;
7739 };
7740 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
7741     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
7742     GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
7743     GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
7744     GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
7745     GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
7746     GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
7747     GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
7748     GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
7749     GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
7750     GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
7751     GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
7752     GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,
7753     GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42,
7754     GTEST_TEMPLATE_ T43, GTEST_TEMPLATE_ T44, GTEST_TEMPLATE_ T45,
7755     GTEST_TEMPLATE_ T46, GTEST_TEMPLATE_ T47, GTEST_TEMPLATE_ T48,
7756     GTEST_TEMPLATE_ T49>
7757 struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
7758     T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
7759     T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, T44,
7760     T45, T46, T47, T48, T49, NoneT> {
7761   typedef Templates49<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
7762       T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
7763       T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41,
7764       T42, T43, T44, T45, T46, T47, T48, T49> type;
7765 };
7766 
7767 // The TypeList template makes it possible to use either a single type
7768 // or a Types<...> list in TYPED_TEST_CASE() and
7769 // INSTANTIATE_TYPED_TEST_CASE_P().
7770 
7771 template <typename T>
7772 struct TypeList {
7773   typedef Types1<T> type;
7774 };
7775 
7776 template <typename T1, typename T2, typename T3, typename T4, typename T5,
7777     typename T6, typename T7, typename T8, typename T9, typename T10,
7778     typename T11, typename T12, typename T13, typename T14, typename T15,
7779     typename T16, typename T17, typename T18, typename T19, typename T20,
7780     typename T21, typename T22, typename T23, typename T24, typename T25,
7781     typename T26, typename T27, typename T28, typename T29, typename T30,
7782     typename T31, typename T32, typename T33, typename T34, typename T35,
7783     typename T36, typename T37, typename T38, typename T39, typename T40,
7784     typename T41, typename T42, typename T43, typename T44, typename T45,
7785     typename T46, typename T47, typename T48, typename T49, typename T50>
7786 struct TypeList<Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
7787     T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
7788     T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43,
7789     T44, T45, T46, T47, T48, T49, T50> > {
7790   typedef typename Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
7791       T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
7792       T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40,
7793       T41, T42, T43, T44, T45, T46, T47, T48, T49, T50>::type type;
7794 };
7795 
7796 #endif  // GTEST_HAS_TYPED_TEST || GTEST_HAS_TYPED_TEST_P
7797 
7798 }  // namespace internal
7799 }  // namespace testing
7800 
7801 #endif  // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_TYPE_UTIL_H_
7802 
7803 // Due to C++ preprocessor weirdness, we need double indirection to
7804 // concatenate two tokens when one of them is __LINE__.  Writing
7805 //
7806 //   foo ## __LINE__
7807 //
7808 // will result in the token foo__LINE__, instead of foo followed by
7809 // the current line number.  For more details, see
7810 // http://www.parashift.com/c++-faq-lite/misc-technical-issues.html#faq-39.6
7811 #define GTEST_CONCAT_TOKEN_(foo, bar) GTEST_CONCAT_TOKEN_IMPL_(foo, bar)
7812 #define GTEST_CONCAT_TOKEN_IMPL_(foo, bar) foo ## bar
7813 
7814 class ProtocolMessage;
7815 namespace proto2 { class Message; }
7816 
7817 namespace testing {
7818 
7819 // Forward declarations.
7820 
7821 class AssertionResult;                 // Result of an assertion.
7822 class Message;                         // Represents a failure message.
7823 class Test;                            // Represents a test.
7824 class TestInfo;                        // Information about a test.
7825 class TestPartResult;                  // Result of a test part.
7826 class UnitTest;                        // A collection of test cases.
7827 
7828 template <typename T>
7829 ::std::string PrintToString(const T& value);
7830 
7831 namespace internal {
7832 
7833 struct TraceInfo;                      // Information about a trace point.
7834 class ScopedTrace;                     // Implements scoped trace.
7835 class TestInfoImpl;                    // Opaque implementation of TestInfo
7836 class UnitTestImpl;                    // Opaque implementation of UnitTest
7837 
7838 // The text used in failure messages to indicate the start of the
7839 // stack trace.
7840 GTEST_API_ extern const char kStackTraceMarker[];
7841 
7842 // Two overloaded helpers for checking at compile time whether an
7843 // expression is a null pointer literal (i.e. NULL or any 0-valued
7844 // compile-time integral constant).  Their return values have
7845 // different sizes, so we can use sizeof() to test which version is
7846 // picked by the compiler.  These helpers have no implementations, as
7847 // we only need their signatures.
7848 //
7849 // Given IsNullLiteralHelper(x), the compiler will pick the first
7850 // version if x can be implicitly converted to Secret*, and pick the
7851 // second version otherwise.  Since Secret is a secret and incomplete
7852 // type, the only expression a user can write that has type Secret* is
7853 // a null pointer literal.  Therefore, we know that x is a null
7854 // pointer literal if and only if the first version is picked by the
7855 // compiler.
7856 char IsNullLiteralHelper(Secret* p);
7857 char (&IsNullLiteralHelper(...))[2];  // NOLINT
7858 
7859 // A compile-time bool constant that is true if and only if x is a
7860 // null pointer literal (i.e. NULL or any 0-valued compile-time
7861 // integral constant).
7862 #ifdef GTEST_ELLIPSIS_NEEDS_POD_
7863 // We lose support for NULL detection where the compiler doesn't like
7864 // passing non-POD classes through ellipsis (...).
7865 # define GTEST_IS_NULL_LITERAL_(x) false
7866 #else
7867 # define GTEST_IS_NULL_LITERAL_(x) \
7868     (sizeof(::testing::internal::IsNullLiteralHelper(x)) == 1)
7869 #endif  // GTEST_ELLIPSIS_NEEDS_POD_
7870 
7871 // Appends the user-supplied message to the Google-Test-generated message.
7872 GTEST_API_ std::string AppendUserMessage(
7873     const std::string& gtest_msg, const Message& user_msg);
7874 
7875 #if GTEST_HAS_EXCEPTIONS
7876 
7877 // This exception is thrown by (and only by) a failed Google Test
7878 // assertion when GTEST_FLAG(throw_on_failure) is true (if exceptions
7879 // are enabled).  We derive it from std::runtime_error, which is for
7880 // errors presumably detectable only at run time.  Since
7881 // std::runtime_error inherits from std::exception, many testing
7882 // frameworks know how to extract and print the message inside it.
7883 class GTEST_API_ GoogleTestFailureException : public ::std::runtime_error {
7884  public:
7885   explicit GoogleTestFailureException(const TestPartResult& failure);
7886 };
7887 
7888 #endif  // GTEST_HAS_EXCEPTIONS
7889 
7890 // A helper class for creating scoped traces in user programs.
7891 class GTEST_API_ ScopedTrace {
7892  public:
7893   // The c'tor pushes the given source file location and message onto
7894   // a trace stack maintained by Google Test.
7895   ScopedTrace(const char* file, int line, const Message& message);
7896 
7897   // The d'tor pops the info pushed by the c'tor.
7898   //
7899   // Note that the d'tor is not virtual in order to be efficient.
7900   // Don't inherit from ScopedTrace!
7901   ~ScopedTrace();
7902 
7903  private:
7904   GTEST_DISALLOW_COPY_AND_ASSIGN_(ScopedTrace);
7905 } GTEST_ATTRIBUTE_UNUSED_;  // A ScopedTrace object does its job in its
7906                             // c'tor and d'tor.  Therefore it doesn't
7907                             // need to be used otherwise.
7908 
7909 namespace edit_distance {
7910 // Returns the optimal edits to go from 'left' to 'right'.
7911 // All edits cost the same, with replace having lower priority than
7912 // add/remove.
7913 // Simple implementation of the Wagner–Fischer algorithm.
7914 // See http://en.wikipedia.org/wiki/Wagner-Fischer_algorithm
7915 enum EditType { kMatch, kAdd, kRemove, kReplace };
7916 GTEST_API_ std::vector<EditType> CalculateOptimalEdits(
7917     const std::vector<size_t>& left, const std::vector<size_t>& right);
7918 
7919 // Same as above, but the input is represented as strings.
7920 GTEST_API_ std::vector<EditType> CalculateOptimalEdits(
7921     const std::vector<std::string>& left,
7922     const std::vector<std::string>& right);
7923 
7924 // Create a diff of the input strings in Unified diff format.
7925 GTEST_API_ std::string CreateUnifiedDiff(const std::vector<std::string>& left,
7926                                          const std::vector<std::string>& right,
7927                                          size_t context = 2);
7928 
7929 }  // namespace edit_distance
7930 
7931 // Calculate the diff between 'left' and 'right' and return it in unified diff
7932 // format.
7933 // If not null, stores in 'total_line_count' the total number of lines found
7934 // in left + right.
7935 GTEST_API_ std::string DiffStrings(const std::string& left,
7936                                    const std::string& right,
7937                                    size_t* total_line_count);
7938 
7939 // Constructs and returns the message for an equality assertion
7940 // (e.g. ASSERT_EQ, EXPECT_STREQ, etc) failure.
7941 //
7942 // The first four parameters are the expressions used in the assertion
7943 // and their values, as strings.  For example, for ASSERT_EQ(foo, bar)
7944 // where foo is 5 and bar is 6, we have:
7945 //
7946 //   expected_expression: "foo"
7947 //   actual_expression:   "bar"
7948 //   expected_value:      "5"
7949 //   actual_value:        "6"
7950 //
7951 // The ignoring_case parameter is true iff the assertion is a
7952 // *_STRCASEEQ*.  When it's true, the string " (ignoring case)" will
7953 // be inserted into the message.
7954 GTEST_API_ AssertionResult EqFailure(const char* expected_expression,
7955                                      const char* actual_expression,
7956                                      const std::string& expected_value,
7957                                      const std::string& actual_value,
7958                                      bool ignoring_case);
7959 
7960 // Constructs a failure message for Boolean assertions such as EXPECT_TRUE.
7961 GTEST_API_ std::string GetBoolAssertionFailureMessage(
7962     const AssertionResult& assertion_result,
7963     const char* expression_text,
7964     const char* actual_predicate_value,
7965     const char* expected_predicate_value);
7966 
7967 // This template class represents an IEEE floating-point number
7968 // (either single-precision or double-precision, depending on the
7969 // template parameters).
7970 //
7971 // The purpose of this class is to do more sophisticated number
7972 // comparison.  (Due to round-off error, etc, it's very unlikely that
7973 // two floating-points will be equal exactly.  Hence a naive
7974 // comparison by the == operation often doesn't work.)
7975 //
7976 // Format of IEEE floating-point:
7977 //
7978 //   The most-significant bit being the leftmost, an IEEE
7979 //   floating-point looks like
7980 //
7981 //     sign_bit exponent_bits fraction_bits
7982 //
7983 //   Here, sign_bit is a single bit that designates the sign of the
7984 //   number.
7985 //
7986 //   For float, there are 8 exponent bits and 23 fraction bits.
7987 //
7988 //   For double, there are 11 exponent bits and 52 fraction bits.
7989 //
7990 //   More details can be found at
7991 //   http://en.wikipedia.org/wiki/IEEE_floating-point_standard.
7992 //
7993 // Template parameter:
7994 //
7995 //   RawType: the raw floating-point type (either float or double)
7996 template <typename RawType>
7997 class FloatingPoint {
7998  public:
7999   // Defines the unsigned integer type that has the same size as the
8000   // floating point number.
8001   typedef typename TypeWithSize<sizeof(RawType)>::UInt Bits;
8002 
8003   // Constants.
8004 
8005   // # of bits in a number.
8006   static const size_t kBitCount = 8*sizeof(RawType);
8007 
8008   // # of fraction bits in a number.
8009   static const size_t kFractionBitCount =
8010     std::numeric_limits<RawType>::digits - 1;
8011 
8012   // # of exponent bits in a number.
8013   static const size_t kExponentBitCount = kBitCount - 1 - kFractionBitCount;
8014 
8015   // The mask for the sign bit.
8016   static const Bits kSignBitMask = static_cast<Bits>(1) << (kBitCount - 1);
8017 
8018   // The mask for the fraction bits.
8019   static const Bits kFractionBitMask =
8020     ~static_cast<Bits>(0) >> (kExponentBitCount + 1);
8021 
8022   // The mask for the exponent bits.
8023   static const Bits kExponentBitMask = ~(kSignBitMask | kFractionBitMask);
8024 
8025   // How many ULP's (Units in the Last Place) we want to tolerate when
8026   // comparing two numbers.  The larger the value, the more error we
8027   // allow.  A 0 value means that two numbers must be exactly the same
8028   // to be considered equal.
8029   //
8030   // The maximum error of a single floating-point operation is 0.5
8031   // units in the last place.  On Intel CPU's, all floating-point
8032   // calculations are done with 80-bit precision, while double has 64
8033   // bits.  Therefore, 4 should be enough for ordinary use.
8034   //
8035   // See the following article for more details on ULP:
8036   // http://randomascii.wordpress.com/2012/02/25/comparing-floating-point-numbers-2012-edition/
8037   static const size_t kMaxUlps = 4;
8038 
8039   // Constructs a FloatingPoint from a raw floating-point number.
8040   //
8041   // On an Intel CPU, passing a non-normalized NAN (Not a Number)
8042   // around may change its bits, although the new value is guaranteed
8043   // to be also a NAN.  Therefore, don't expect this constructor to
8044   // preserve the bits in x when x is a NAN.
8045   explicit FloatingPoint(const RawType& x) { u_.value_ = x; }
8046 
8047   // Static methods
8048 
8049   // Reinterprets a bit pattern as a floating-point number.
8050   //
8051   // This function is needed to test the AlmostEquals() method.
8052   static RawType ReinterpretBits(const Bits bits) {
8053     FloatingPoint fp(0);
8054     fp.u_.bits_ = bits;
8055     return fp.u_.value_;
8056   }
8057 
8058   // Returns the floating-point number that represent positive infinity.
8059   static RawType Infinity() {
8060     return ReinterpretBits(kExponentBitMask);
8061   }
8062 
8063   // Returns the maximum representable finite floating-point number.
8064   static RawType Max();
8065 
8066   // Non-static methods
8067 
8068   // Returns the bits that represents this number.
8069   const Bits &bits() const { return u_.bits_; }
8070 
8071   // Returns the exponent bits of this number.
8072   Bits exponent_bits() const { return kExponentBitMask & u_.bits_; }
8073 
8074   // Returns the fraction bits of this number.
8075   Bits fraction_bits() const { return kFractionBitMask & u_.bits_; }
8076 
8077   // Returns the sign bit of this number.
8078   Bits sign_bit() const { return kSignBitMask & u_.bits_; }
8079 
8080   // Returns true iff this is NAN (not a number).
8081   bool is_nan() const {
8082     // It's a NAN if the exponent bits are all ones and the fraction
8083     // bits are not entirely zeros.
8084     return (exponent_bits() == kExponentBitMask) && (fraction_bits() != 0);
8085   }
8086 
8087   // Returns true iff this number is at most kMaxUlps ULP's away from
8088   // rhs.  In particular, this function:
8089   //
8090   //   - returns false if either number is (or both are) NAN.
8091   //   - treats really large numbers as almost equal to infinity.
8092   //   - thinks +0.0 and -0.0 are 0 DLP's apart.
8093   bool AlmostEquals(const FloatingPoint& rhs) const {
8094     // The IEEE standard says that any comparison operation involving
8095     // a NAN must return false.
8096     if (is_nan() || rhs.is_nan()) return false;
8097 
8098     return DistanceBetweenSignAndMagnitudeNumbers(u_.bits_, rhs.u_.bits_)
8099         <= kMaxUlps;
8100   }
8101 
8102  private:
8103   // The data type used to store the actual floating-point number.
8104   union FloatingPointUnion {
8105     RawType value_;  // The raw floating-point number.
8106     Bits bits_;      // The bits that represent the number.
8107   };
8108 
8109   // Converts an integer from the sign-and-magnitude representation to
8110   // the biased representation.  More precisely, let N be 2 to the
8111   // power of (kBitCount - 1), an integer x is represented by the
8112   // unsigned number x + N.
8113   //
8114   // For instance,
8115   //
8116   //   -N + 1 (the most negative number representable using
8117   //          sign-and-magnitude) is represented by 1;
8118   //   0      is represented by N; and
8119   //   N - 1  (the biggest number representable using
8120   //          sign-and-magnitude) is represented by 2N - 1.
8121   //
8122   // Read http://en.wikipedia.org/wiki/Signed_number_representations
8123   // for more details on signed number representations.
8124   static Bits SignAndMagnitudeToBiased(const Bits &sam) {
8125     if (kSignBitMask & sam) {
8126       // sam represents a negative number.
8127       return ~sam + 1;
8128     } else {
8129       // sam represents a positive number.
8130       return kSignBitMask | sam;
8131     }
8132   }
8133 
8134   // Given two numbers in the sign-and-magnitude representation,
8135   // returns the distance between them as an unsigned number.
8136   static Bits DistanceBetweenSignAndMagnitudeNumbers(const Bits &sam1,
8137                                                      const Bits &sam2) {
8138     const Bits biased1 = SignAndMagnitudeToBiased(sam1);
8139     const Bits biased2 = SignAndMagnitudeToBiased(sam2);
8140     return (biased1 >= biased2) ? (biased1 - biased2) : (biased2 - biased1);
8141   }
8142 
8143   FloatingPointUnion u_;
8144 };
8145 
8146 // We cannot use std::numeric_limits<T>::max() as it clashes with the max()
8147 // macro defined by <windows.h>.
8148 template <>
8149 inline float FloatingPoint<float>::Max() { return FLT_MAX; }
8150 template <>
8151 inline double FloatingPoint<double>::Max() { return DBL_MAX; }
8152 
8153 // Typedefs the instances of the FloatingPoint template class that we
8154 // care to use.
8155 typedef FloatingPoint<float> Float;
8156 typedef FloatingPoint<double> Double;
8157 
8158 // In order to catch the mistake of putting tests that use different
8159 // test fixture classes in the same test case, we need to assign
8160 // unique IDs to fixture classes and compare them.  The TypeId type is
8161 // used to hold such IDs.  The user should treat TypeId as an opaque
8162 // type: the only operation allowed on TypeId values is to compare
8163 // them for equality using the == operator.
8164 typedef const void* TypeId;
8165 
8166 template <typename T>
8167 class TypeIdHelper {
8168  public:
8169   // dummy_ must not have a const type.  Otherwise an overly eager
8170   // compiler (e.g. MSVC 7.1 & 8.0) may try to merge
8171   // TypeIdHelper<T>::dummy_ for different Ts as an "optimization".
8172   static bool dummy_;
8173 };
8174 
8175 template <typename T>
8176 bool TypeIdHelper<T>::dummy_ = false;
8177 
8178 // GetTypeId<T>() returns the ID of type T.  Different values will be
8179 // returned for different types.  Calling the function twice with the
8180 // same type argument is guaranteed to return the same ID.
8181 template <typename T>
8182 TypeId GetTypeId() {
8183   // The compiler is required to allocate a different
8184   // TypeIdHelper<T>::dummy_ variable for each T used to instantiate
8185   // the template.  Therefore, the address of dummy_ is guaranteed to
8186   // be unique.
8187   return &(TypeIdHelper<T>::dummy_);
8188 }
8189 
8190 // Returns the type ID of ::testing::Test.  Always call this instead
8191 // of GetTypeId< ::testing::Test>() to get the type ID of
8192 // ::testing::Test, as the latter may give the wrong result due to a
8193 // suspected linker bug when compiling Google Test as a Mac OS X
8194 // framework.
8195 GTEST_API_ TypeId GetTestTypeId();
8196 
8197 // Defines the abstract factory interface that creates instances
8198 // of a Test object.
8199 class TestFactoryBase {
8200  public:
8201   virtual ~TestFactoryBase() {}
8202 
8203   // Creates a test instance to run. The instance is both created and destroyed
8204   // within TestInfoImpl::Run()
8205   virtual Test* CreateTest() = 0;
8206 
8207  protected:
8208   TestFactoryBase() {}
8209 
8210  private:
8211   GTEST_DISALLOW_COPY_AND_ASSIGN_(TestFactoryBase);
8212 };
8213 
8214 // This class provides implementation of TeastFactoryBase interface.
8215 // It is used in TEST and TEST_F macros.
8216 template <class TestClass>
8217 class TestFactoryImpl : public TestFactoryBase {
8218  public:
8219   virtual Test* CreateTest() { return new TestClass; }
8220 };
8221 
8222 #if GTEST_OS_WINDOWS
8223 
8224 // Predicate-formatters for implementing the HRESULT checking macros
8225 // {ASSERT|EXPECT}_HRESULT_{SUCCEEDED|FAILED}
8226 // We pass a long instead of HRESULT to avoid causing an
8227 // include dependency for the HRESULT type.
8228 GTEST_API_ AssertionResult IsHRESULTSuccess(const char* expr,
8229                                             long hr);  // NOLINT
8230 GTEST_API_ AssertionResult IsHRESULTFailure(const char* expr,
8231                                             long hr);  // NOLINT
8232 
8233 #endif  // GTEST_OS_WINDOWS
8234 
8235 // Types of SetUpTestCase() and TearDownTestCase() functions.
8236 typedef void (*SetUpTestCaseFunc)();
8237 typedef void (*TearDownTestCaseFunc)();
8238 
8239 struct CodeLocation {
8240   CodeLocation(const string& a_file, int a_line) : file(a_file), line(a_line) {}
8241 
8242   string file;
8243   int line;
8244 };
8245 
8246 // Creates a new TestInfo object and registers it with Google Test;
8247 // returns the created object.
8248 //
8249 // Arguments:
8250 //
8251 //   test_case_name:   name of the test case
8252 //   name:             name of the test
8253 //   type_param        the name of the test's type parameter, or NULL if
8254 //                     this is not a typed or a type-parameterized test.
8255 //   value_param       text representation of the test's value parameter,
8256 //                     or NULL if this is not a type-parameterized test.
8257 //   code_location:    code location where the test is defined
8258 //   fixture_class_id: ID of the test fixture class
8259 //   set_up_tc:        pointer to the function that sets up the test case
8260 //   tear_down_tc:     pointer to the function that tears down the test case
8261 //   factory:          pointer to the factory that creates a test object.
8262 //                     The newly created TestInfo instance will assume
8263 //                     ownership of the factory object.
8264 GTEST_API_ TestInfo* MakeAndRegisterTestInfo(
8265     const char* test_case_name,
8266     const char* name,
8267     const char* type_param,
8268     const char* value_param,
8269     CodeLocation code_location,
8270     TypeId fixture_class_id,
8271     SetUpTestCaseFunc set_up_tc,
8272     TearDownTestCaseFunc tear_down_tc,
8273     TestFactoryBase* factory);
8274 
8275 // If *pstr starts with the given prefix, modifies *pstr to be right
8276 // past the prefix and returns true; otherwise leaves *pstr unchanged
8277 // and returns false.  None of pstr, *pstr, and prefix can be NULL.
8278 GTEST_API_ bool SkipPrefix(const char* prefix, const char** pstr);
8279 
8280 #if GTEST_HAS_TYPED_TEST || GTEST_HAS_TYPED_TEST_P
8281 
8282 // State of the definition of a type-parameterized test case.
8283 class GTEST_API_ TypedTestCasePState {
8284  public:
8285   TypedTestCasePState() : registered_(false) {}
8286 
8287   // Adds the given test name to defined_test_names_ and return true
8288   // if the test case hasn't been registered; otherwise aborts the
8289   // program.
8290   bool AddTestName(const char* file, int line, const char* case_name,
8291                    const char* test_name) {
8292     if (registered_) {
8293       fprintf(stderr, "%s Test %s must be defined before "
8294               "REGISTER_TYPED_TEST_CASE_P(%s, ...).\n",
8295               FormatFileLocation(file, line).c_str(), test_name, case_name);
8296       fflush(stderr);
8297       posix::Abort();
8298     }
8299     registered_tests_.insert(
8300         ::std::make_pair(test_name, CodeLocation(file, line)));
8301     return true;
8302   }
8303 
8304   bool TestExists(const std::string& test_name) const {
8305     return registered_tests_.count(test_name) > 0;
8306   }
8307 
8308   const CodeLocation& GetCodeLocation(const std::string& test_name) const {
8309     RegisteredTestsMap::const_iterator it = registered_tests_.find(test_name);
8310     GTEST_CHECK_(it != registered_tests_.end());
8311     return it->second;
8312   }
8313 
8314   // Verifies that registered_tests match the test names in
8315   // defined_test_names_; returns registered_tests if successful, or
8316   // aborts the program otherwise.
8317   const char* VerifyRegisteredTestNames(
8318       const char* file, int line, const char* registered_tests);
8319 
8320  private:
8321   typedef ::std::map<std::string, CodeLocation> RegisteredTestsMap;
8322 
8323   bool registered_;
8324   RegisteredTestsMap registered_tests_;
8325 };
8326 
8327 // Skips to the first non-space char after the first comma in 'str';
8328 // returns NULL if no comma is found in 'str'.
8329 inline const char* SkipComma(const char* str) {
8330   const char* comma = strchr(str, ',');
8331   if (comma == NULL) {
8332     return NULL;
8333   }
8334   while (IsSpace(*(++comma))) {}
8335   return comma;
8336 }
8337 
8338 // Returns the prefix of 'str' before the first comma in it; returns
8339 // the entire string if it contains no comma.
8340 inline std::string GetPrefixUntilComma(const char* str) {
8341   const char* comma = strchr(str, ',');
8342   return comma == NULL ? str : std::string(str, comma);
8343 }
8344 
8345 // Splits a given string on a given delimiter, populating a given
8346 // vector with the fields.
8347 void SplitString(const ::std::string& str, char delimiter,
8348                  ::std::vector< ::std::string>* dest);
8349 
8350 // TypeParameterizedTest<Fixture, TestSel, Types>::Register()
8351 // registers a list of type-parameterized tests with Google Test.  The
8352 // return value is insignificant - we just need to return something
8353 // such that we can call this function in a namespace scope.
8354 //
8355 // Implementation note: The GTEST_TEMPLATE_ macro declares a template
8356 // template parameter.  It's defined in gtest-type-util.h.
8357 template <GTEST_TEMPLATE_ Fixture, class TestSel, typename Types>
8358 class TypeParameterizedTest {
8359  public:
8360   // 'index' is the index of the test in the type list 'Types'
8361   // specified in INSTANTIATE_TYPED_TEST_CASE_P(Prefix, TestCase,
8362   // Types).  Valid values for 'index' are [0, N - 1] where N is the
8363   // length of Types.
8364   static bool Register(const char* prefix,
8365                        CodeLocation code_location,
8366                        const char* case_name, const char* test_names,
8367                        int index) {
8368     typedef typename Types::Head Type;
8369     typedef Fixture<Type> FixtureClass;
8370     typedef typename GTEST_BIND_(TestSel, Type) TestClass;
8371 
8372     // First, registers the first type-parameterized test in the type
8373     // list.
8374     MakeAndRegisterTestInfo(
8375         (std::string(prefix) + (prefix[0] == '\0' ? "" : "/") + case_name + "/"
8376          + StreamableToString(index)).c_str(),
8377         StripTrailingSpaces(GetPrefixUntilComma(test_names)).c_str(),
8378         GetTypeName<Type>().c_str(),
8379         NULL,  // No value parameter.
8380         code_location,
8381         GetTypeId<FixtureClass>(),
8382         TestClass::SetUpTestCase,
8383         TestClass::TearDownTestCase,
8384         new TestFactoryImpl<TestClass>);
8385 
8386     // Next, recurses (at compile time) with the tail of the type list.
8387     return TypeParameterizedTest<Fixture, TestSel, typename Types::Tail>
8388         ::Register(prefix, code_location, case_name, test_names, index + 1);
8389   }
8390 };
8391 
8392 // The base case for the compile time recursion.
8393 template <GTEST_TEMPLATE_ Fixture, class TestSel>
8394 class TypeParameterizedTest<Fixture, TestSel, Types0> {
8395  public:
8396   static bool Register(const char* /*prefix*/, CodeLocation,
8397                        const char* /*case_name*/, const char* /*test_names*/,
8398                        int /*index*/) {
8399     return true;
8400   }
8401 };
8402 
8403 // TypeParameterizedTestCase<Fixture, Tests, Types>::Register()
8404 // registers *all combinations* of 'Tests' and 'Types' with Google
8405 // Test.  The return value is insignificant - we just need to return
8406 // something such that we can call this function in a namespace scope.
8407 template <GTEST_TEMPLATE_ Fixture, typename Tests, typename Types>
8408 class TypeParameterizedTestCase {
8409  public:
8410   static bool Register(const char* prefix, CodeLocation code_location,
8411                        const TypedTestCasePState* state,
8412                        const char* case_name, const char* test_names) {
8413     std::string test_name = StripTrailingSpaces(
8414         GetPrefixUntilComma(test_names));
8415     if (!state->TestExists(test_name)) {
8416       fprintf(stderr, "Failed to get code location for test %s.%s at %s.",
8417               case_name, test_name.c_str(),
8418               FormatFileLocation(code_location.file.c_str(),
8419                                  code_location.line).c_str());
8420       fflush(stderr);
8421       posix::Abort();
8422     }
8423     const CodeLocation& test_location = state->GetCodeLocation(test_name);
8424 
8425     typedef typename Tests::Head Head;
8426 
8427     // First, register the first test in 'Test' for each type in 'Types'.
8428     TypeParameterizedTest<Fixture, Head, Types>::Register(
8429         prefix, test_location, case_name, test_names, 0);
8430 
8431     // Next, recurses (at compile time) with the tail of the test list.
8432     return TypeParameterizedTestCase<Fixture, typename Tests::Tail, Types>
8433         ::Register(prefix, code_location, state,
8434                    case_name, SkipComma(test_names));
8435   }
8436 };
8437 
8438 // The base case for the compile time recursion.
8439 template <GTEST_TEMPLATE_ Fixture, typename Types>
8440 class TypeParameterizedTestCase<Fixture, Templates0, Types> {
8441  public:
8442   static bool Register(const char* /*prefix*/, CodeLocation,
8443                        const TypedTestCasePState* /*state*/,
8444                        const char* /*case_name*/, const char* /*test_names*/) {
8445     return true;
8446   }
8447 };
8448 
8449 #endif  // GTEST_HAS_TYPED_TEST || GTEST_HAS_TYPED_TEST_P
8450 
8451 // Returns the current OS stack trace as an std::string.
8452 //
8453 // The maximum number of stack frames to be included is specified by
8454 // the gtest_stack_trace_depth flag.  The skip_count parameter
8455 // specifies the number of top frames to be skipped, which doesn't
8456 // count against the number of frames to be included.
8457 //
8458 // For example, if Foo() calls Bar(), which in turn calls
8459 // GetCurrentOsStackTraceExceptTop(..., 1), Foo() will be included in
8460 // the trace but Bar() and GetCurrentOsStackTraceExceptTop() won't.
8461 GTEST_API_ std::string GetCurrentOsStackTraceExceptTop(
8462     UnitTest* unit_test, int skip_count);
8463 
8464 // Helpers for suppressing warnings on unreachable code or constant
8465 // condition.
8466 
8467 // Always returns true.
8468 GTEST_API_ bool AlwaysTrue();
8469 
8470 // Always returns false.
8471 inline bool AlwaysFalse() { return !AlwaysTrue(); }
8472 
8473 // Helper for suppressing false warning from Clang on a const char*
8474 // variable declared in a conditional expression always being NULL in
8475 // the else branch.
8476 struct GTEST_API_ ConstCharPtr {
8477   ConstCharPtr(const char* str) : value(str) {}
8478   operator bool() const { return true; }
8479   const char* value;
8480 };
8481 
8482 // A simple Linear Congruential Generator for generating random
8483 // numbers with a uniform distribution.  Unlike rand() and srand(), it
8484 // doesn't use global state (and therefore can't interfere with user
8485 // code).  Unlike rand_r(), it's portable.  An LCG isn't very random,
8486 // but it's good enough for our purposes.
8487 class GTEST_API_ Random {
8488  public:
8489   static const UInt32 kMaxRange = 1u << 31;
8490 
8491   explicit Random(UInt32 seed) : state_(seed) {}
8492 
8493   void Reseed(UInt32 seed) { state_ = seed; }
8494 
8495   // Generates a random number from [0, range).  Crashes if 'range' is
8496   // 0 or greater than kMaxRange.
8497   UInt32 Generate(UInt32 range);
8498 
8499  private:
8500   UInt32 state_;
8501   GTEST_DISALLOW_COPY_AND_ASSIGN_(Random);
8502 };
8503 
8504 // Defining a variable of type CompileAssertTypesEqual<T1, T2> will cause a
8505 // compiler error iff T1 and T2 are different types.
8506 template <typename T1, typename T2>
8507 struct CompileAssertTypesEqual;
8508 
8509 template <typename T>
8510 struct CompileAssertTypesEqual<T, T> {
8511 };
8512 
8513 // Removes the reference from a type if it is a reference type,
8514 // otherwise leaves it unchanged.  This is the same as
8515 // tr1::remove_reference, which is not widely available yet.
8516 template <typename T>
8517 struct RemoveReference { typedef T type; };  // NOLINT
8518 template <typename T>
8519 struct RemoveReference<T&> { typedef T type; };  // NOLINT
8520 
8521 // A handy wrapper around RemoveReference that works when the argument
8522 // T depends on template parameters.
8523 #define GTEST_REMOVE_REFERENCE_(T) \
8524     typename ::testing::internal::RemoveReference<T>::type
8525 
8526 // Removes const from a type if it is a const type, otherwise leaves
8527 // it unchanged.  This is the same as tr1::remove_const, which is not
8528 // widely available yet.
8529 template <typename T>
8530 struct RemoveConst { typedef T type; };  // NOLINT
8531 template <typename T>
8532 struct RemoveConst<const T> { typedef T type; };  // NOLINT
8533 
8534 // MSVC 8.0, Sun C++, and IBM XL C++ have a bug which causes the above
8535 // definition to fail to remove the const in 'const int[3]' and 'const
8536 // char[3][4]'.  The following specialization works around the bug.
8537 template <typename T, size_t N>
8538 struct RemoveConst<const T[N]> {
8539   typedef typename RemoveConst<T>::type type[N];
8540 };
8541 
8542 #if defined(_MSC_VER) && _MSC_VER < 1400
8543 // This is the only specialization that allows VC++ 7.1 to remove const in
8544 // 'const int[3] and 'const int[3][4]'.  However, it causes trouble with GCC
8545 // and thus needs to be conditionally compiled.
8546 template <typename T, size_t N>
8547 struct RemoveConst<T[N]> {
8548   typedef typename RemoveConst<T>::type type[N];
8549 };
8550 #endif
8551 
8552 // A handy wrapper around RemoveConst that works when the argument
8553 // T depends on template parameters.
8554 #define GTEST_REMOVE_CONST_(T) \
8555     typename ::testing::internal::RemoveConst<T>::type
8556 
8557 // Turns const U&, U&, const U, and U all into U.
8558 #define GTEST_REMOVE_REFERENCE_AND_CONST_(T) \
8559     GTEST_REMOVE_CONST_(GTEST_REMOVE_REFERENCE_(T))
8560 
8561 // Adds reference to a type if it is not a reference type,
8562 // otherwise leaves it unchanged.  This is the same as
8563 // tr1::add_reference, which is not widely available yet.
8564 template <typename T>
8565 struct AddReference { typedef T& type; };  // NOLINT
8566 template <typename T>
8567 struct AddReference<T&> { typedef T& type; };  // NOLINT
8568 
8569 // A handy wrapper around AddReference that works when the argument T
8570 // depends on template parameters.
8571 #define GTEST_ADD_REFERENCE_(T) \
8572     typename ::testing::internal::AddReference<T>::type
8573 
8574 // Adds a reference to const on top of T as necessary.  For example,
8575 // it transforms
8576 //
8577 //   char         ==> const char&
8578 //   const char   ==> const char&
8579 //   char&        ==> const char&
8580 //   const char&  ==> const char&
8581 //
8582 // The argument T must depend on some template parameters.
8583 #define GTEST_REFERENCE_TO_CONST_(T) \
8584     GTEST_ADD_REFERENCE_(const GTEST_REMOVE_REFERENCE_(T))
8585 
8586 // ImplicitlyConvertible<From, To>::value is a compile-time bool
8587 // constant that's true iff type From can be implicitly converted to
8588 // type To.
8589 template <typename From, typename To>
8590 class ImplicitlyConvertible {
8591  private:
8592   // We need the following helper functions only for their types.
8593   // They have no implementations.
8594 
8595   // MakeFrom() is an expression whose type is From.  We cannot simply
8596   // use From(), as the type From may not have a public default
8597   // constructor.
8598   static typename AddReference<From>::type MakeFrom();
8599 
8600   // These two functions are overloaded.  Given an expression
8601   // Helper(x), the compiler will pick the first version if x can be
8602   // implicitly converted to type To; otherwise it will pick the
8603   // second version.
8604   //
8605   // The first version returns a value of size 1, and the second
8606   // version returns a value of size 2.  Therefore, by checking the
8607   // size of Helper(x), which can be done at compile time, we can tell
8608   // which version of Helper() is used, and hence whether x can be
8609   // implicitly converted to type To.
8610   static char Helper(To);
8611   static char (&Helper(...))[2];  // NOLINT
8612 
8613   // We have to put the 'public' section after the 'private' section,
8614   // or MSVC refuses to compile the code.
8615  public:
8616 #if defined(__BORLANDC__)
8617   // C++Builder cannot use member overload resolution during template
8618   // instantiation.  The simplest workaround is to use its C++0x type traits
8619   // functions (C++Builder 2009 and above only).
8620   static const bool value = __is_convertible(From, To);
8621 #else
8622   // MSVC warns about implicitly converting from double to int for
8623   // possible loss of data, so we need to temporarily disable the
8624   // warning.
8625   GTEST_DISABLE_MSC_WARNINGS_PUSH_(4244)
8626   static const bool value =
8627       sizeof(Helper(ImplicitlyConvertible::MakeFrom())) == 1;
8628   GTEST_DISABLE_MSC_WARNINGS_POP_()
8629 #endif  // __BORLANDC__
8630 };
8631 template <typename From, typename To>
8632 const bool ImplicitlyConvertible<From, To>::value;
8633 
8634 // IsAProtocolMessage<T>::value is a compile-time bool constant that's
8635 // true iff T is type ProtocolMessage, proto2::Message, or a subclass
8636 // of those.
8637 template <typename T>
8638 struct IsAProtocolMessage
8639     : public bool_constant<
8640   ImplicitlyConvertible<const T*, const ::ProtocolMessage*>::value ||
8641   ImplicitlyConvertible<const T*, const ::proto2::Message*>::value> {
8642 };
8643 
8644 // When the compiler sees expression IsContainerTest<C>(0), if C is an
8645 // STL-style container class, the first overload of IsContainerTest
8646 // will be viable (since both C::iterator* and C::const_iterator* are
8647 // valid types and NULL can be implicitly converted to them).  It will
8648 // be picked over the second overload as 'int' is a perfect match for
8649 // the type of argument 0.  If C::iterator or C::const_iterator is not
8650 // a valid type, the first overload is not viable, and the second
8651 // overload will be picked.  Therefore, we can determine whether C is
8652 // a container class by checking the type of IsContainerTest<C>(0).
8653 // The value of the expression is insignificant.
8654 //
8655 // Note that we look for both C::iterator and C::const_iterator.  The
8656 // reason is that C++ injects the name of a class as a member of the
8657 // class itself (e.g. you can refer to class iterator as either
8658 // 'iterator' or 'iterator::iterator').  If we look for C::iterator
8659 // only, for example, we would mistakenly think that a class named
8660 // iterator is an STL container.
8661 //
8662 // Also note that the simpler approach of overloading
8663 // IsContainerTest(typename C::const_iterator*) and
8664 // IsContainerTest(...) doesn't work with Visual Age C++ and Sun C++.
8665 typedef int IsContainer;
8666 template <class C>
8667 IsContainer IsContainerTest(int /* dummy */,
8668                             typename C::iterator* /* it */ = NULL,
8669                             typename C::const_iterator* /* const_it */ = NULL) {
8670   return 0;
8671 }
8672 
8673 typedef char IsNotContainer;
8674 template <class C>
8675 IsNotContainer IsContainerTest(long /* dummy */) { return '\0'; }
8676 
8677 // EnableIf<condition>::type is void when 'Cond' is true, and
8678 // undefined when 'Cond' is false.  To use SFINAE to make a function
8679 // overload only apply when a particular expression is true, add
8680 // "typename EnableIf<expression>::type* = 0" as the last parameter.
8681 template<bool> struct EnableIf;
8682 template<> struct EnableIf<true> { typedef void type; };  // NOLINT
8683 
8684 // Utilities for native arrays.
8685 
8686 // ArrayEq() compares two k-dimensional native arrays using the
8687 // elements' operator==, where k can be any integer >= 0.  When k is
8688 // 0, ArrayEq() degenerates into comparing a single pair of values.
8689 
8690 template <typename T, typename U>
8691 bool ArrayEq(const T* lhs, size_t size, const U* rhs);
8692 
8693 // This generic version is used when k is 0.
8694 template <typename T, typename U>
8695 inline bool ArrayEq(const T& lhs, const U& rhs) { return lhs == rhs; }
8696 
8697 // This overload is used when k >= 1.
8698 template <typename T, typename U, size_t N>
8699 inline bool ArrayEq(const T(&lhs)[N], const U(&rhs)[N]) {
8700   return internal::ArrayEq(lhs, N, rhs);
8701 }
8702 
8703 // This helper reduces code bloat.  If we instead put its logic inside
8704 // the previous ArrayEq() function, arrays with different sizes would
8705 // lead to different copies of the template code.
8706 template <typename T, typename U>
8707 bool ArrayEq(const T* lhs, size_t size, const U* rhs) {
8708   for (size_t i = 0; i != size; i++) {
8709     if (!internal::ArrayEq(lhs[i], rhs[i]))
8710       return false;
8711   }
8712   return true;
8713 }
8714 
8715 // Finds the first element in the iterator range [begin, end) that
8716 // equals elem.  Element may be a native array type itself.
8717 template <typename Iter, typename Element>
8718 Iter ArrayAwareFind(Iter begin, Iter end, const Element& elem) {
8719   for (Iter it = begin; it != end; ++it) {
8720     if (internal::ArrayEq(*it, elem))
8721       return it;
8722   }
8723   return end;
8724 }
8725 
8726 // CopyArray() copies a k-dimensional native array using the elements'
8727 // operator=, where k can be any integer >= 0.  When k is 0,
8728 // CopyArray() degenerates into copying a single value.
8729 
8730 template <typename T, typename U>
8731 void CopyArray(const T* from, size_t size, U* to);
8732 
8733 // This generic version is used when k is 0.
8734 template <typename T, typename U>
8735 inline void CopyArray(const T& from, U* to) { *to = from; }
8736 
8737 // This overload is used when k >= 1.
8738 template <typename T, typename U, size_t N>
8739 inline void CopyArray(const T(&from)[N], U(*to)[N]) {
8740   internal::CopyArray(from, N, *to);
8741 }
8742 
8743 // This helper reduces code bloat.  If we instead put its logic inside
8744 // the previous CopyArray() function, arrays with different sizes
8745 // would lead to different copies of the template code.
8746 template <typename T, typename U>
8747 void CopyArray(const T* from, size_t size, U* to) {
8748   for (size_t i = 0; i != size; i++) {
8749     internal::CopyArray(from[i], to + i);
8750   }
8751 }
8752 
8753 // The relation between an NativeArray object (see below) and the
8754 // native array it represents.
8755 // We use 2 different structs to allow non-copyable types to be used, as long
8756 // as RelationToSourceReference() is passed.
8757 struct RelationToSourceReference {};
8758 struct RelationToSourceCopy {};
8759 
8760 // Adapts a native array to a read-only STL-style container.  Instead
8761 // of the complete STL container concept, this adaptor only implements
8762 // members useful for Google Mock's container matchers.  New members
8763 // should be added as needed.  To simplify the implementation, we only
8764 // support Element being a raw type (i.e. having no top-level const or
8765 // reference modifier).  It's the client's responsibility to satisfy
8766 // this requirement.  Element can be an array type itself (hence
8767 // multi-dimensional arrays are supported).
8768 template <typename Element>
8769 class NativeArray {
8770  public:
8771   // STL-style container typedefs.
8772   typedef Element value_type;
8773   typedef Element* iterator;
8774   typedef const Element* const_iterator;
8775 
8776   // Constructs from a native array. References the source.
8777   NativeArray(const Element* array, size_t count, RelationToSourceReference) {
8778     InitRef(array, count);
8779   }
8780 
8781   // Constructs from a native array. Copies the source.
8782   NativeArray(const Element* array, size_t count, RelationToSourceCopy) {
8783     InitCopy(array, count);
8784   }
8785 
8786   // Copy constructor.
8787   NativeArray(const NativeArray& rhs) {
8788     (this->*rhs.clone_)(rhs.array_, rhs.size_);
8789   }
8790 
8791   ~NativeArray() {
8792     if (clone_ != &NativeArray::InitRef)
8793       delete[] array_;
8794   }
8795 
8796   // STL-style container methods.
8797   size_t size() const { return size_; }
8798   const_iterator begin() const { return array_; }
8799   const_iterator end() const { return array_ + size_; }
8800   bool operator==(const NativeArray& rhs) const {
8801     return size() == rhs.size() &&
8802         ArrayEq(begin(), size(), rhs.begin());
8803   }
8804 
8805  private:
8806   enum {
8807     kCheckTypeIsNotConstOrAReference = StaticAssertTypeEqHelper<
8808         Element, GTEST_REMOVE_REFERENCE_AND_CONST_(Element)>::value,
8809   };
8810 
8811   // Initializes this object with a copy of the input.
8812   void InitCopy(const Element* array, size_t a_size) {
8813     Element* const copy = new Element[a_size];
8814     CopyArray(array, a_size, copy);
8815     array_ = copy;
8816     size_ = a_size;
8817     clone_ = &NativeArray::InitCopy;
8818   }
8819 
8820   // Initializes this object with a reference of the input.
8821   void InitRef(const Element* array, size_t a_size) {
8822     array_ = array;
8823     size_ = a_size;
8824     clone_ = &NativeArray::InitRef;
8825   }
8826 
8827   const Element* array_;
8828   size_t size_;
8829   void (NativeArray::*clone_)(const Element*, size_t);
8830 
8831   GTEST_DISALLOW_ASSIGN_(NativeArray);
8832 };
8833 
8834 }  // namespace internal
8835 }  // namespace testing
8836 
8837 #define GTEST_MESSAGE_AT_(file, line, message, result_type) \
8838   ::testing::internal::AssertHelper(result_type, file, line, message) \
8839     = ::testing::Message()
8840 
8841 #define GTEST_MESSAGE_(message, result_type) \
8842   GTEST_MESSAGE_AT_(__FILE__, __LINE__, message, result_type)
8843 
8844 #define GTEST_FATAL_FAILURE_(message) \
8845   return GTEST_MESSAGE_(message, ::testing::TestPartResult::kFatalFailure)
8846 
8847 #define GTEST_NONFATAL_FAILURE_(message) \
8848   GTEST_MESSAGE_(message, ::testing::TestPartResult::kNonFatalFailure)
8849 
8850 #define GTEST_SUCCESS_(message) \
8851   GTEST_MESSAGE_(message, ::testing::TestPartResult::kSuccess)
8852 
8853 // Suppresses MSVC warnings 4072 (unreachable code) for the code following
8854 // statement if it returns or throws (or doesn't return or throw in some
8855 // situations).
8856 #define GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement) \
8857   if (::testing::internal::AlwaysTrue()) { statement; }
8858 
8859 #define GTEST_TEST_THROW_(statement, expected_exception, fail) \
8860   GTEST_AMBIGUOUS_ELSE_BLOCKER_ \
8861   if (::testing::internal::ConstCharPtr gtest_msg = "") { \
8862     bool gtest_caught_expected = false; \
8863     try { \
8864       GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement); \
8865     } \
8866     catch (expected_exception const&) { \
8867       gtest_caught_expected = true; \
8868     } \
8869     catch (...) { \
8870       gtest_msg.value = \
8871           "Expected: " #statement " throws an exception of type " \
8872           #expected_exception ".\n  Actual: it throws a different type."; \
8873       goto GTEST_CONCAT_TOKEN_(gtest_label_testthrow_, __LINE__); \
8874     } \
8875     if (!gtest_caught_expected) { \
8876       gtest_msg.value = \
8877           "Expected: " #statement " throws an exception of type " \
8878           #expected_exception ".\n  Actual: it throws nothing."; \
8879       goto GTEST_CONCAT_TOKEN_(gtest_label_testthrow_, __LINE__); \
8880     } \
8881   } else \
8882     GTEST_CONCAT_TOKEN_(gtest_label_testthrow_, __LINE__): \
8883       fail(gtest_msg.value)
8884 
8885 #define GTEST_TEST_NO_THROW_(statement, fail) \
8886   GTEST_AMBIGUOUS_ELSE_BLOCKER_ \
8887   if (::testing::internal::AlwaysTrue()) { \
8888     try { \
8889       GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement); \
8890     } \
8891     catch (...) { \
8892       goto GTEST_CONCAT_TOKEN_(gtest_label_testnothrow_, __LINE__); \
8893     } \
8894   } else \
8895     GTEST_CONCAT_TOKEN_(gtest_label_testnothrow_, __LINE__): \
8896       fail("Expected: " #statement " doesn't throw an exception.\n" \
8897            "  Actual: it throws.")
8898 
8899 #define GTEST_TEST_ANY_THROW_(statement, fail) \
8900   GTEST_AMBIGUOUS_ELSE_BLOCKER_ \
8901   if (::testing::internal::AlwaysTrue()) { \
8902     bool gtest_caught_any = false; \
8903     try { \
8904       GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement); \
8905     } \
8906     catch (...) { \
8907       gtest_caught_any = true; \
8908     } \
8909     if (!gtest_caught_any) { \
8910       goto GTEST_CONCAT_TOKEN_(gtest_label_testanythrow_, __LINE__); \
8911     } \
8912   } else \
8913     GTEST_CONCAT_TOKEN_(gtest_label_testanythrow_, __LINE__): \
8914       fail("Expected: " #statement " throws an exception.\n" \
8915            "  Actual: it doesn't.")
8916 
8917 
8918 // Implements Boolean test assertions such as EXPECT_TRUE. expression can be
8919 // either a boolean expression or an AssertionResult. text is a textual
8920 // represenation of expression as it was passed into the EXPECT_TRUE.
8921 #define GTEST_TEST_BOOLEAN_(expression, text, actual, expected, fail) \
8922   GTEST_AMBIGUOUS_ELSE_BLOCKER_ \
8923   if (const ::testing::AssertionResult gtest_ar_ = \
8924       ::testing::AssertionResult(expression)) \
8925     ; \
8926   else \
8927     fail(::testing::internal::GetBoolAssertionFailureMessage(\
8928         gtest_ar_, text, #actual, #expected).c_str())
8929 
8930 #define GTEST_TEST_NO_FATAL_FAILURE_(statement, fail) \
8931   GTEST_AMBIGUOUS_ELSE_BLOCKER_ \
8932   if (::testing::internal::AlwaysTrue()) { \
8933     ::testing::internal::HasNewFatalFailureHelper gtest_fatal_failure_checker; \
8934     GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement); \
8935     if (gtest_fatal_failure_checker.has_new_fatal_failure()) { \
8936       goto GTEST_CONCAT_TOKEN_(gtest_label_testnofatal_, __LINE__); \
8937     } \
8938   } else \
8939     GTEST_CONCAT_TOKEN_(gtest_label_testnofatal_, __LINE__): \
8940       fail("Expected: " #statement " doesn't generate new fatal " \
8941            "failures in the current thread.\n" \
8942            "  Actual: it does.")
8943 
8944 // Expands to the name of the class that implements the given test.
8945 #define GTEST_TEST_CLASS_NAME_(test_case_name, test_name) \
8946   test_case_name##_##test_name##_Test
8947 
8948 // Helper macro for defining tests.
8949 #define GTEST_TEST_(test_case_name, test_name, parent_class, parent_id)\
8950 class GTEST_TEST_CLASS_NAME_(test_case_name, test_name) : public parent_class {\
8951  public:\
8952   GTEST_TEST_CLASS_NAME_(test_case_name, test_name)() {}\
8953  private:\
8954   virtual void TestBody();\
8955   static ::testing::TestInfo* const test_info_ GTEST_ATTRIBUTE_UNUSED_;\
8956   GTEST_DISALLOW_COPY_AND_ASSIGN_(\
8957       GTEST_TEST_CLASS_NAME_(test_case_name, test_name));\
8958 };\
8959 \
8960 ::testing::TestInfo* const GTEST_TEST_CLASS_NAME_(test_case_name, test_name)\
8961   ::test_info_ =\
8962     ::testing::internal::MakeAndRegisterTestInfo(\
8963         #test_case_name, #test_name, NULL, NULL, \
8964         ::testing::internal::CodeLocation(__FILE__, __LINE__), \
8965         (parent_id), \
8966         parent_class::SetUpTestCase, \
8967         parent_class::TearDownTestCase, \
8968         new ::testing::internal::TestFactoryImpl<\
8969             GTEST_TEST_CLASS_NAME_(test_case_name, test_name)>);\
8970 void GTEST_TEST_CLASS_NAME_(test_case_name, test_name)::TestBody()
8971 
8972 #endif  // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_INTERNAL_H_
8973 
8974 // Copyright 2005, Google Inc.
8975 // All rights reserved.
8976 //
8977 // Redistribution and use in source and binary forms, with or without
8978 // modification, are permitted provided that the following conditions are
8979 // met:
8980 //
8981 //     * Redistributions of source code must retain the above copyright
8982 // notice, this list of conditions and the following disclaimer.
8983 //     * Redistributions in binary form must reproduce the above
8984 // copyright notice, this list of conditions and the following disclaimer
8985 // in the documentation and/or other materials provided with the
8986 // distribution.
8987 //     * Neither the name of Google Inc. nor the names of its
8988 // contributors may be used to endorse or promote products derived from
8989 // this software without specific prior written permission.
8990 //
8991 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
8992 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
8993 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
8994 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
8995 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
8996 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
8997 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
8998 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
8999 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
9000 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
9001 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
9002 //
9003 // Author: wan@google.com (Zhanyong Wan)
9004 //
9005 // The Google C++ Testing Framework (Google Test)
9006 //
9007 // This header file defines the public API for death tests.  It is
9008 // #included by gtest.h so a user doesn't need to include this
9009 // directly.
9010 
9011 #ifndef GTEST_INCLUDE_GTEST_GTEST_DEATH_TEST_H_
9012 #define GTEST_INCLUDE_GTEST_GTEST_DEATH_TEST_H_
9013 
9014 // Copyright 2005, Google Inc.
9015 // All rights reserved.
9016 //
9017 // Redistribution and use in source and binary forms, with or without
9018 // modification, are permitted provided that the following conditions are
9019 // met:
9020 //
9021 //     * Redistributions of source code must retain the above copyright
9022 // notice, this list of conditions and the following disclaimer.
9023 //     * Redistributions in binary form must reproduce the above
9024 // copyright notice, this list of conditions and the following disclaimer
9025 // in the documentation and/or other materials provided with the
9026 // distribution.
9027 //     * Neither the name of Google Inc. nor the names of its
9028 // contributors may be used to endorse or promote products derived from
9029 // this software without specific prior written permission.
9030 //
9031 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
9032 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
9033 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
9034 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
9035 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
9036 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
9037 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
9038 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
9039 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
9040 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
9041 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
9042 //
9043 // Authors: wan@google.com (Zhanyong Wan), eefacm@gmail.com (Sean Mcafee)
9044 //
9045 // The Google C++ Testing Framework (Google Test)
9046 //
9047 // This header file defines internal utilities needed for implementing
9048 // death tests.  They are subject to change without notice.
9049 
9050 #ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_DEATH_TEST_INTERNAL_H_
9051 #define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_DEATH_TEST_INTERNAL_H_
9052 
9053 
9054 #include <stdio.h>
9055 
9056 namespace testing {
9057 namespace internal {
9058 
9059 GTEST_DECLARE_string_(internal_run_death_test);
9060 
9061 // Names of the flags (needed for parsing Google Test flags).
9062 const char kDeathTestStyleFlag[] = "death_test_style";
9063 const char kDeathTestUseFork[] = "death_test_use_fork";
9064 const char kInternalRunDeathTestFlag[] = "internal_run_death_test";
9065 
9066 #if GTEST_HAS_DEATH_TEST
9067 
9068 // DeathTest is a class that hides much of the complexity of the
9069 // GTEST_DEATH_TEST_ macro.  It is abstract; its static Create method
9070 // returns a concrete class that depends on the prevailing death test
9071 // style, as defined by the --gtest_death_test_style and/or
9072 // --gtest_internal_run_death_test flags.
9073 
9074 // In describing the results of death tests, these terms are used with
9075 // the corresponding definitions:
9076 //
9077 // exit status:  The integer exit information in the format specified
9078 //               by wait(2)
9079 // exit code:    The integer code passed to exit(3), _exit(2), or
9080 //               returned from main()
9081 class GTEST_API_ DeathTest {
9082  public:
9083   // Create returns false if there was an error determining the
9084   // appropriate action to take for the current death test; for example,
9085   // if the gtest_death_test_style flag is set to an invalid value.
9086   // The LastMessage method will return a more detailed message in that
9087   // case.  Otherwise, the DeathTest pointer pointed to by the "test"
9088   // argument is set.  If the death test should be skipped, the pointer
9089   // is set to NULL; otherwise, it is set to the address of a new concrete
9090   // DeathTest object that controls the execution of the current test.
9091   static bool Create(const char* statement, const RE* regex,
9092                      const char* file, int line, DeathTest** test);
9093   DeathTest();
9094   virtual ~DeathTest() { }
9095 
9096   // A helper class that aborts a death test when it's deleted.
9097   class ReturnSentinel {
9098    public:
9099     explicit ReturnSentinel(DeathTest* test) : test_(test) { }
9100     ~ReturnSentinel() { test_->Abort(TEST_ENCOUNTERED_RETURN_STATEMENT); }
9101    private:
9102     DeathTest* const test_;
9103     GTEST_DISALLOW_COPY_AND_ASSIGN_(ReturnSentinel);
9104   } GTEST_ATTRIBUTE_UNUSED_;
9105 
9106   // An enumeration of possible roles that may be taken when a death
9107   // test is encountered.  EXECUTE means that the death test logic should
9108   // be executed immediately.  OVERSEE means that the program should prepare
9109   // the appropriate environment for a child process to execute the death
9110   // test, then wait for it to complete.
9111   enum TestRole { OVERSEE_TEST, EXECUTE_TEST };
9112 
9113   // An enumeration of the three reasons that a test might be aborted.
9114   enum AbortReason {
9115     TEST_ENCOUNTERED_RETURN_STATEMENT,
9116     TEST_THREW_EXCEPTION,
9117     TEST_DID_NOT_DIE
9118   };
9119 
9120   // Assumes one of the above roles.
9121   virtual TestRole AssumeRole() = 0;
9122 
9123   // Waits for the death test to finish and returns its status.
9124   virtual int Wait() = 0;
9125 
9126   // Returns true if the death test passed; that is, the test process
9127   // exited during the test, its exit status matches a user-supplied
9128   // predicate, and its stderr output matches a user-supplied regular
9129   // expression.
9130   // The user-supplied predicate may be a macro expression rather
9131   // than a function pointer or functor, or else Wait and Passed could
9132   // be combined.
9133   virtual bool Passed(bool exit_status_ok) = 0;
9134 
9135   // Signals that the death test did not die as expected.
9136   virtual void Abort(AbortReason reason) = 0;
9137 
9138   // Returns a human-readable outcome message regarding the outcome of
9139   // the last death test.
9140   static const char* LastMessage();
9141 
9142   static void set_last_death_test_message(const std::string& message);
9143 
9144  private:
9145   // A string containing a description of the outcome of the last death test.
9146   static std::string last_death_test_message_;
9147 
9148   GTEST_DISALLOW_COPY_AND_ASSIGN_(DeathTest);
9149 };
9150 
9151 // Factory interface for death tests.  May be mocked out for testing.
9152 class DeathTestFactory {
9153  public:
9154   virtual ~DeathTestFactory() { }
9155   virtual bool Create(const char* statement, const RE* regex,
9156                       const char* file, int line, DeathTest** test) = 0;
9157 };
9158 
9159 // A concrete DeathTestFactory implementation for normal use.
9160 class DefaultDeathTestFactory : public DeathTestFactory {
9161  public:
9162   virtual bool Create(const char* statement, const RE* regex,
9163                       const char* file, int line, DeathTest** test);
9164 };
9165 
9166 // Returns true if exit_status describes a process that was terminated
9167 // by a signal, or exited normally with a nonzero exit code.
9168 GTEST_API_ bool ExitedUnsuccessfully(int exit_status);
9169 
9170 // Traps C++ exceptions escaping statement and reports them as test
9171 // failures. Note that trapping SEH exceptions is not implemented here.
9172 # if GTEST_HAS_EXCEPTIONS
9173 #  define GTEST_EXECUTE_DEATH_TEST_STATEMENT_(statement, death_test) \
9174   try { \
9175     GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement); \
9176   } catch (const ::std::exception& gtest_exception) { \
9177     fprintf(\
9178         stderr, \
9179         "\n%s: Caught std::exception-derived exception escaping the " \
9180         "death test statement. Exception message: %s\n", \
9181         ::testing::internal::FormatFileLocation(__FILE__, __LINE__).c_str(), \
9182         gtest_exception.what()); \
9183     fflush(stderr); \
9184     death_test->Abort(::testing::internal::DeathTest::TEST_THREW_EXCEPTION); \
9185   } catch (...) { \
9186     death_test->Abort(::testing::internal::DeathTest::TEST_THREW_EXCEPTION); \
9187   }
9188 
9189 # else
9190 #  define GTEST_EXECUTE_DEATH_TEST_STATEMENT_(statement, death_test) \
9191   GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement)
9192 
9193 # endif
9194 
9195 // This macro is for implementing ASSERT_DEATH*, EXPECT_DEATH*,
9196 // ASSERT_EXIT*, and EXPECT_EXIT*.
9197 # define GTEST_DEATH_TEST_(statement, predicate, regex, fail) \
9198   GTEST_AMBIGUOUS_ELSE_BLOCKER_ \
9199   if (::testing::internal::AlwaysTrue()) { \
9200     const ::testing::internal::RE& gtest_regex = (regex); \
9201     ::testing::internal::DeathTest* gtest_dt; \
9202     if (!::testing::internal::DeathTest::Create(#statement, &gtest_regex, \
9203         __FILE__, __LINE__, &gtest_dt)) { \
9204       goto GTEST_CONCAT_TOKEN_(gtest_label_, __LINE__); \
9205     } \
9206     if (gtest_dt != NULL) { \
9207       ::testing::internal::scoped_ptr< ::testing::internal::DeathTest> \
9208           gtest_dt_ptr(gtest_dt); \
9209       switch (gtest_dt->AssumeRole()) { \
9210         case ::testing::internal::DeathTest::OVERSEE_TEST: \
9211           if (!gtest_dt->Passed(predicate(gtest_dt->Wait()))) { \
9212             goto GTEST_CONCAT_TOKEN_(gtest_label_, __LINE__); \
9213           } \
9214           break; \
9215         case ::testing::internal::DeathTest::EXECUTE_TEST: { \
9216           ::testing::internal::DeathTest::ReturnSentinel \
9217               gtest_sentinel(gtest_dt); \
9218           GTEST_EXECUTE_DEATH_TEST_STATEMENT_(statement, gtest_dt); \
9219           gtest_dt->Abort(::testing::internal::DeathTest::TEST_DID_NOT_DIE); \
9220           break; \
9221         } \
9222         default: \
9223           break; \
9224       } \
9225     } \
9226   } else \
9227     GTEST_CONCAT_TOKEN_(gtest_label_, __LINE__): \
9228       fail(::testing::internal::DeathTest::LastMessage())
9229 // The symbol "fail" here expands to something into which a message
9230 // can be streamed.
9231 
9232 // This macro is for implementing ASSERT/EXPECT_DEBUG_DEATH when compiled in
9233 // NDEBUG mode. In this case we need the statements to be executed, the regex is
9234 // ignored, and the macro must accept a streamed message even though the message
9235 // is never printed.
9236 # define GTEST_EXECUTE_STATEMENT_(statement, regex) \
9237   GTEST_AMBIGUOUS_ELSE_BLOCKER_ \
9238   if (::testing::internal::AlwaysTrue()) { \
9239      GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement); \
9240   } else \
9241     ::testing::Message()
9242 
9243 // A class representing the parsed contents of the
9244 // --gtest_internal_run_death_test flag, as it existed when
9245 // RUN_ALL_TESTS was called.
9246 class InternalRunDeathTestFlag {
9247  public:
9248   InternalRunDeathTestFlag(const std::string& a_file,
9249                            int a_line,
9250                            int an_index,
9251                            int a_write_fd)
9252       : file_(a_file), line_(a_line), index_(an_index),
9253         write_fd_(a_write_fd) {}
9254 
9255   ~InternalRunDeathTestFlag() {
9256     if (write_fd_ >= 0)
9257       posix::Close(write_fd_);
9258   }
9259 
9260   const std::string& file() const { return file_; }
9261   int line() const { return line_; }
9262   int index() const { return index_; }
9263   int write_fd() const { return write_fd_; }
9264 
9265  private:
9266   std::string file_;
9267   int line_;
9268   int index_;
9269   int write_fd_;
9270 
9271   GTEST_DISALLOW_COPY_AND_ASSIGN_(InternalRunDeathTestFlag);
9272 };
9273 
9274 // Returns a newly created InternalRunDeathTestFlag object with fields
9275 // initialized from the GTEST_FLAG(internal_run_death_test) flag if
9276 // the flag is specified; otherwise returns NULL.
9277 InternalRunDeathTestFlag* ParseInternalRunDeathTestFlag();
9278 
9279 #else  // GTEST_HAS_DEATH_TEST
9280 
9281 // This macro is used for implementing macros such as
9282 // EXPECT_DEATH_IF_SUPPORTED and ASSERT_DEATH_IF_SUPPORTED on systems where
9283 // death tests are not supported. Those macros must compile on such systems
9284 // iff EXPECT_DEATH and ASSERT_DEATH compile with the same parameters on
9285 // systems that support death tests. This allows one to write such a macro
9286 // on a system that does not support death tests and be sure that it will
9287 // compile on a death-test supporting system.
9288 //
9289 // Parameters:
9290 //   statement -  A statement that a macro such as EXPECT_DEATH would test
9291 //                for program termination. This macro has to make sure this
9292 //                statement is compiled but not executed, to ensure that
9293 //                EXPECT_DEATH_IF_SUPPORTED compiles with a certain
9294 //                parameter iff EXPECT_DEATH compiles with it.
9295 //   regex     -  A regex that a macro such as EXPECT_DEATH would use to test
9296 //                the output of statement.  This parameter has to be
9297 //                compiled but not evaluated by this macro, to ensure that
9298 //                this macro only accepts expressions that a macro such as
9299 //                EXPECT_DEATH would accept.
9300 //   terminator - Must be an empty statement for EXPECT_DEATH_IF_SUPPORTED
9301 //                and a return statement for ASSERT_DEATH_IF_SUPPORTED.
9302 //                This ensures that ASSERT_DEATH_IF_SUPPORTED will not
9303 //                compile inside functions where ASSERT_DEATH doesn't
9304 //                compile.
9305 //
9306 //  The branch that has an always false condition is used to ensure that
9307 //  statement and regex are compiled (and thus syntactically correct) but
9308 //  never executed. The unreachable code macro protects the terminator
9309 //  statement from generating an 'unreachable code' warning in case
9310 //  statement unconditionally returns or throws. The Message constructor at
9311 //  the end allows the syntax of streaming additional messages into the
9312 //  macro, for compilational compatibility with EXPECT_DEATH/ASSERT_DEATH.
9313 # define GTEST_UNSUPPORTED_DEATH_TEST_(statement, regex, terminator) \
9314     GTEST_AMBIGUOUS_ELSE_BLOCKER_ \
9315     if (::testing::internal::AlwaysTrue()) { \
9316       GTEST_LOG_(WARNING) \
9317           << "Death tests are not supported on this platform.\n" \
9318           << "Statement '" #statement "' cannot be verified."; \
9319     } else if (::testing::internal::AlwaysFalse()) { \
9320       ::testing::internal::RE::PartialMatch(".*", (regex)); \
9321       GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement); \
9322       terminator; \
9323     } else \
9324       ::testing::Message()
9325 
9326 #endif  // GTEST_HAS_DEATH_TEST
9327 
9328 }  // namespace internal
9329 }  // namespace testing
9330 
9331 #endif  // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_DEATH_TEST_INTERNAL_H_
9332 
9333 namespace testing {
9334 
9335 // This flag controls the style of death tests.  Valid values are "threadsafe",
9336 // meaning that the death test child process will re-execute the test binary
9337 // from the start, running only a single death test, or "fast",
9338 // meaning that the child process will execute the test logic immediately
9339 // after forking.
9340 GTEST_DECLARE_string_(death_test_style);
9341 
9342 #if GTEST_HAS_DEATH_TEST
9343 
9344 namespace internal {
9345 
9346 // Returns a Boolean value indicating whether the caller is currently
9347 // executing in the context of the death test child process.  Tools such as
9348 // Valgrind heap checkers may need this to modify their behavior in death
9349 // tests.  IMPORTANT: This is an internal utility.  Using it may break the
9350 // implementation of death tests.  User code MUST NOT use it.
9351 GTEST_API_ bool InDeathTestChild();
9352 
9353 }  // namespace internal
9354 
9355 // The following macros are useful for writing death tests.
9356 
9357 // Here's what happens when an ASSERT_DEATH* or EXPECT_DEATH* is
9358 // executed:
9359 //
9360 //   1. It generates a warning if there is more than one active
9361 //   thread.  This is because it's safe to fork() or clone() only
9362 //   when there is a single thread.
9363 //
9364 //   2. The parent process clone()s a sub-process and runs the death
9365 //   test in it; the sub-process exits with code 0 at the end of the
9366 //   death test, if it hasn't exited already.
9367 //
9368 //   3. The parent process waits for the sub-process to terminate.
9369 //
9370 //   4. The parent process checks the exit code and error message of
9371 //   the sub-process.
9372 //
9373 // Examples:
9374 //
9375 //   ASSERT_DEATH(server.SendMessage(56, "Hello"), "Invalid port number");
9376 //   for (int i = 0; i < 5; i++) {
9377 //     EXPECT_DEATH(server.ProcessRequest(i),
9378 //                  "Invalid request .* in ProcessRequest()")
9379 //                  << "Failed to die on request " << i;
9380 //   }
9381 //
9382 //   ASSERT_EXIT(server.ExitNow(), ::testing::ExitedWithCode(0), "Exiting");
9383 //
9384 //   bool KilledBySIGHUP(int exit_code) {
9385 //     return WIFSIGNALED(exit_code) && WTERMSIG(exit_code) == SIGHUP;
9386 //   }
9387 //
9388 //   ASSERT_EXIT(client.HangUpServer(), KilledBySIGHUP, "Hanging up!");
9389 //
9390 // On the regular expressions used in death tests:
9391 //
9392 //   On POSIX-compliant systems (*nix), we use the <regex.h> library,
9393 //   which uses the POSIX extended regex syntax.
9394 //
9395 //   On other platforms (e.g. Windows), we only support a simple regex
9396 //   syntax implemented as part of Google Test.  This limited
9397 //   implementation should be enough most of the time when writing
9398 //   death tests; though it lacks many features you can find in PCRE
9399 //   or POSIX extended regex syntax.  For example, we don't support
9400 //   union ("x|y"), grouping ("(xy)"), brackets ("[xy]"), and
9401 //   repetition count ("x{5,7}"), among others.
9402 //
9403 //   Below is the syntax that we do support.  We chose it to be a
9404 //   subset of both PCRE and POSIX extended regex, so it's easy to
9405 //   learn wherever you come from.  In the following: 'A' denotes a
9406 //   literal character, period (.), or a single \\ escape sequence;
9407 //   'x' and 'y' denote regular expressions; 'm' and 'n' are for
9408 //   natural numbers.
9409 //
9410 //     c     matches any literal character c
9411 //     \\d   matches any decimal digit
9412 //     \\D   matches any character that's not a decimal digit
9413 //     \\f   matches \f
9414 //     \\n   matches \n
9415 //     \\r   matches \r
9416 //     \\s   matches any ASCII whitespace, including \n
9417 //     \\S   matches any character that's not a whitespace
9418 //     \\t   matches \t
9419 //     \\v   matches \v
9420 //     \\w   matches any letter, _, or decimal digit
9421 //     \\W   matches any character that \\w doesn't match
9422 //     \\c   matches any literal character c, which must be a punctuation
9423 //     .     matches any single character except \n
9424 //     A?    matches 0 or 1 occurrences of A
9425 //     A*    matches 0 or many occurrences of A
9426 //     A+    matches 1 or many occurrences of A
9427 //     ^     matches the beginning of a string (not that of each line)
9428 //     $     matches the end of a string (not that of each line)
9429 //     xy    matches x followed by y
9430 //
9431 //   If you accidentally use PCRE or POSIX extended regex features
9432 //   not implemented by us, you will get a run-time failure.  In that
9433 //   case, please try to rewrite your regular expression within the
9434 //   above syntax.
9435 //
9436 //   This implementation is *not* meant to be as highly tuned or robust
9437 //   as a compiled regex library, but should perform well enough for a
9438 //   death test, which already incurs significant overhead by launching
9439 //   a child process.
9440 //
9441 // Known caveats:
9442 //
9443 //   A "threadsafe" style death test obtains the path to the test
9444 //   program from argv[0] and re-executes it in the sub-process.  For
9445 //   simplicity, the current implementation doesn't search the PATH
9446 //   when launching the sub-process.  This means that the user must
9447 //   invoke the test program via a path that contains at least one
9448 //   path separator (e.g. path/to/foo_test and
9449 //   /absolute/path/to/bar_test are fine, but foo_test is not).  This
9450 //   is rarely a problem as people usually don't put the test binary
9451 //   directory in PATH.
9452 //
9453 // TODO(wan@google.com): make thread-safe death tests search the PATH.
9454 
9455 // Asserts that a given statement causes the program to exit, with an
9456 // integer exit status that satisfies predicate, and emitting error output
9457 // that matches regex.
9458 # define ASSERT_EXIT(statement, predicate, regex) \
9459     GTEST_DEATH_TEST_(statement, predicate, regex, GTEST_FATAL_FAILURE_)
9460 
9461 // Like ASSERT_EXIT, but continues on to successive tests in the
9462 // test case, if any:
9463 # define EXPECT_EXIT(statement, predicate, regex) \
9464     GTEST_DEATH_TEST_(statement, predicate, regex, GTEST_NONFATAL_FAILURE_)
9465 
9466 // Asserts that a given statement causes the program to exit, either by
9467 // explicitly exiting with a nonzero exit code or being killed by a
9468 // signal, and emitting error output that matches regex.
9469 # define ASSERT_DEATH(statement, regex) \
9470     ASSERT_EXIT(statement, ::testing::internal::ExitedUnsuccessfully, regex)
9471 
9472 // Like ASSERT_DEATH, but continues on to successive tests in the
9473 // test case, if any:
9474 # define EXPECT_DEATH(statement, regex) \
9475     EXPECT_EXIT(statement, ::testing::internal::ExitedUnsuccessfully, regex)
9476 
9477 // Two predicate classes that can be used in {ASSERT,EXPECT}_EXIT*:
9478 
9479 // Tests that an exit code describes a normal exit with a given exit code.
9480 class GTEST_API_ ExitedWithCode {
9481  public:
9482   explicit ExitedWithCode(int exit_code);
9483   bool operator()(int exit_status) const;
9484  private:
9485   // No implementation - assignment is unsupported.
9486   void operator=(const ExitedWithCode& other);
9487 
9488   const int exit_code_;
9489 };
9490 
9491 # if !GTEST_OS_WINDOWS
9492 // Tests that an exit code describes an exit due to termination by a
9493 // given signal.
9494 class GTEST_API_ KilledBySignal {
9495  public:
9496   explicit KilledBySignal(int signum);
9497   bool operator()(int exit_status) const;
9498  private:
9499   const int signum_;
9500 };
9501 # endif  // !GTEST_OS_WINDOWS
9502 
9503 // EXPECT_DEBUG_DEATH asserts that the given statements die in debug mode.
9504 // The death testing framework causes this to have interesting semantics,
9505 // since the sideeffects of the call are only visible in opt mode, and not
9506 // in debug mode.
9507 //
9508 // In practice, this can be used to test functions that utilize the
9509 // LOG(DFATAL) macro using the following style:
9510 //
9511 // int DieInDebugOr12(int* sideeffect) {
9512 //   if (sideeffect) {
9513 //     *sideeffect = 12;
9514 //   }
9515 //   LOG(DFATAL) << "death";
9516 //   return 12;
9517 // }
9518 //
9519 // TEST(TestCase, TestDieOr12WorksInDgbAndOpt) {
9520 //   int sideeffect = 0;
9521 //   // Only asserts in dbg.
9522 //   EXPECT_DEBUG_DEATH(DieInDebugOr12(&sideeffect), "death");
9523 //
9524 // #ifdef NDEBUG
9525 //   // opt-mode has sideeffect visible.
9526 //   EXPECT_EQ(12, sideeffect);
9527 // #else
9528 //   // dbg-mode no visible sideeffect.
9529 //   EXPECT_EQ(0, sideeffect);
9530 // #endif
9531 // }
9532 //
9533 // This will assert that DieInDebugReturn12InOpt() crashes in debug
9534 // mode, usually due to a DCHECK or LOG(DFATAL), but returns the
9535 // appropriate fallback value (12 in this case) in opt mode. If you
9536 // need to test that a function has appropriate side-effects in opt
9537 // mode, include assertions against the side-effects.  A general
9538 // pattern for this is:
9539 //
9540 // EXPECT_DEBUG_DEATH({
9541 //   // Side-effects here will have an effect after this statement in
9542 //   // opt mode, but none in debug mode.
9543 //   EXPECT_EQ(12, DieInDebugOr12(&sideeffect));
9544 // }, "death");
9545 //
9546 # ifdef NDEBUG
9547 
9548 #  define EXPECT_DEBUG_DEATH(statement, regex) \
9549   GTEST_EXECUTE_STATEMENT_(statement, regex)
9550 
9551 #  define ASSERT_DEBUG_DEATH(statement, regex) \
9552   GTEST_EXECUTE_STATEMENT_(statement, regex)
9553 
9554 # else
9555 
9556 #  define EXPECT_DEBUG_DEATH(statement, regex) \
9557   EXPECT_DEATH(statement, regex)
9558 
9559 #  define ASSERT_DEBUG_DEATH(statement, regex) \
9560   ASSERT_DEATH(statement, regex)
9561 
9562 # endif  // NDEBUG for EXPECT_DEBUG_DEATH
9563 #endif  // GTEST_HAS_DEATH_TEST
9564 
9565 // EXPECT_DEATH_IF_SUPPORTED(statement, regex) and
9566 // ASSERT_DEATH_IF_SUPPORTED(statement, regex) expand to real death tests if
9567 // death tests are supported; otherwise they just issue a warning.  This is
9568 // useful when you are combining death test assertions with normal test
9569 // assertions in one test.
9570 #if GTEST_HAS_DEATH_TEST
9571 # define EXPECT_DEATH_IF_SUPPORTED(statement, regex) \
9572     EXPECT_DEATH(statement, regex)
9573 # define ASSERT_DEATH_IF_SUPPORTED(statement, regex) \
9574     ASSERT_DEATH(statement, regex)
9575 #else
9576 # define EXPECT_DEATH_IF_SUPPORTED(statement, regex) \
9577     GTEST_UNSUPPORTED_DEATH_TEST_(statement, regex, )
9578 # define ASSERT_DEATH_IF_SUPPORTED(statement, regex) \
9579     GTEST_UNSUPPORTED_DEATH_TEST_(statement, regex, return)
9580 #endif
9581 
9582 }  // namespace testing
9583 
9584 #endif  // GTEST_INCLUDE_GTEST_GTEST_DEATH_TEST_H_
9585 // This file was GENERATED by command:
9586 //     pump.py gtest-param-test.h.pump
9587 // DO NOT EDIT BY HAND!!!
9588 
9589 // Copyright 2008, Google Inc.
9590 // All rights reserved.
9591 //
9592 // Redistribution and use in source and binary forms, with or without
9593 // modification, are permitted provided that the following conditions are
9594 // met:
9595 //
9596 //     * Redistributions of source code must retain the above copyright
9597 // notice, this list of conditions and the following disclaimer.
9598 //     * Redistributions in binary form must reproduce the above
9599 // copyright notice, this list of conditions and the following disclaimer
9600 // in the documentation and/or other materials provided with the
9601 // distribution.
9602 //     * Neither the name of Google Inc. nor the names of its
9603 // contributors may be used to endorse or promote products derived from
9604 // this software without specific prior written permission.
9605 //
9606 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
9607 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
9608 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
9609 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
9610 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
9611 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
9612 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
9613 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
9614 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
9615 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
9616 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
9617 //
9618 // Authors: vladl@google.com (Vlad Losev)
9619 //
9620 // Macros and functions for implementing parameterized tests
9621 // in Google C++ Testing Framework (Google Test)
9622 //
9623 // This file is generated by a SCRIPT.  DO NOT EDIT BY HAND!
9624 //
9625 #ifndef GTEST_INCLUDE_GTEST_GTEST_PARAM_TEST_H_
9626 #define GTEST_INCLUDE_GTEST_GTEST_PARAM_TEST_H_
9627 
9628 
9629 // Value-parameterized tests allow you to test your code with different
9630 // parameters without writing multiple copies of the same test.
9631 //
9632 // Here is how you use value-parameterized tests:
9633 
9634 #if 0
9635 
9636 // To write value-parameterized tests, first you should define a fixture
9637 // class. It is usually derived from testing::TestWithParam<T> (see below for
9638 // another inheritance scheme that's sometimes useful in more complicated
9639 // class hierarchies), where the type of your parameter values.
9640 // TestWithParam<T> is itself derived from testing::Test. T can be any
9641 // copyable type. If it's a raw pointer, you are responsible for managing the
9642 // lifespan of the pointed values.
9643 
9644 class FooTest : public ::testing::TestWithParam<const char*> {
9645   // You can implement all the usual class fixture members here.
9646 };
9647 
9648 // Then, use the TEST_P macro to define as many parameterized tests
9649 // for this fixture as you want. The _P suffix is for "parameterized"
9650 // or "pattern", whichever you prefer to think.
9651 
9652 TEST_P(FooTest, DoesBlah) {
9653   // Inside a test, access the test parameter with the GetParam() method
9654   // of the TestWithParam<T> class:
9655   EXPECT_TRUE(foo.Blah(GetParam()));
9656   ...
9657 }
9658 
9659 TEST_P(FooTest, HasBlahBlah) {
9660   ...
9661 }
9662 
9663 // Finally, you can use INSTANTIATE_TEST_CASE_P to instantiate the test
9664 // case with any set of parameters you want. Google Test defines a number
9665 // of functions for generating test parameters. They return what we call
9666 // (surprise!) parameter generators. Here is a  summary of them, which
9667 // are all in the testing namespace:
9668 //
9669 //
9670 //  Range(begin, end [, step]) - Yields values {begin, begin+step,
9671 //                               begin+step+step, ...}. The values do not
9672 //                               include end. step defaults to 1.
9673 //  Values(v1, v2, ..., vN)    - Yields values {v1, v2, ..., vN}.
9674 //  ValuesIn(container)        - Yields values from a C-style array, an STL
9675 //  ValuesIn(begin,end)          container, or an iterator range [begin, end).
9676 //  Bool()                     - Yields sequence {false, true}.
9677 //  Combine(g1, g2, ..., gN)   - Yields all combinations (the Cartesian product
9678 //                               for the math savvy) of the values generated
9679 //                               by the N generators.
9680 //
9681 // For more details, see comments at the definitions of these functions below
9682 // in this file.
9683 //
9684 // The following statement will instantiate tests from the FooTest test case
9685 // each with parameter values "meeny", "miny", and "moe".
9686 
9687 INSTANTIATE_TEST_CASE_P(InstantiationName,
9688                         FooTest,
9689                         Values("meeny", "miny", "moe"));
9690 
9691 // To distinguish different instances of the pattern, (yes, you
9692 // can instantiate it more then once) the first argument to the
9693 // INSTANTIATE_TEST_CASE_P macro is a prefix that will be added to the
9694 // actual test case name. Remember to pick unique prefixes for different
9695 // instantiations. The tests from the instantiation above will have
9696 // these names:
9697 //
9698 //    * InstantiationName/FooTest.DoesBlah/0 for "meeny"
9699 //    * InstantiationName/FooTest.DoesBlah/1 for "miny"
9700 //    * InstantiationName/FooTest.DoesBlah/2 for "moe"
9701 //    * InstantiationName/FooTest.HasBlahBlah/0 for "meeny"
9702 //    * InstantiationName/FooTest.HasBlahBlah/1 for "miny"
9703 //    * InstantiationName/FooTest.HasBlahBlah/2 for "moe"
9704 //
9705 // You can use these names in --gtest_filter.
9706 //
9707 // This statement will instantiate all tests from FooTest again, each
9708 // with parameter values "cat" and "dog":
9709 
9710 const char* pets[] = {"cat", "dog"};
9711 INSTANTIATE_TEST_CASE_P(AnotherInstantiationName, FooTest, ValuesIn(pets));
9712 
9713 // The tests from the instantiation above will have these names:
9714 //
9715 //    * AnotherInstantiationName/FooTest.DoesBlah/0 for "cat"
9716 //    * AnotherInstantiationName/FooTest.DoesBlah/1 for "dog"
9717 //    * AnotherInstantiationName/FooTest.HasBlahBlah/0 for "cat"
9718 //    * AnotherInstantiationName/FooTest.HasBlahBlah/1 for "dog"
9719 //
9720 // Please note that INSTANTIATE_TEST_CASE_P will instantiate all tests
9721 // in the given test case, whether their definitions come before or
9722 // AFTER the INSTANTIATE_TEST_CASE_P statement.
9723 //
9724 // Please also note that generator expressions (including parameters to the
9725 // generators) are evaluated in InitGoogleTest(), after main() has started.
9726 // This allows the user on one hand, to adjust generator parameters in order
9727 // to dynamically determine a set of tests to run and on the other hand,
9728 // give the user a chance to inspect the generated tests with Google Test
9729 // reflection API before RUN_ALL_TESTS() is executed.
9730 //
9731 // You can see samples/sample7_unittest.cc and samples/sample8_unittest.cc
9732 // for more examples.
9733 //
9734 // In the future, we plan to publish the API for defining new parameter
9735 // generators. But for now this interface remains part of the internal
9736 // implementation and is subject to change.
9737 //
9738 //
9739 // A parameterized test fixture must be derived from testing::Test and from
9740 // testing::WithParamInterface<T>, where T is the type of the parameter
9741 // values. Inheriting from TestWithParam<T> satisfies that requirement because
9742 // TestWithParam<T> inherits from both Test and WithParamInterface. In more
9743 // complicated hierarchies, however, it is occasionally useful to inherit
9744 // separately from Test and WithParamInterface. For example:
9745 
9746 class BaseTest : public ::testing::Test {
9747   // You can inherit all the usual members for a non-parameterized test
9748   // fixture here.
9749 };
9750 
9751 class DerivedTest : public BaseTest, public ::testing::WithParamInterface<int> {
9752   // The usual test fixture members go here too.
9753 };
9754 
9755 TEST_F(BaseTest, HasFoo) {
9756   // This is an ordinary non-parameterized test.
9757 }
9758 
9759 TEST_P(DerivedTest, DoesBlah) {
9760   // GetParam works just the same here as if you inherit from TestWithParam.
9761   EXPECT_TRUE(foo.Blah(GetParam()));
9762 }
9763 
9764 #endif  // 0
9765 
9766 
9767 #if !GTEST_OS_SYMBIAN
9768 # include <utility>
9769 #endif
9770 
9771 // scripts/fuse_gtest.py depends on gtest's own header being #included
9772 // *unconditionally*.  Therefore these #includes cannot be moved
9773 // inside #if GTEST_HAS_PARAM_TEST.
9774 // Copyright 2008 Google Inc.
9775 // All Rights Reserved.
9776 //
9777 // Redistribution and use in source and binary forms, with or without
9778 // modification, are permitted provided that the following conditions are
9779 // met:
9780 //
9781 //     * Redistributions of source code must retain the above copyright
9782 // notice, this list of conditions and the following disclaimer.
9783 //     * Redistributions in binary form must reproduce the above
9784 // copyright notice, this list of conditions and the following disclaimer
9785 // in the documentation and/or other materials provided with the
9786 // distribution.
9787 //     * Neither the name of Google Inc. nor the names of its
9788 // contributors may be used to endorse or promote products derived from
9789 // this software without specific prior written permission.
9790 //
9791 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
9792 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
9793 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
9794 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
9795 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
9796 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
9797 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
9798 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
9799 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
9800 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
9801 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
9802 //
9803 // Author: vladl@google.com (Vlad Losev)
9804 
9805 // Type and function utilities for implementing parameterized tests.
9806 
9807 #ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PARAM_UTIL_H_
9808 #define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PARAM_UTIL_H_
9809 
9810 #include <ctype.h>
9811 
9812 #include <iterator>
9813 #include <set>
9814 #include <utility>
9815 #include <vector>
9816 
9817 // scripts/fuse_gtest.py depends on gtest's own header being #included
9818 // *unconditionally*.  Therefore these #includes cannot be moved
9819 // inside #if GTEST_HAS_PARAM_TEST.
9820 // Copyright 2003 Google Inc.
9821 // All rights reserved.
9822 //
9823 // Redistribution and use in source and binary forms, with or without
9824 // modification, are permitted provided that the following conditions are
9825 // met:
9826 //
9827 //     * Redistributions of source code must retain the above copyright
9828 // notice, this list of conditions and the following disclaimer.
9829 //     * Redistributions in binary form must reproduce the above
9830 // copyright notice, this list of conditions and the following disclaimer
9831 // in the documentation and/or other materials provided with the
9832 // distribution.
9833 //     * Neither the name of Google Inc. nor the names of its
9834 // contributors may be used to endorse or promote products derived from
9835 // this software without specific prior written permission.
9836 //
9837 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
9838 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
9839 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
9840 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
9841 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
9842 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
9843 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
9844 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
9845 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
9846 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
9847 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
9848 //
9849 // Authors: Dan Egnor (egnor@google.com)
9850 //
9851 // A "smart" pointer type with reference tracking.  Every pointer to a
9852 // particular object is kept on a circular linked list.  When the last pointer
9853 // to an object is destroyed or reassigned, the object is deleted.
9854 //
9855 // Used properly, this deletes the object when the last reference goes away.
9856 // There are several caveats:
9857 // - Like all reference counting schemes, cycles lead to leaks.
9858 // - Each smart pointer is actually two pointers (8 bytes instead of 4).
9859 // - Every time a pointer is assigned, the entire list of pointers to that
9860 //   object is traversed.  This class is therefore NOT SUITABLE when there
9861 //   will often be more than two or three pointers to a particular object.
9862 // - References are only tracked as long as linked_ptr<> objects are copied.
9863 //   If a linked_ptr<> is converted to a raw pointer and back, BAD THINGS
9864 //   will happen (double deletion).
9865 //
9866 // A good use of this class is storing object references in STL containers.
9867 // You can safely put linked_ptr<> in a vector<>.
9868 // Other uses may not be as good.
9869 //
9870 // Note: If you use an incomplete type with linked_ptr<>, the class
9871 // *containing* linked_ptr<> must have a constructor and destructor (even
9872 // if they do nothing!).
9873 //
9874 // Bill Gibbons suggested we use something like this.
9875 //
9876 // Thread Safety:
9877 //   Unlike other linked_ptr implementations, in this implementation
9878 //   a linked_ptr object is thread-safe in the sense that:
9879 //     - it's safe to copy linked_ptr objects concurrently,
9880 //     - it's safe to copy *from* a linked_ptr and read its underlying
9881 //       raw pointer (e.g. via get()) concurrently, and
9882 //     - it's safe to write to two linked_ptrs that point to the same
9883 //       shared object concurrently.
9884 // TODO(wan@google.com): rename this to safe_linked_ptr to avoid
9885 // confusion with normal linked_ptr.
9886 
9887 #ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_LINKED_PTR_H_
9888 #define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_LINKED_PTR_H_
9889 
9890 #include <stdlib.h>
9891 #include <assert.h>
9892 
9893 
9894 namespace testing {
9895 namespace internal {
9896 
9897 // Protects copying of all linked_ptr objects.
9898 GTEST_API_ GTEST_DECLARE_STATIC_MUTEX_(g_linked_ptr_mutex);
9899 
9900 // This is used internally by all instances of linked_ptr<>.  It needs to be
9901 // a non-template class because different types of linked_ptr<> can refer to
9902 // the same object (linked_ptr<Superclass>(obj) vs linked_ptr<Subclass>(obj)).
9903 // So, it needs to be possible for different types of linked_ptr to participate
9904 // in the same circular linked list, so we need a single class type here.
9905 //
9906 // DO NOT USE THIS CLASS DIRECTLY YOURSELF.  Use linked_ptr<T>.
9907 class linked_ptr_internal {
9908  public:
9909   // Create a new circle that includes only this instance.
9910   void join_new() {
9911     next_ = this;
9912   }
9913 
9914   // Many linked_ptr operations may change p.link_ for some linked_ptr
9915   // variable p in the same circle as this object.  Therefore we need
9916   // to prevent two such operations from occurring concurrently.
9917   //
9918   // Note that different types of linked_ptr objects can coexist in a
9919   // circle (e.g. linked_ptr<Base>, linked_ptr<Derived1>, and
9920   // linked_ptr<Derived2>).  Therefore we must use a single mutex to
9921   // protect all linked_ptr objects.  This can create serious
9922   // contention in production code, but is acceptable in a testing
9923   // framework.
9924 
9925   // Join an existing circle.
9926   void join(linked_ptr_internal const* ptr)
9927       GTEST_LOCK_EXCLUDED_(g_linked_ptr_mutex) {
9928     MutexLock lock(&g_linked_ptr_mutex);
9929 
9930     linked_ptr_internal const* p = ptr;
9931     while (p->next_ != ptr) {
9932       assert(p->next_ != this &&
9933              "Trying to join() a linked ring we are already in. "
9934              "Is GMock thread safety enabled?");
9935       p = p->next_;
9936     }
9937     p->next_ = this;
9938     next_ = ptr;
9939   }
9940 
9941   // Leave whatever circle we're part of.  Returns true if we were the
9942   // last member of the circle.  Once this is done, you can join() another.
9943   bool depart()
9944       GTEST_LOCK_EXCLUDED_(g_linked_ptr_mutex) {
9945     MutexLock lock(&g_linked_ptr_mutex);
9946 
9947     if (next_ == this) return true;
9948     linked_ptr_internal const* p = next_;
9949     while (p->next_ != this) {
9950       assert(p->next_ != next_ &&
9951              "Trying to depart() a linked ring we are not in. "
9952              "Is GMock thread safety enabled?");
9953       p = p->next_;
9954     }
9955     p->next_ = next_;
9956     return false;
9957   }
9958 
9959  private:
9960   mutable linked_ptr_internal const* next_;
9961 };
9962 
9963 template <typename T>
9964 class linked_ptr {
9965  public:
9966   typedef T element_type;
9967 
9968   // Take over ownership of a raw pointer.  This should happen as soon as
9969   // possible after the object is created.
9970   explicit linked_ptr(T* ptr = NULL) { capture(ptr); }
9971   ~linked_ptr() { depart(); }
9972 
9973   // Copy an existing linked_ptr<>, adding ourselves to the list of references.
9974   template <typename U> linked_ptr(linked_ptr<U> const& ptr) { copy(&ptr); }
9975   linked_ptr(linked_ptr const& ptr) {  // NOLINT
9976     assert(&ptr != this);
9977     copy(&ptr);
9978   }
9979 
9980   // Assignment releases the old value and acquires the new.
9981   template <typename U> linked_ptr& operator=(linked_ptr<U> const& ptr) {
9982     depart();
9983     copy(&ptr);
9984     return *this;
9985   }
9986 
9987   linked_ptr& operator=(linked_ptr const& ptr) {
9988     if (&ptr != this) {
9989       depart();
9990       copy(&ptr);
9991     }
9992     return *this;
9993   }
9994 
9995   // Smart pointer members.
9996   void reset(T* ptr = NULL) {
9997     depart();
9998     capture(ptr);
9999   }
10000   T* get() const { return value_; }
10001   T* operator->() const { return value_; }
10002   T& operator*() const { return *value_; }
10003 
10004   bool operator==(T* p) const { return value_ == p; }
10005   bool operator!=(T* p) const { return value_ != p; }
10006   template <typename U>
10007   bool operator==(linked_ptr<U> const& ptr) const {
10008     return value_ == ptr.get();
10009   }
10010   template <typename U>
10011   bool operator!=(linked_ptr<U> const& ptr) const {
10012     return value_ != ptr.get();
10013   }
10014 
10015  private:
10016   template <typename U>
10017   friend class linked_ptr;
10018 
10019   T* value_;
10020   linked_ptr_internal link_;
10021 
10022   void depart() {
10023     if (link_.depart()) delete value_;
10024   }
10025 
10026   void capture(T* ptr) {
10027     value_ = ptr;
10028     link_.join_new();
10029   }
10030 
10031   template <typename U> void copy(linked_ptr<U> const* ptr) {
10032     value_ = ptr->get();
10033     if (value_)
10034       link_.join(&ptr->link_);
10035     else
10036       link_.join_new();
10037   }
10038 };
10039 
10040 template<typename T> inline
10041 bool operator==(T* ptr, const linked_ptr<T>& x) {
10042   return ptr == x.get();
10043 }
10044 
10045 template<typename T> inline
10046 bool operator!=(T* ptr, const linked_ptr<T>& x) {
10047   return ptr != x.get();
10048 }
10049 
10050 // A function to convert T* into linked_ptr<T>
10051 // Doing e.g. make_linked_ptr(new FooBarBaz<type>(arg)) is a shorter notation
10052 // for linked_ptr<FooBarBaz<type> >(new FooBarBaz<type>(arg))
10053 template <typename T>
10054 linked_ptr<T> make_linked_ptr(T* ptr) {
10055   return linked_ptr<T>(ptr);
10056 }
10057 
10058 }  // namespace internal
10059 }  // namespace testing
10060 
10061 #endif  // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_LINKED_PTR_H_
10062 // Copyright 2007, Google Inc.
10063 // All rights reserved.
10064 //
10065 // Redistribution and use in source and binary forms, with or without
10066 // modification, are permitted provided that the following conditions are
10067 // met:
10068 //
10069 //     * Redistributions of source code must retain the above copyright
10070 // notice, this list of conditions and the following disclaimer.
10071 //     * Redistributions in binary form must reproduce the above
10072 // copyright notice, this list of conditions and the following disclaimer
10073 // in the documentation and/or other materials provided with the
10074 // distribution.
10075 //     * Neither the name of Google Inc. nor the names of its
10076 // contributors may be used to endorse or promote products derived from
10077 // this software without specific prior written permission.
10078 //
10079 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
10080 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
10081 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
10082 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
10083 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
10084 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
10085 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
10086 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
10087 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
10088 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
10089 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
10090 //
10091 // Author: wan@google.com (Zhanyong Wan)
10092 
10093 // Google Test - The Google C++ Testing Framework
10094 //
10095 // This file implements a universal value printer that can print a
10096 // value of any type T:
10097 //
10098 //   void ::testing::internal::UniversalPrinter<T>::Print(value, ostream_ptr);
10099 //
10100 // A user can teach this function how to print a class type T by
10101 // defining either operator<<() or PrintTo() in the namespace that
10102 // defines T.  More specifically, the FIRST defined function in the
10103 // following list will be used (assuming T is defined in namespace
10104 // foo):
10105 //
10106 //   1. foo::PrintTo(const T&, ostream*)
10107 //   2. operator<<(ostream&, const T&) defined in either foo or the
10108 //      global namespace.
10109 //
10110 // If none of the above is defined, it will print the debug string of
10111 // the value if it is a protocol buffer, or print the raw bytes in the
10112 // value otherwise.
10113 //
10114 // To aid debugging: when T is a reference type, the address of the
10115 // value is also printed; when T is a (const) char pointer, both the
10116 // pointer value and the NUL-terminated string it points to are
10117 // printed.
10118 //
10119 // We also provide some convenient wrappers:
10120 //
10121 //   // Prints a value to a string.  For a (const or not) char
10122 //   // pointer, the NUL-terminated string (but not the pointer) is
10123 //   // printed.
10124 //   std::string ::testing::PrintToString(const T& value);
10125 //
10126 //   // Prints a value tersely: for a reference type, the referenced
10127 //   // value (but not the address) is printed; for a (const or not) char
10128 //   // pointer, the NUL-terminated string (but not the pointer) is
10129 //   // printed.
10130 //   void ::testing::internal::UniversalTersePrint(const T& value, ostream*);
10131 //
10132 //   // Prints value using the type inferred by the compiler.  The difference
10133 //   // from UniversalTersePrint() is that this function prints both the
10134 //   // pointer and the NUL-terminated string for a (const or not) char pointer.
10135 //   void ::testing::internal::UniversalPrint(const T& value, ostream*);
10136 //
10137 //   // Prints the fields of a tuple tersely to a string vector, one
10138 //   // element for each field. Tuple support must be enabled in
10139 //   // gtest-port.h.
10140 //   std::vector<string> UniversalTersePrintTupleFieldsToStrings(
10141 //       const Tuple& value);
10142 //
10143 // Known limitation:
10144 //
10145 // The print primitives print the elements of an STL-style container
10146 // using the compiler-inferred type of *iter where iter is a
10147 // const_iterator of the container.  When const_iterator is an input
10148 // iterator but not a forward iterator, this inferred type may not
10149 // match value_type, and the print output may be incorrect.  In
10150 // practice, this is rarely a problem as for most containers
10151 // const_iterator is a forward iterator.  We'll fix this if there's an
10152 // actual need for it.  Note that this fix cannot rely on value_type
10153 // being defined as many user-defined container types don't have
10154 // value_type.
10155 
10156 #ifndef GTEST_INCLUDE_GTEST_GTEST_PRINTERS_H_
10157 #define GTEST_INCLUDE_GTEST_GTEST_PRINTERS_H_
10158 
10159 #include <ostream>  // NOLINT
10160 #include <sstream>
10161 #include <string>
10162 #include <utility>
10163 #include <vector>
10164 
10165 #if GTEST_HAS_STD_TUPLE_
10166 # include <tuple>
10167 #endif
10168 
10169 namespace testing {
10170 
10171 // Definitions in the 'internal' and 'internal2' name spaces are
10172 // subject to change without notice.  DO NOT USE THEM IN USER CODE!
10173 namespace internal2 {
10174 
10175 // Prints the given number of bytes in the given object to the given
10176 // ostream.
10177 GTEST_API_ void PrintBytesInObjectTo(const unsigned char* obj_bytes,
10178                                      size_t count,
10179                                      ::std::ostream* os);
10180 
10181 // For selecting which printer to use when a given type has neither <<
10182 // nor PrintTo().
10183 enum TypeKind {
10184   kProtobuf,              // a protobuf type
10185   kConvertibleToInteger,  // a type implicitly convertible to BiggestInt
10186                           // (e.g. a named or unnamed enum type)
10187   kOtherType              // anything else
10188 };
10189 
10190 // TypeWithoutFormatter<T, kTypeKind>::PrintValue(value, os) is called
10191 // by the universal printer to print a value of type T when neither
10192 // operator<< nor PrintTo() is defined for T, where kTypeKind is the
10193 // "kind" of T as defined by enum TypeKind.
10194 template <typename T, TypeKind kTypeKind>
10195 class TypeWithoutFormatter {
10196  public:
10197   // This default version is called when kTypeKind is kOtherType.
10198   static void PrintValue(const T& value, ::std::ostream* os) {
10199     PrintBytesInObjectTo(reinterpret_cast<const unsigned char*>(&value),
10200                          sizeof(value), os);
10201   }
10202 };
10203 
10204 // We print a protobuf using its ShortDebugString() when the string
10205 // doesn't exceed this many characters; otherwise we print it using
10206 // DebugString() for better readability.
10207 const size_t kProtobufOneLinerMaxLength = 50;
10208 
10209 template <typename T>
10210 class TypeWithoutFormatter<T, kProtobuf> {
10211  public:
10212   static void PrintValue(const T& value, ::std::ostream* os) {
10213     const ::testing::internal::string short_str = value.ShortDebugString();
10214     const ::testing::internal::string pretty_str =
10215         short_str.length() <= kProtobufOneLinerMaxLength ?
10216         short_str : ("\n" + value.DebugString());
10217     *os << ("<" + pretty_str + ">");
10218   }
10219 };
10220 
10221 template <typename T>
10222 class TypeWithoutFormatter<T, kConvertibleToInteger> {
10223  public:
10224   // Since T has no << operator or PrintTo() but can be implicitly
10225   // converted to BiggestInt, we print it as a BiggestInt.
10226   //
10227   // Most likely T is an enum type (either named or unnamed), in which
10228   // case printing it as an integer is the desired behavior.  In case
10229   // T is not an enum, printing it as an integer is the best we can do
10230   // given that it has no user-defined printer.
10231   static void PrintValue(const T& value, ::std::ostream* os) {
10232     const internal::BiggestInt kBigInt = value;
10233     *os << kBigInt;
10234   }
10235 };
10236 
10237 // Prints the given value to the given ostream.  If the value is a
10238 // protocol message, its debug string is printed; if it's an enum or
10239 // of a type implicitly convertible to BiggestInt, it's printed as an
10240 // integer; otherwise the bytes in the value are printed.  This is
10241 // what UniversalPrinter<T>::Print() does when it knows nothing about
10242 // type T and T has neither << operator nor PrintTo().
10243 //
10244 // A user can override this behavior for a class type Foo by defining
10245 // a << operator in the namespace where Foo is defined.
10246 //
10247 // We put this operator in namespace 'internal2' instead of 'internal'
10248 // to simplify the implementation, as much code in 'internal' needs to
10249 // use << in STL, which would conflict with our own << were it defined
10250 // in 'internal'.
10251 //
10252 // Note that this operator<< takes a generic std::basic_ostream<Char,
10253 // CharTraits> type instead of the more restricted std::ostream.  If
10254 // we define it to take an std::ostream instead, we'll get an
10255 // "ambiguous overloads" compiler error when trying to print a type
10256 // Foo that supports streaming to std::basic_ostream<Char,
10257 // CharTraits>, as the compiler cannot tell whether
10258 // operator<<(std::ostream&, const T&) or
10259 // operator<<(std::basic_stream<Char, CharTraits>, const Foo&) is more
10260 // specific.
10261 template <typename Char, typename CharTraits, typename T>
10262 ::std::basic_ostream<Char, CharTraits>& operator<<(
10263     ::std::basic_ostream<Char, CharTraits>& os, const T& x) {
10264   TypeWithoutFormatter<T,
10265       (internal::IsAProtocolMessage<T>::value ? kProtobuf :
10266        internal::ImplicitlyConvertible<const T&, internal::BiggestInt>::value ?
10267        kConvertibleToInteger : kOtherType)>::PrintValue(x, &os);
10268   return os;
10269 }
10270 
10271 }  // namespace internal2
10272 }  // namespace testing
10273 
10274 // This namespace MUST NOT BE NESTED IN ::testing, or the name look-up
10275 // magic needed for implementing UniversalPrinter won't work.
10276 namespace testing_internal {
10277 
10278 // Used to print a value that is not an STL-style container when the
10279 // user doesn't define PrintTo() for it.
10280 template <typename T>
10281 void DefaultPrintNonContainerTo(const T& value, ::std::ostream* os) {
10282   // With the following statement, during unqualified name lookup,
10283   // testing::internal2::operator<< appears as if it was declared in
10284   // the nearest enclosing namespace that contains both
10285   // ::testing_internal and ::testing::internal2, i.e. the global
10286   // namespace.  For more details, refer to the C++ Standard section
10287   // 7.3.4-1 [namespace.udir].  This allows us to fall back onto
10288   // testing::internal2::operator<< in case T doesn't come with a <<
10289   // operator.
10290   //
10291   // We cannot write 'using ::testing::internal2::operator<<;', which
10292   // gcc 3.3 fails to compile due to a compiler bug.
10293   using namespace ::testing::internal2;  // NOLINT
10294 
10295   // Assuming T is defined in namespace foo, in the next statement,
10296   // the compiler will consider all of:
10297   //
10298   //   1. foo::operator<< (thanks to Koenig look-up),
10299   //   2. ::operator<< (as the current namespace is enclosed in ::),
10300   //   3. testing::internal2::operator<< (thanks to the using statement above).
10301   //
10302   // The operator<< whose type matches T best will be picked.
10303   //
10304   // We deliberately allow #2 to be a candidate, as sometimes it's
10305   // impossible to define #1 (e.g. when foo is ::std, defining
10306   // anything in it is undefined behavior unless you are a compiler
10307   // vendor.).
10308   *os << value;
10309 }
10310 
10311 }  // namespace testing_internal
10312 
10313 namespace testing {
10314 namespace internal {
10315 
10316 // FormatForComparison<ToPrint, OtherOperand>::Format(value) formats a
10317 // value of type ToPrint that is an operand of a comparison assertion
10318 // (e.g. ASSERT_EQ).  OtherOperand is the type of the other operand in
10319 // the comparison, and is used to help determine the best way to
10320 // format the value.  In particular, when the value is a C string
10321 // (char pointer) and the other operand is an STL string object, we
10322 // want to format the C string as a string, since we know it is
10323 // compared by value with the string object.  If the value is a char
10324 // pointer but the other operand is not an STL string object, we don't
10325 // know whether the pointer is supposed to point to a NUL-terminated
10326 // string, and thus want to print it as a pointer to be safe.
10327 //
10328 // INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
10329 
10330 // The default case.
10331 template <typename ToPrint, typename OtherOperand>
10332 class FormatForComparison {
10333  public:
10334   static ::std::string Format(const ToPrint& value) {
10335     return ::testing::PrintToString(value);
10336   }
10337 };
10338 
10339 // Array.
10340 template <typename ToPrint, size_t N, typename OtherOperand>
10341 class FormatForComparison<ToPrint[N], OtherOperand> {
10342  public:
10343   static ::std::string Format(const ToPrint* value) {
10344     return FormatForComparison<const ToPrint*, OtherOperand>::Format(value);
10345   }
10346 };
10347 
10348 // By default, print C string as pointers to be safe, as we don't know
10349 // whether they actually point to a NUL-terminated string.
10350 
10351 #define GTEST_IMPL_FORMAT_C_STRING_AS_POINTER_(CharType)                \
10352   template <typename OtherOperand>                                      \
10353   class FormatForComparison<CharType*, OtherOperand> {                  \
10354    public:                                                              \
10355     static ::std::string Format(CharType* value) {                      \
10356       return ::testing::PrintToString(static_cast<const void*>(value)); \
10357     }                                                                   \
10358   }
10359 
10360 GTEST_IMPL_FORMAT_C_STRING_AS_POINTER_(char);
10361 GTEST_IMPL_FORMAT_C_STRING_AS_POINTER_(const char);
10362 GTEST_IMPL_FORMAT_C_STRING_AS_POINTER_(wchar_t);
10363 GTEST_IMPL_FORMAT_C_STRING_AS_POINTER_(const wchar_t);
10364 
10365 #undef GTEST_IMPL_FORMAT_C_STRING_AS_POINTER_
10366 
10367 // If a C string is compared with an STL string object, we know it's meant
10368 // to point to a NUL-terminated string, and thus can print it as a string.
10369 
10370 #define GTEST_IMPL_FORMAT_C_STRING_AS_STRING_(CharType, OtherStringType) \
10371   template <>                                                           \
10372   class FormatForComparison<CharType*, OtherStringType> {               \
10373    public:                                                              \
10374     static ::std::string Format(CharType* value) {                      \
10375       return ::testing::PrintToString(value);                           \
10376     }                                                                   \
10377   }
10378 
10379 GTEST_IMPL_FORMAT_C_STRING_AS_STRING_(char, ::std::string);
10380 GTEST_IMPL_FORMAT_C_STRING_AS_STRING_(const char, ::std::string);
10381 
10382 #if GTEST_HAS_GLOBAL_STRING
10383 GTEST_IMPL_FORMAT_C_STRING_AS_STRING_(char, ::string);
10384 GTEST_IMPL_FORMAT_C_STRING_AS_STRING_(const char, ::string);
10385 #endif
10386 
10387 #if GTEST_HAS_GLOBAL_WSTRING
10388 GTEST_IMPL_FORMAT_C_STRING_AS_STRING_(wchar_t, ::wstring);
10389 GTEST_IMPL_FORMAT_C_STRING_AS_STRING_(const wchar_t, ::wstring);
10390 #endif
10391 
10392 #if GTEST_HAS_STD_WSTRING
10393 GTEST_IMPL_FORMAT_C_STRING_AS_STRING_(wchar_t, ::std::wstring);
10394 GTEST_IMPL_FORMAT_C_STRING_AS_STRING_(const wchar_t, ::std::wstring);
10395 #endif
10396 
10397 #undef GTEST_IMPL_FORMAT_C_STRING_AS_STRING_
10398 
10399 // Formats a comparison assertion (e.g. ASSERT_EQ, EXPECT_LT, and etc)
10400 // operand to be used in a failure message.  The type (but not value)
10401 // of the other operand may affect the format.  This allows us to
10402 // print a char* as a raw pointer when it is compared against another
10403 // char* or void*, and print it as a C string when it is compared
10404 // against an std::string object, for example.
10405 //
10406 // INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
10407 template <typename T1, typename T2>
10408 std::string FormatForComparisonFailureMessage(
10409     const T1& value, const T2& /* other_operand */) {
10410   return FormatForComparison<T1, T2>::Format(value);
10411 }
10412 
10413 // UniversalPrinter<T>::Print(value, ostream_ptr) prints the given
10414 // value to the given ostream.  The caller must ensure that
10415 // 'ostream_ptr' is not NULL, or the behavior is undefined.
10416 //
10417 // We define UniversalPrinter as a class template (as opposed to a
10418 // function template), as we need to partially specialize it for
10419 // reference types, which cannot be done with function templates.
10420 template <typename T>
10421 class UniversalPrinter;
10422 
10423 template <typename T>
10424 void UniversalPrint(const T& value, ::std::ostream* os);
10425 
10426 // Used to print an STL-style container when the user doesn't define
10427 // a PrintTo() for it.
10428 template <typename C>
10429 void DefaultPrintTo(IsContainer /* dummy */,
10430                     false_type /* is not a pointer */,
10431                     const C& container, ::std::ostream* os) {
10432   const size_t kMaxCount = 32;  // The maximum number of elements to print.
10433   *os << '{';
10434   size_t count = 0;
10435   for (typename C::const_iterator it = container.begin();
10436        it != container.end(); ++it, ++count) {
10437     if (count > 0) {
10438       *os << ',';
10439       if (count == kMaxCount) {  // Enough has been printed.
10440         *os << " ...";
10441         break;
10442       }
10443     }
10444     *os << ' ';
10445     // We cannot call PrintTo(*it, os) here as PrintTo() doesn't
10446     // handle *it being a native array.
10447     internal::UniversalPrint(*it, os);
10448   }
10449 
10450   if (count > 0) {
10451     *os << ' ';
10452   }
10453   *os << '}';
10454 }
10455 
10456 // Used to print a pointer that is neither a char pointer nor a member
10457 // pointer, when the user doesn't define PrintTo() for it.  (A member
10458 // variable pointer or member function pointer doesn't really point to
10459 // a location in the address space.  Their representation is
10460 // implementation-defined.  Therefore they will be printed as raw
10461 // bytes.)
10462 template <typename T>
10463 void DefaultPrintTo(IsNotContainer /* dummy */,
10464                     true_type /* is a pointer */,
10465                     T* p, ::std::ostream* os) {
10466   if (p == NULL) {
10467     *os << "NULL";
10468   } else {
10469     // C++ doesn't allow casting from a function pointer to any object
10470     // pointer.
10471     //
10472     // IsTrue() silences warnings: "Condition is always true",
10473     // "unreachable code".
10474     if (IsTrue(ImplicitlyConvertible<T*, const void*>::value)) {
10475       // T is not a function type.  We just call << to print p,
10476       // relying on ADL to pick up user-defined << for their pointer
10477       // types, if any.
10478       *os << p;
10479     } else {
10480       // T is a function type, so '*os << p' doesn't do what we want
10481       // (it just prints p as bool).  We want to print p as a const
10482       // void*.  However, we cannot cast it to const void* directly,
10483       // even using reinterpret_cast, as earlier versions of gcc
10484       // (e.g. 3.4.5) cannot compile the cast when p is a function
10485       // pointer.  Casting to UInt64 first solves the problem.
10486       *os << reinterpret_cast<const void*>(
10487           reinterpret_cast<internal::UInt64>(p));
10488     }
10489   }
10490 }
10491 
10492 // Used to print a non-container, non-pointer value when the user
10493 // doesn't define PrintTo() for it.
10494 template <typename T>
10495 void DefaultPrintTo(IsNotContainer /* dummy */,
10496                     false_type /* is not a pointer */,
10497                     const T& value, ::std::ostream* os) {
10498   ::testing_internal::DefaultPrintNonContainerTo(value, os);
10499 }
10500 
10501 // Prints the given value using the << operator if it has one;
10502 // otherwise prints the bytes in it.  This is what
10503 // UniversalPrinter<T>::Print() does when PrintTo() is not specialized
10504 // or overloaded for type T.
10505 //
10506 // A user can override this behavior for a class type Foo by defining
10507 // an overload of PrintTo() in the namespace where Foo is defined.  We
10508 // give the user this option as sometimes defining a << operator for
10509 // Foo is not desirable (e.g. the coding style may prevent doing it,
10510 // or there is already a << operator but it doesn't do what the user
10511 // wants).
10512 template <typename T>
10513 void PrintTo(const T& value, ::std::ostream* os) {
10514   // DefaultPrintTo() is overloaded.  The type of its first two
10515   // arguments determine which version will be picked.  If T is an
10516   // STL-style container, the version for container will be called; if
10517   // T is a pointer, the pointer version will be called; otherwise the
10518   // generic version will be called.
10519   //
10520   // Note that we check for container types here, prior to we check
10521   // for protocol message types in our operator<<.  The rationale is:
10522   //
10523   // For protocol messages, we want to give people a chance to
10524   // override Google Mock's format by defining a PrintTo() or
10525   // operator<<.  For STL containers, other formats can be
10526   // incompatible with Google Mock's format for the container
10527   // elements; therefore we check for container types here to ensure
10528   // that our format is used.
10529   //
10530   // The second argument of DefaultPrintTo() is needed to bypass a bug
10531   // in Symbian's C++ compiler that prevents it from picking the right
10532   // overload between:
10533   //
10534   //   PrintTo(const T& x, ...);
10535   //   PrintTo(T* x, ...);
10536   DefaultPrintTo(IsContainerTest<T>(0), is_pointer<T>(), value, os);
10537 }
10538 
10539 // The following list of PrintTo() overloads tells
10540 // UniversalPrinter<T>::Print() how to print standard types (built-in
10541 // types, strings, plain arrays, and pointers).
10542 
10543 // Overloads for various char types.
10544 GTEST_API_ void PrintTo(unsigned char c, ::std::ostream* os);
10545 GTEST_API_ void PrintTo(signed char c, ::std::ostream* os);
10546 inline void PrintTo(char c, ::std::ostream* os) {
10547   // When printing a plain char, we always treat it as unsigned.  This
10548   // way, the output won't be affected by whether the compiler thinks
10549   // char is signed or not.
10550   PrintTo(static_cast<unsigned char>(c), os);
10551 }
10552 
10553 // Overloads for other simple built-in types.
10554 inline void PrintTo(bool x, ::std::ostream* os) {
10555   *os << (x ? "true" : "false");
10556 }
10557 
10558 // Overload for wchar_t type.
10559 // Prints a wchar_t as a symbol if it is printable or as its internal
10560 // code otherwise and also as its decimal code (except for L'\0').
10561 // The L'\0' char is printed as "L'\\0'". The decimal code is printed
10562 // as signed integer when wchar_t is implemented by the compiler
10563 // as a signed type and is printed as an unsigned integer when wchar_t
10564 // is implemented as an unsigned type.
10565 GTEST_API_ void PrintTo(wchar_t wc, ::std::ostream* os);
10566 
10567 // Overloads for C strings.
10568 GTEST_API_ void PrintTo(const char* s, ::std::ostream* os);
10569 inline void PrintTo(char* s, ::std::ostream* os) {
10570   PrintTo(ImplicitCast_<const char*>(s), os);
10571 }
10572 
10573 // signed/unsigned char is often used for representing binary data, so
10574 // we print pointers to it as void* to be safe.
10575 inline void PrintTo(const signed char* s, ::std::ostream* os) {
10576   PrintTo(ImplicitCast_<const void*>(s), os);
10577 }
10578 inline void PrintTo(signed char* s, ::std::ostream* os) {
10579   PrintTo(ImplicitCast_<const void*>(s), os);
10580 }
10581 inline void PrintTo(const unsigned char* s, ::std::ostream* os) {
10582   PrintTo(ImplicitCast_<const void*>(s), os);
10583 }
10584 inline void PrintTo(unsigned char* s, ::std::ostream* os) {
10585   PrintTo(ImplicitCast_<const void*>(s), os);
10586 }
10587 
10588 // MSVC can be configured to define wchar_t as a typedef of unsigned
10589 // short.  It defines _NATIVE_WCHAR_T_DEFINED when wchar_t is a native
10590 // type.  When wchar_t is a typedef, defining an overload for const
10591 // wchar_t* would cause unsigned short* be printed as a wide string,
10592 // possibly causing invalid memory accesses.
10593 #if !defined(_MSC_VER) || defined(_NATIVE_WCHAR_T_DEFINED)
10594 // Overloads for wide C strings
10595 GTEST_API_ void PrintTo(const wchar_t* s, ::std::ostream* os);
10596 inline void PrintTo(wchar_t* s, ::std::ostream* os) {
10597   PrintTo(ImplicitCast_<const wchar_t*>(s), os);
10598 }
10599 #endif
10600 
10601 // Overload for C arrays.  Multi-dimensional arrays are printed
10602 // properly.
10603 
10604 // Prints the given number of elements in an array, without printing
10605 // the curly braces.
10606 template <typename T>
10607 void PrintRawArrayTo(const T a[], size_t count, ::std::ostream* os) {
10608   UniversalPrint(a[0], os);
10609   for (size_t i = 1; i != count; i++) {
10610     *os << ", ";
10611     UniversalPrint(a[i], os);
10612   }
10613 }
10614 
10615 // Overloads for ::string and ::std::string.
10616 #if GTEST_HAS_GLOBAL_STRING
10617 GTEST_API_ void PrintStringTo(const ::string&s, ::std::ostream* os);
10618 inline void PrintTo(const ::string& s, ::std::ostream* os) {
10619   PrintStringTo(s, os);
10620 }
10621 #endif  // GTEST_HAS_GLOBAL_STRING
10622 
10623 GTEST_API_ void PrintStringTo(const ::std::string&s, ::std::ostream* os);
10624 inline void PrintTo(const ::std::string& s, ::std::ostream* os) {
10625   PrintStringTo(s, os);
10626 }
10627 
10628 // Overloads for ::wstring and ::std::wstring.
10629 #if GTEST_HAS_GLOBAL_WSTRING
10630 GTEST_API_ void PrintWideStringTo(const ::wstring&s, ::std::ostream* os);
10631 inline void PrintTo(const ::wstring& s, ::std::ostream* os) {
10632   PrintWideStringTo(s, os);
10633 }
10634 #endif  // GTEST_HAS_GLOBAL_WSTRING
10635 
10636 #if GTEST_HAS_STD_WSTRING
10637 GTEST_API_ void PrintWideStringTo(const ::std::wstring&s, ::std::ostream* os);
10638 inline void PrintTo(const ::std::wstring& s, ::std::ostream* os) {
10639   PrintWideStringTo(s, os);
10640 }
10641 #endif  // GTEST_HAS_STD_WSTRING
10642 
10643 #if GTEST_HAS_TR1_TUPLE || GTEST_HAS_STD_TUPLE_
10644 // Helper function for printing a tuple.  T must be instantiated with
10645 // a tuple type.
10646 template <typename T>
10647 void PrintTupleTo(const T& t, ::std::ostream* os);
10648 #endif  // GTEST_HAS_TR1_TUPLE || GTEST_HAS_STD_TUPLE_
10649 
10650 #if GTEST_HAS_TR1_TUPLE
10651 // Overload for ::std::tr1::tuple.  Needed for printing function arguments,
10652 // which are packed as tuples.
10653 
10654 // Overloaded PrintTo() for tuples of various arities.  We support
10655 // tuples of up-to 10 fields.  The following implementation works
10656 // regardless of whether tr1::tuple is implemented using the
10657 // non-standard variadic template feature or not.
10658 
10659 inline void PrintTo(const ::std::tr1::tuple<>& t, ::std::ostream* os) {
10660   PrintTupleTo(t, os);
10661 }
10662 
10663 template <typename T1>
10664 void PrintTo(const ::std::tr1::tuple<T1>& t, ::std::ostream* os) {
10665   PrintTupleTo(t, os);
10666 }
10667 
10668 template <typename T1, typename T2>
10669 void PrintTo(const ::std::tr1::tuple<T1, T2>& t, ::std::ostream* os) {
10670   PrintTupleTo(t, os);
10671 }
10672 
10673 template <typename T1, typename T2, typename T3>
10674 void PrintTo(const ::std::tr1::tuple<T1, T2, T3>& t, ::std::ostream* os) {
10675   PrintTupleTo(t, os);
10676 }
10677 
10678 template <typename T1, typename T2, typename T3, typename T4>
10679 void PrintTo(const ::std::tr1::tuple<T1, T2, T3, T4>& t, ::std::ostream* os) {
10680   PrintTupleTo(t, os);
10681 }
10682 
10683 template <typename T1, typename T2, typename T3, typename T4, typename T5>
10684 void PrintTo(const ::std::tr1::tuple<T1, T2, T3, T4, T5>& t,
10685              ::std::ostream* os) {
10686   PrintTupleTo(t, os);
10687 }
10688 
10689 template <typename T1, typename T2, typename T3, typename T4, typename T5,
10690           typename T6>
10691 void PrintTo(const ::std::tr1::tuple<T1, T2, T3, T4, T5, T6>& t,
10692              ::std::ostream* os) {
10693   PrintTupleTo(t, os);
10694 }
10695 
10696 template <typename T1, typename T2, typename T3, typename T4, typename T5,
10697           typename T6, typename T7>
10698 void PrintTo(const ::std::tr1::tuple<T1, T2, T3, T4, T5, T6, T7>& t,
10699              ::std::ostream* os) {
10700   PrintTupleTo(t, os);
10701 }
10702 
10703 template <typename T1, typename T2, typename T3, typename T4, typename T5,
10704           typename T6, typename T7, typename T8>
10705 void PrintTo(const ::std::tr1::tuple<T1, T2, T3, T4, T5, T6, T7, T8>& t,
10706              ::std::ostream* os) {
10707   PrintTupleTo(t, os);
10708 }
10709 
10710 template <typename T1, typename T2, typename T3, typename T4, typename T5,
10711           typename T6, typename T7, typename T8, typename T9>
10712 void PrintTo(const ::std::tr1::tuple<T1, T2, T3, T4, T5, T6, T7, T8, T9>& t,
10713              ::std::ostream* os) {
10714   PrintTupleTo(t, os);
10715 }
10716 
10717 template <typename T1, typename T2, typename T3, typename T4, typename T5,
10718           typename T6, typename T7, typename T8, typename T9, typename T10>
10719 void PrintTo(
10720     const ::std::tr1::tuple<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>& t,
10721     ::std::ostream* os) {
10722   PrintTupleTo(t, os);
10723 }
10724 #endif  // GTEST_HAS_TR1_TUPLE
10725 
10726 #if GTEST_HAS_STD_TUPLE_
10727 template <typename... Types>
10728 void PrintTo(const ::std::tuple<Types...>& t, ::std::ostream* os) {
10729   PrintTupleTo(t, os);
10730 }
10731 #endif  // GTEST_HAS_STD_TUPLE_
10732 
10733 // Overload for std::pair.
10734 template <typename T1, typename T2>
10735 void PrintTo(const ::std::pair<T1, T2>& value, ::std::ostream* os) {
10736   *os << '(';
10737   // We cannot use UniversalPrint(value.first, os) here, as T1 may be
10738   // a reference type.  The same for printing value.second.
10739   UniversalPrinter<T1>::Print(value.first, os);
10740   *os << ", ";
10741   UniversalPrinter<T2>::Print(value.second, os);
10742   *os << ')';
10743 }
10744 
10745 // Implements printing a non-reference type T by letting the compiler
10746 // pick the right overload of PrintTo() for T.
10747 template <typename T>
10748 class UniversalPrinter {
10749  public:
10750   // MSVC warns about adding const to a function type, so we want to
10751   // disable the warning.
10752   GTEST_DISABLE_MSC_WARNINGS_PUSH_(4180)
10753 
10754   // Note: we deliberately don't call this PrintTo(), as that name
10755   // conflicts with ::testing::internal::PrintTo in the body of the
10756   // function.
10757   static void Print(const T& value, ::std::ostream* os) {
10758     // By default, ::testing::internal::PrintTo() is used for printing
10759     // the value.
10760     //
10761     // Thanks to Koenig look-up, if T is a class and has its own
10762     // PrintTo() function defined in its namespace, that function will
10763     // be visible here.  Since it is more specific than the generic ones
10764     // in ::testing::internal, it will be picked by the compiler in the
10765     // following statement - exactly what we want.
10766     PrintTo(value, os);
10767   }
10768 
10769   GTEST_DISABLE_MSC_WARNINGS_POP_()
10770 };
10771 
10772 // UniversalPrintArray(begin, len, os) prints an array of 'len'
10773 // elements, starting at address 'begin'.
10774 template <typename T>
10775 void UniversalPrintArray(const T* begin, size_t len, ::std::ostream* os) {
10776   if (len == 0) {
10777     *os << "{}";
10778   } else {
10779     *os << "{ ";
10780     const size_t kThreshold = 18;
10781     const size_t kChunkSize = 8;
10782     // If the array has more than kThreshold elements, we'll have to
10783     // omit some details by printing only the first and the last
10784     // kChunkSize elements.
10785     // TODO(wan@google.com): let the user control the threshold using a flag.
10786     if (len <= kThreshold) {
10787       PrintRawArrayTo(begin, len, os);
10788     } else {
10789       PrintRawArrayTo(begin, kChunkSize, os);
10790       *os << ", ..., ";
10791       PrintRawArrayTo(begin + len - kChunkSize, kChunkSize, os);
10792     }
10793     *os << " }";
10794   }
10795 }
10796 // This overload prints a (const) char array compactly.
10797 GTEST_API_ void UniversalPrintArray(
10798     const char* begin, size_t len, ::std::ostream* os);
10799 
10800 // This overload prints a (const) wchar_t array compactly.
10801 GTEST_API_ void UniversalPrintArray(
10802     const wchar_t* begin, size_t len, ::std::ostream* os);
10803 
10804 // Implements printing an array type T[N].
10805 template <typename T, size_t N>
10806 class UniversalPrinter<T[N]> {
10807  public:
10808   // Prints the given array, omitting some elements when there are too
10809   // many.
10810   static void Print(const T (&a)[N], ::std::ostream* os) {
10811     UniversalPrintArray(a, N, os);
10812   }
10813 };
10814 
10815 // Implements printing a reference type T&.
10816 template <typename T>
10817 class UniversalPrinter<T&> {
10818  public:
10819   // MSVC warns about adding const to a function type, so we want to
10820   // disable the warning.
10821   GTEST_DISABLE_MSC_WARNINGS_PUSH_(4180)
10822 
10823   static void Print(const T& value, ::std::ostream* os) {
10824     // Prints the address of the value.  We use reinterpret_cast here
10825     // as static_cast doesn't compile when T is a function type.
10826     *os << "@" << reinterpret_cast<const void*>(&value) << " ";
10827 
10828     // Then prints the value itself.
10829     UniversalPrint(value, os);
10830   }
10831 
10832   GTEST_DISABLE_MSC_WARNINGS_POP_()
10833 };
10834 
10835 // Prints a value tersely: for a reference type, the referenced value
10836 // (but not the address) is printed; for a (const) char pointer, the
10837 // NUL-terminated string (but not the pointer) is printed.
10838 
10839 template <typename T>
10840 class UniversalTersePrinter {
10841  public:
10842   static void Print(const T& value, ::std::ostream* os) {
10843     UniversalPrint(value, os);
10844   }
10845 };
10846 template <typename T>
10847 class UniversalTersePrinter<T&> {
10848  public:
10849   static void Print(const T& value, ::std::ostream* os) {
10850     UniversalPrint(value, os);
10851   }
10852 };
10853 template <typename T, size_t N>
10854 class UniversalTersePrinter<T[N]> {
10855  public:
10856   static void Print(const T (&value)[N], ::std::ostream* os) {
10857     UniversalPrinter<T[N]>::Print(value, os);
10858   }
10859 };
10860 template <>
10861 class UniversalTersePrinter<const char*> {
10862  public:
10863   static void Print(const char* str, ::std::ostream* os) {
10864     if (str == NULL) {
10865       *os << "NULL";
10866     } else {
10867       UniversalPrint(string(str), os);
10868     }
10869   }
10870 };
10871 template <>
10872 class UniversalTersePrinter<char*> {
10873  public:
10874   static void Print(char* str, ::std::ostream* os) {
10875     UniversalTersePrinter<const char*>::Print(str, os);
10876   }
10877 };
10878 
10879 #if GTEST_HAS_STD_WSTRING
10880 template <>
10881 class UniversalTersePrinter<const wchar_t*> {
10882  public:
10883   static void Print(const wchar_t* str, ::std::ostream* os) {
10884     if (str == NULL) {
10885       *os << "NULL";
10886     } else {
10887       UniversalPrint(::std::wstring(str), os);
10888     }
10889   }
10890 };
10891 #endif
10892 
10893 template <>
10894 class UniversalTersePrinter<wchar_t*> {
10895  public:
10896   static void Print(wchar_t* str, ::std::ostream* os) {
10897     UniversalTersePrinter<const wchar_t*>::Print(str, os);
10898   }
10899 };
10900 
10901 template <typename T>
10902 void UniversalTersePrint(const T& value, ::std::ostream* os) {
10903   UniversalTersePrinter<T>::Print(value, os);
10904 }
10905 
10906 // Prints a value using the type inferred by the compiler.  The
10907 // difference between this and UniversalTersePrint() is that for a
10908 // (const) char pointer, this prints both the pointer and the
10909 // NUL-terminated string.
10910 template <typename T>
10911 void UniversalPrint(const T& value, ::std::ostream* os) {
10912   // A workarond for the bug in VC++ 7.1 that prevents us from instantiating
10913   // UniversalPrinter with T directly.
10914   typedef T T1;
10915   UniversalPrinter<T1>::Print(value, os);
10916 }
10917 
10918 typedef ::std::vector<string> Strings;
10919 
10920 // TuplePolicy<TupleT> must provide:
10921 // - tuple_size
10922 //     size of tuple TupleT.
10923 // - get<size_t I>(const TupleT& t)
10924 //     static function extracting element I of tuple TupleT.
10925 // - tuple_element<size_t I>::type
10926 //     type of element I of tuple TupleT.
10927 template <typename TupleT>
10928 struct TuplePolicy;
10929 
10930 #if GTEST_HAS_TR1_TUPLE
10931 template <typename TupleT>
10932 struct TuplePolicy {
10933   typedef TupleT Tuple;
10934   static const size_t tuple_size = ::std::tr1::tuple_size<Tuple>::value;
10935 
10936   template <size_t I>
10937   struct tuple_element : ::std::tr1::tuple_element<I, Tuple> {};
10938 
10939   template <size_t I>
10940   static typename AddReference<
10941       const typename ::std::tr1::tuple_element<I, Tuple>::type>::type get(
10942       const Tuple& tuple) {
10943     return ::std::tr1::get<I>(tuple);
10944   }
10945 };
10946 template <typename TupleT>
10947 const size_t TuplePolicy<TupleT>::tuple_size;
10948 #endif  // GTEST_HAS_TR1_TUPLE
10949 
10950 #if GTEST_HAS_STD_TUPLE_
10951 template <typename... Types>
10952 struct TuplePolicy< ::std::tuple<Types...> > {
10953   typedef ::std::tuple<Types...> Tuple;
10954   static const size_t tuple_size = ::std::tuple_size<Tuple>::value;
10955 
10956   template <size_t I>
10957   struct tuple_element : ::std::tuple_element<I, Tuple> {};
10958 
10959   template <size_t I>
10960   static const typename ::std::tuple_element<I, Tuple>::type& get(
10961       const Tuple& tuple) {
10962     return ::std::get<I>(tuple);
10963   }
10964 };
10965 template <typename... Types>
10966 const size_t TuplePolicy< ::std::tuple<Types...> >::tuple_size;
10967 #endif  // GTEST_HAS_STD_TUPLE_
10968 
10969 #if GTEST_HAS_TR1_TUPLE || GTEST_HAS_STD_TUPLE_
10970 // This helper template allows PrintTo() for tuples and
10971 // UniversalTersePrintTupleFieldsToStrings() to be defined by
10972 // induction on the number of tuple fields.  The idea is that
10973 // TuplePrefixPrinter<N>::PrintPrefixTo(t, os) prints the first N
10974 // fields in tuple t, and can be defined in terms of
10975 // TuplePrefixPrinter<N - 1>.
10976 //
10977 // The inductive case.
10978 template <size_t N>
10979 struct TuplePrefixPrinter {
10980   // Prints the first N fields of a tuple.
10981   template <typename Tuple>
10982   static void PrintPrefixTo(const Tuple& t, ::std::ostream* os) {
10983     TuplePrefixPrinter<N - 1>::PrintPrefixTo(t, os);
10984     GTEST_INTENTIONAL_CONST_COND_PUSH_()
10985     if (N > 1) {
10986     GTEST_INTENTIONAL_CONST_COND_POP_()
10987       *os << ", ";
10988     }
10989     UniversalPrinter<
10990         typename TuplePolicy<Tuple>::template tuple_element<N - 1>::type>
10991         ::Print(TuplePolicy<Tuple>::template get<N - 1>(t), os);
10992   }
10993 
10994   // Tersely prints the first N fields of a tuple to a string vector,
10995   // one element for each field.
10996   template <typename Tuple>
10997   static void TersePrintPrefixToStrings(const Tuple& t, Strings* strings) {
10998     TuplePrefixPrinter<N - 1>::TersePrintPrefixToStrings(t, strings);
10999     ::std::stringstream ss;
11000     UniversalTersePrint(TuplePolicy<Tuple>::template get<N - 1>(t), &ss);
11001     strings->push_back(ss.str());
11002   }
11003 };
11004 
11005 // Base case.
11006 template <>
11007 struct TuplePrefixPrinter<0> {
11008   template <typename Tuple>
11009   static void PrintPrefixTo(const Tuple&, ::std::ostream*) {}
11010 
11011   template <typename Tuple>
11012   static void TersePrintPrefixToStrings(const Tuple&, Strings*) {}
11013 };
11014 
11015 // Helper function for printing a tuple.
11016 // Tuple must be either std::tr1::tuple or std::tuple type.
11017 template <typename Tuple>
11018 void PrintTupleTo(const Tuple& t, ::std::ostream* os) {
11019   *os << "(";
11020   TuplePrefixPrinter<TuplePolicy<Tuple>::tuple_size>::PrintPrefixTo(t, os);
11021   *os << ")";
11022 }
11023 
11024 // Prints the fields of a tuple tersely to a string vector, one
11025 // element for each field.  See the comment before
11026 // UniversalTersePrint() for how we define "tersely".
11027 template <typename Tuple>
11028 Strings UniversalTersePrintTupleFieldsToStrings(const Tuple& value) {
11029   Strings result;
11030   TuplePrefixPrinter<TuplePolicy<Tuple>::tuple_size>::
11031       TersePrintPrefixToStrings(value, &result);
11032   return result;
11033 }
11034 #endif  // GTEST_HAS_TR1_TUPLE || GTEST_HAS_STD_TUPLE_
11035 
11036 }  // namespace internal
11037 
11038 template <typename T>
11039 ::std::string PrintToString(const T& value) {
11040   ::std::stringstream ss;
11041   internal::UniversalTersePrinter<T>::Print(value, &ss);
11042   return ss.str();
11043 }
11044 
11045 }  // namespace testing
11046 
11047 // Include any custom printer added by the local installation.
11048 // We must include this header at the end to make sure it can use the
11049 // declarations from this file.
11050 // Copyright 2015, Google Inc.
11051 // All rights reserved.
11052 //
11053 // Redistribution and use in source and binary forms, with or without
11054 // modification, are permitted provided that the following conditions are
11055 // met:
11056 //
11057 //     * Redistributions of source code must retain the above copyright
11058 // notice, this list of conditions and the following disclaimer.
11059 //     * Redistributions in binary form must reproduce the above
11060 // copyright notice, this list of conditions and the following disclaimer
11061 // in the documentation and/or other materials provided with the
11062 // distribution.
11063 //     * Neither the name of Google Inc. nor the names of its
11064 // contributors may be used to endorse or promote products derived from
11065 // this software without specific prior written permission.
11066 //
11067 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
11068 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
11069 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
11070 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
11071 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
11072 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
11073 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
11074 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
11075 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
11076 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
11077 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
11078 //
11079 // This file provides an injection point for custom printers in a local
11080 // installation of gTest.
11081 // It will be included from gtest-printers.h and the overrides in this file
11082 // will be visible to everyone.
11083 // See documentation at gtest/gtest-printers.h for details on how to define a
11084 // custom printer.
11085 //
11086 // ** Custom implementation starts here **
11087 
11088 #ifndef GTEST_INCLUDE_GTEST_INTERNAL_CUSTOM_GTEST_PRINTERS_H_
11089 #define GTEST_INCLUDE_GTEST_INTERNAL_CUSTOM_GTEST_PRINTERS_H_
11090 
11091 #endif  // GTEST_INCLUDE_GTEST_INTERNAL_CUSTOM_GTEST_PRINTERS_H_
11092 
11093 #endif  // GTEST_INCLUDE_GTEST_GTEST_PRINTERS_H_
11094 
11095 #if GTEST_HAS_PARAM_TEST
11096 
11097 namespace testing {
11098 
11099 // Input to a parameterized test name generator, describing a test parameter.
11100 // Consists of the parameter value and the integer parameter index.
11101 template <class ParamType>
11102 struct TestParamInfo {
11103   TestParamInfo(const ParamType& a_param, size_t an_index) :
11104     param(a_param),
11105     index(an_index) {}
11106   ParamType param;
11107   size_t index;
11108 };
11109 
11110 // A builtin parameterized test name generator which returns the result of
11111 // testing::PrintToString.
11112 struct PrintToStringParamName {
11113   template <class ParamType>
11114   std::string operator()(const TestParamInfo<ParamType>& info) const {
11115     return PrintToString(info.param);
11116   }
11117 };
11118 
11119 namespace internal {
11120 
11121 // INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.
11122 //
11123 // Outputs a message explaining invalid registration of different
11124 // fixture class for the same test case. This may happen when
11125 // TEST_P macro is used to define two tests with the same name
11126 // but in different namespaces.
11127 GTEST_API_ void ReportInvalidTestCaseType(const char* test_case_name,
11128                                           CodeLocation code_location);
11129 
11130 template <typename> class ParamGeneratorInterface;
11131 template <typename> class ParamGenerator;
11132 
11133 // Interface for iterating over elements provided by an implementation
11134 // of ParamGeneratorInterface<T>.
11135 template <typename T>
11136 class ParamIteratorInterface {
11137  public:
11138   virtual ~ParamIteratorInterface() {}
11139   // A pointer to the base generator instance.
11140   // Used only for the purposes of iterator comparison
11141   // to make sure that two iterators belong to the same generator.
11142   virtual const ParamGeneratorInterface<T>* BaseGenerator() const = 0;
11143   // Advances iterator to point to the next element
11144   // provided by the generator. The caller is responsible
11145   // for not calling Advance() on an iterator equal to
11146   // BaseGenerator()->End().
11147   virtual void Advance() = 0;
11148   // Clones the iterator object. Used for implementing copy semantics
11149   // of ParamIterator<T>.
11150   virtual ParamIteratorInterface* Clone() const = 0;
11151   // Dereferences the current iterator and provides (read-only) access
11152   // to the pointed value. It is the caller's responsibility not to call
11153   // Current() on an iterator equal to BaseGenerator()->End().
11154   // Used for implementing ParamGenerator<T>::operator*().
11155   virtual const T* Current() const = 0;
11156   // Determines whether the given iterator and other point to the same
11157   // element in the sequence generated by the generator.
11158   // Used for implementing ParamGenerator<T>::operator==().
11159   virtual bool Equals(const ParamIteratorInterface& other) const = 0;
11160 };
11161 
11162 // Class iterating over elements provided by an implementation of
11163 // ParamGeneratorInterface<T>. It wraps ParamIteratorInterface<T>
11164 // and implements the const forward iterator concept.
11165 template <typename T>
11166 class ParamIterator {
11167  public:
11168   typedef T value_type;
11169   typedef const T& reference;
11170   typedef ptrdiff_t difference_type;
11171 
11172   // ParamIterator assumes ownership of the impl_ pointer.
11173   ParamIterator(const ParamIterator& other) : impl_(other.impl_->Clone()) {}
11174   ParamIterator& operator=(const ParamIterator& other) {
11175     if (this != &other)
11176       impl_.reset(other.impl_->Clone());
11177     return *this;
11178   }
11179 
11180   const T& operator*() const { return *impl_->Current(); }
11181   const T* operator->() const { return impl_->Current(); }
11182   // Prefix version of operator++.
11183   ParamIterator& operator++() {
11184     impl_->Advance();
11185     return *this;
11186   }
11187   // Postfix version of operator++.
11188   ParamIterator operator++(int /*unused*/) {
11189     ParamIteratorInterface<T>* clone = impl_->Clone();
11190     impl_->Advance();
11191     return ParamIterator(clone);
11192   }
11193   bool operator==(const ParamIterator& other) const {
11194     return impl_.get() == other.impl_.get() || impl_->Equals(*other.impl_);
11195   }
11196   bool operator!=(const ParamIterator& other) const {
11197     return !(*this == other);
11198   }
11199 
11200  private:
11201   friend class ParamGenerator<T>;
11202   explicit ParamIterator(ParamIteratorInterface<T>* impl) : impl_(impl) {}
11203   scoped_ptr<ParamIteratorInterface<T> > impl_;
11204 };
11205 
11206 // ParamGeneratorInterface<T> is the binary interface to access generators
11207 // defined in other translation units.
11208 template <typename T>
11209 class ParamGeneratorInterface {
11210  public:
11211   typedef T ParamType;
11212 
11213   virtual ~ParamGeneratorInterface() {}
11214 
11215   // Generator interface definition
11216   virtual ParamIteratorInterface<T>* Begin() const = 0;
11217   virtual ParamIteratorInterface<T>* End() const = 0;
11218 };
11219 
11220 // Wraps ParamGeneratorInterface<T> and provides general generator syntax
11221 // compatible with the STL Container concept.
11222 // This class implements copy initialization semantics and the contained
11223 // ParamGeneratorInterface<T> instance is shared among all copies
11224 // of the original object. This is possible because that instance is immutable.
11225 template<typename T>
11226 class ParamGenerator {
11227  public:
11228   typedef ParamIterator<T> iterator;
11229 
11230   explicit ParamGenerator(ParamGeneratorInterface<T>* impl) : impl_(impl) {}
11231   ParamGenerator(const ParamGenerator& other) : impl_(other.impl_) {}
11232 
11233   ParamGenerator& operator=(const ParamGenerator& other) {
11234     impl_ = other.impl_;
11235     return *this;
11236   }
11237 
11238   iterator begin() const { return iterator(impl_->Begin()); }
11239   iterator end() const { return iterator(impl_->End()); }
11240 
11241  private:
11242   linked_ptr<const ParamGeneratorInterface<T> > impl_;
11243 };
11244 
11245 // Generates values from a range of two comparable values. Can be used to
11246 // generate sequences of user-defined types that implement operator+() and
11247 // operator<().
11248 // This class is used in the Range() function.
11249 template <typename T, typename IncrementT>
11250 class RangeGenerator : public ParamGeneratorInterface<T> {
11251  public:
11252   RangeGenerator(T begin, T end, IncrementT step)
11253       : begin_(begin), end_(end),
11254         step_(step), end_index_(CalculateEndIndex(begin, end, step)) {}
11255   virtual ~RangeGenerator() {}
11256 
11257   virtual ParamIteratorInterface<T>* Begin() const {
11258     return new Iterator(this, begin_, 0, step_);
11259   }
11260   virtual ParamIteratorInterface<T>* End() const {
11261     return new Iterator(this, end_, end_index_, step_);
11262   }
11263 
11264  private:
11265   class Iterator : public ParamIteratorInterface<T> {
11266    public:
11267     Iterator(const ParamGeneratorInterface<T>* base, T value, int index,
11268              IncrementT step)
11269         : base_(base), value_(value), index_(index), step_(step) {}
11270     virtual ~Iterator() {}
11271 
11272     virtual const ParamGeneratorInterface<T>* BaseGenerator() const {
11273       return base_;
11274     }
11275     virtual void Advance() {
11276       value_ = static_cast<T>(value_ + step_);
11277       index_++;
11278     }
11279     virtual ParamIteratorInterface<T>* Clone() const {
11280       return new Iterator(*this);
11281     }
11282     virtual const T* Current() const { return &value_; }
11283     virtual bool Equals(const ParamIteratorInterface<T>& other) const {
11284       // Having the same base generator guarantees that the other
11285       // iterator is of the same type and we can downcast.
11286       GTEST_CHECK_(BaseGenerator() == other.BaseGenerator())
11287           << "The program attempted to compare iterators "
11288           << "from different generators." << std::endl;
11289       const int other_index =
11290           CheckedDowncastToActualType<const Iterator>(&other)->index_;
11291       return index_ == other_index;
11292     }
11293 
11294    private:
11295     Iterator(const Iterator& other)
11296         : ParamIteratorInterface<T>(),
11297           base_(other.base_), value_(other.value_), index_(other.index_),
11298           step_(other.step_) {}
11299 
11300     // No implementation - assignment is unsupported.
11301     void operator=(const Iterator& other);
11302 
11303     const ParamGeneratorInterface<T>* const base_;
11304     T value_;
11305     int index_;
11306     const IncrementT step_;
11307   };  // class RangeGenerator::Iterator
11308 
11309   static int CalculateEndIndex(const T& begin,
11310                                const T& end,
11311                                const IncrementT& step) {
11312     int end_index = 0;
11313     for (T i = begin; i < end; i = static_cast<T>(i + step))
11314       end_index++;
11315     return end_index;
11316   }
11317 
11318   // No implementation - assignment is unsupported.
11319   void operator=(const RangeGenerator& other);
11320 
11321   const T begin_;
11322   const T end_;
11323   const IncrementT step_;
11324   // The index for the end() iterator. All the elements in the generated
11325   // sequence are indexed (0-based) to aid iterator comparison.
11326   const int end_index_;
11327 };  // class RangeGenerator
11328 
11329 
11330 // Generates values from a pair of STL-style iterators. Used in the
11331 // ValuesIn() function. The elements are copied from the source range
11332 // since the source can be located on the stack, and the generator
11333 // is likely to persist beyond that stack frame.
11334 template <typename T>
11335 class ValuesInIteratorRangeGenerator : public ParamGeneratorInterface<T> {
11336  public:
11337   template <typename ForwardIterator>
11338   ValuesInIteratorRangeGenerator(ForwardIterator begin, ForwardIterator end)
11339       : container_(begin, end) {}
11340   virtual ~ValuesInIteratorRangeGenerator() {}
11341 
11342   virtual ParamIteratorInterface<T>* Begin() const {
11343     return new Iterator(this, container_.begin());
11344   }
11345   virtual ParamIteratorInterface<T>* End() const {
11346     return new Iterator(this, container_.end());
11347   }
11348 
11349  private:
11350   typedef typename ::std::vector<T> ContainerType;
11351 
11352   class Iterator : public ParamIteratorInterface<T> {
11353    public:
11354     Iterator(const ParamGeneratorInterface<T>* base,
11355              typename ContainerType::const_iterator iterator)
11356         : base_(base), iterator_(iterator) {}
11357     virtual ~Iterator() {}
11358 
11359     virtual const ParamGeneratorInterface<T>* BaseGenerator() const {
11360       return base_;
11361     }
11362     virtual void Advance() {
11363       ++iterator_;
11364       value_.reset();
11365     }
11366     virtual ParamIteratorInterface<T>* Clone() const {
11367       return new Iterator(*this);
11368     }
11369     // We need to use cached value referenced by iterator_ because *iterator_
11370     // can return a temporary object (and of type other then T), so just
11371     // having "return &*iterator_;" doesn't work.
11372     // value_ is updated here and not in Advance() because Advance()
11373     // can advance iterator_ beyond the end of the range, and we cannot
11374     // detect that fact. The client code, on the other hand, is
11375     // responsible for not calling Current() on an out-of-range iterator.
11376     virtual const T* Current() const {
11377       if (value_.get() == NULL)
11378         value_.reset(new T(*iterator_));
11379       return value_.get();
11380     }
11381     virtual bool Equals(const ParamIteratorInterface<T>& other) const {
11382       // Having the same base generator guarantees that the other
11383       // iterator is of the same type and we can downcast.
11384       GTEST_CHECK_(BaseGenerator() == other.BaseGenerator())
11385           << "The program attempted to compare iterators "
11386           << "from different generators." << std::endl;
11387       return iterator_ ==
11388           CheckedDowncastToActualType<const Iterator>(&other)->iterator_;
11389     }
11390 
11391    private:
11392     Iterator(const Iterator& other)
11393           // The explicit constructor call suppresses a false warning
11394           // emitted by gcc when supplied with the -Wextra option.
11395         : ParamIteratorInterface<T>(),
11396           base_(other.base_),
11397           iterator_(other.iterator_) {}
11398 
11399     const ParamGeneratorInterface<T>* const base_;
11400     typename ContainerType::const_iterator iterator_;
11401     // A cached value of *iterator_. We keep it here to allow access by
11402     // pointer in the wrapping iterator's operator->().
11403     // value_ needs to be mutable to be accessed in Current().
11404     // Use of scoped_ptr helps manage cached value's lifetime,
11405     // which is bound by the lifespan of the iterator itself.
11406     mutable scoped_ptr<const T> value_;
11407   };  // class ValuesInIteratorRangeGenerator::Iterator
11408 
11409   // No implementation - assignment is unsupported.
11410   void operator=(const ValuesInIteratorRangeGenerator& other);
11411 
11412   const ContainerType container_;
11413 };  // class ValuesInIteratorRangeGenerator
11414 
11415 // INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.
11416 //
11417 // Default parameterized test name generator, returns a string containing the
11418 // integer test parameter index.
11419 template <class ParamType>
11420 std::string DefaultParamName(const TestParamInfo<ParamType>& info) {
11421   Message name_stream;
11422   name_stream << info.index;
11423   return name_stream.GetString();
11424 }
11425 
11426 // INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.
11427 //
11428 // Parameterized test name overload helpers, which help the
11429 // INSTANTIATE_TEST_CASE_P macro choose between the default parameterized
11430 // test name generator and user param name generator.
11431 template <class ParamType, class ParamNameGenFunctor>
11432 ParamNameGenFunctor GetParamNameGen(ParamNameGenFunctor func) {
11433   return func;
11434 }
11435 
11436 template <class ParamType>
11437 struct ParamNameGenFunc {
11438   typedef std::string Type(const TestParamInfo<ParamType>&);
11439 };
11440 
11441 template <class ParamType>
11442 typename ParamNameGenFunc<ParamType>::Type *GetParamNameGen() {
11443   return DefaultParamName;
11444 }
11445 
11446 // INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.
11447 //
11448 // Stores a parameter value and later creates tests parameterized with that
11449 // value.
11450 template <class TestClass>
11451 class ParameterizedTestFactory : public TestFactoryBase {
11452  public:
11453   typedef typename TestClass::ParamType ParamType;
11454   explicit ParameterizedTestFactory(ParamType parameter) :
11455       parameter_(parameter) {}
11456   virtual Test* CreateTest() {
11457     TestClass::SetParam(&parameter_);
11458     return new TestClass();
11459   }
11460 
11461  private:
11462   const ParamType parameter_;
11463 
11464   GTEST_DISALLOW_COPY_AND_ASSIGN_(ParameterizedTestFactory);
11465 };
11466 
11467 // INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.
11468 //
11469 // TestMetaFactoryBase is a base class for meta-factories that create
11470 // test factories for passing into MakeAndRegisterTestInfo function.
11471 template <class ParamType>
11472 class TestMetaFactoryBase {
11473  public:
11474   virtual ~TestMetaFactoryBase() {}
11475 
11476   virtual TestFactoryBase* CreateTestFactory(ParamType parameter) = 0;
11477 };
11478 
11479 // INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.
11480 //
11481 // TestMetaFactory creates test factories for passing into
11482 // MakeAndRegisterTestInfo function. Since MakeAndRegisterTestInfo receives
11483 // ownership of test factory pointer, same factory object cannot be passed
11484 // into that method twice. But ParameterizedTestCaseInfo is going to call
11485 // it for each Test/Parameter value combination. Thus it needs meta factory
11486 // creator class.
11487 template <class TestCase>
11488 class TestMetaFactory
11489     : public TestMetaFactoryBase<typename TestCase::ParamType> {
11490  public:
11491   typedef typename TestCase::ParamType ParamType;
11492 
11493   TestMetaFactory() {}
11494 
11495   virtual TestFactoryBase* CreateTestFactory(ParamType parameter) {
11496     return new ParameterizedTestFactory<TestCase>(parameter);
11497   }
11498 
11499  private:
11500   GTEST_DISALLOW_COPY_AND_ASSIGN_(TestMetaFactory);
11501 };
11502 
11503 // INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.
11504 //
11505 // ParameterizedTestCaseInfoBase is a generic interface
11506 // to ParameterizedTestCaseInfo classes. ParameterizedTestCaseInfoBase
11507 // accumulates test information provided by TEST_P macro invocations
11508 // and generators provided by INSTANTIATE_TEST_CASE_P macro invocations
11509 // and uses that information to register all resulting test instances
11510 // in RegisterTests method. The ParameterizeTestCaseRegistry class holds
11511 // a collection of pointers to the ParameterizedTestCaseInfo objects
11512 // and calls RegisterTests() on each of them when asked.
11513 class ParameterizedTestCaseInfoBase {
11514  public:
11515   virtual ~ParameterizedTestCaseInfoBase() {}
11516 
11517   // Base part of test case name for display purposes.
11518   virtual const string& GetTestCaseName() const = 0;
11519   // Test case id to verify identity.
11520   virtual TypeId GetTestCaseTypeId() const = 0;
11521   // UnitTest class invokes this method to register tests in this
11522   // test case right before running them in RUN_ALL_TESTS macro.
11523   // This method should not be called more then once on any single
11524   // instance of a ParameterizedTestCaseInfoBase derived class.
11525   virtual void RegisterTests() = 0;
11526 
11527  protected:
11528   ParameterizedTestCaseInfoBase() {}
11529 
11530  private:
11531   GTEST_DISALLOW_COPY_AND_ASSIGN_(ParameterizedTestCaseInfoBase);
11532 };
11533 
11534 // INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.
11535 //
11536 // ParameterizedTestCaseInfo accumulates tests obtained from TEST_P
11537 // macro invocations for a particular test case and generators
11538 // obtained from INSTANTIATE_TEST_CASE_P macro invocations for that
11539 // test case. It registers tests with all values generated by all
11540 // generators when asked.
11541 template <class TestCase>
11542 class ParameterizedTestCaseInfo : public ParameterizedTestCaseInfoBase {
11543  public:
11544   // ParamType and GeneratorCreationFunc are private types but are required
11545   // for declarations of public methods AddTestPattern() and
11546   // AddTestCaseInstantiation().
11547   typedef typename TestCase::ParamType ParamType;
11548   // A function that returns an instance of appropriate generator type.
11549   typedef ParamGenerator<ParamType>(GeneratorCreationFunc)();
11550   typedef typename ParamNameGenFunc<ParamType>::Type ParamNameGeneratorFunc;
11551 
11552   explicit ParameterizedTestCaseInfo(
11553       const char* name, CodeLocation code_location)
11554       : test_case_name_(name), code_location_(code_location) {}
11555 
11556   // Test case base name for display purposes.
11557   virtual const string& GetTestCaseName() const { return test_case_name_; }
11558   // Test case id to verify identity.
11559   virtual TypeId GetTestCaseTypeId() const { return GetTypeId<TestCase>(); }
11560   // TEST_P macro uses AddTestPattern() to record information
11561   // about a single test in a LocalTestInfo structure.
11562   // test_case_name is the base name of the test case (without invocation
11563   // prefix). test_base_name is the name of an individual test without
11564   // parameter index. For the test SequenceA/FooTest.DoBar/1 FooTest is
11565   // test case base name and DoBar is test base name.
11566   void AddTestPattern(const char* test_case_name,
11567                       const char* test_base_name,
11568                       TestMetaFactoryBase<ParamType>* meta_factory) {
11569     tests_.push_back(linked_ptr<TestInfo>(new TestInfo(test_case_name,
11570                                                        test_base_name,
11571                                                        meta_factory)));
11572   }
11573   // INSTANTIATE_TEST_CASE_P macro uses AddGenerator() to record information
11574   // about a generator.
11575   int AddTestCaseInstantiation(const string& instantiation_name,
11576                                GeneratorCreationFunc* func,
11577                                ParamNameGeneratorFunc* name_func,
11578                                const char* file,
11579                                int line) {
11580     instantiations_.push_back(
11581         InstantiationInfo(instantiation_name, func, name_func, file, line));
11582     return 0;  // Return value used only to run this method in namespace scope.
11583   }
11584   // UnitTest class invokes this method to register tests in this test case
11585   // test cases right before running tests in RUN_ALL_TESTS macro.
11586   // This method should not be called more then once on any single
11587   // instance of a ParameterizedTestCaseInfoBase derived class.
11588   // UnitTest has a guard to prevent from calling this method more then once.
11589   virtual void RegisterTests() {
11590     for (typename TestInfoContainer::iterator test_it = tests_.begin();
11591          test_it != tests_.end(); ++test_it) {
11592       linked_ptr<TestInfo> test_info = *test_it;
11593       for (typename InstantiationContainer::iterator gen_it =
11594                instantiations_.begin(); gen_it != instantiations_.end();
11595                ++gen_it) {
11596         const string& instantiation_name = gen_it->name;
11597         ParamGenerator<ParamType> generator((*gen_it->generator)());
11598         ParamNameGeneratorFunc* name_func = gen_it->name_func;
11599         const char* file = gen_it->file;
11600         int line = gen_it->line;
11601 
11602         string test_case_name;
11603         if ( !instantiation_name.empty() )
11604           test_case_name = instantiation_name + "/";
11605         test_case_name += test_info->test_case_base_name;
11606 
11607         size_t i = 0;
11608         std::set<std::string> test_param_names;
11609         for (typename ParamGenerator<ParamType>::iterator param_it =
11610                  generator.begin();
11611              param_it != generator.end(); ++param_it, ++i) {
11612           Message test_name_stream;
11613 
11614           std::string param_name = name_func(
11615               TestParamInfo<ParamType>(*param_it, i));
11616 
11617           GTEST_CHECK_(IsValidParamName(param_name))
11618               << "Parameterized test name '" << param_name
11619               << "' is invalid, in " << file
11620               << " line " << line << std::endl;
11621 
11622           GTEST_CHECK_(test_param_names.count(param_name) == 0)
11623               << "Duplicate parameterized test name '" << param_name
11624               << "', in " << file << " line " << line << std::endl;
11625 
11626           test_param_names.insert(param_name);
11627 
11628           test_name_stream << test_info->test_base_name << "/" << param_name;
11629           MakeAndRegisterTestInfo(
11630               test_case_name.c_str(),
11631               test_name_stream.GetString().c_str(),
11632               NULL,  // No type parameter.
11633               PrintToString(*param_it).c_str(),
11634               code_location_,
11635               GetTestCaseTypeId(),
11636               TestCase::SetUpTestCase,
11637               TestCase::TearDownTestCase,
11638               test_info->test_meta_factory->CreateTestFactory(*param_it));
11639         }  // for param_it
11640       }  // for gen_it
11641     }  // for test_it
11642   }  // RegisterTests
11643 
11644  private:
11645   // LocalTestInfo structure keeps information about a single test registered
11646   // with TEST_P macro.
11647   struct TestInfo {
11648     TestInfo(const char* a_test_case_base_name,
11649              const char* a_test_base_name,
11650              TestMetaFactoryBase<ParamType>* a_test_meta_factory) :
11651         test_case_base_name(a_test_case_base_name),
11652         test_base_name(a_test_base_name),
11653         test_meta_factory(a_test_meta_factory) {}
11654 
11655     const string test_case_base_name;
11656     const string test_base_name;
11657     const scoped_ptr<TestMetaFactoryBase<ParamType> > test_meta_factory;
11658   };
11659   typedef ::std::vector<linked_ptr<TestInfo> > TestInfoContainer;
11660   // Records data received from INSTANTIATE_TEST_CASE_P macros:
11661   //  <Instantiation name, Sequence generator creation function,
11662   //     Name generator function, Source file, Source line>
11663   struct InstantiationInfo {
11664       InstantiationInfo(const std::string &name_in,
11665                         GeneratorCreationFunc* generator_in,
11666                         ParamNameGeneratorFunc* name_func_in,
11667                         const char* file_in,
11668                         int line_in)
11669           : name(name_in),
11670             generator(generator_in),
11671             name_func(name_func_in),
11672             file(file_in),
11673             line(line_in) {}
11674 
11675       std::string name;
11676       GeneratorCreationFunc* generator;
11677       ParamNameGeneratorFunc* name_func;
11678       const char* file;
11679       int line;
11680   };
11681   typedef ::std::vector<InstantiationInfo> InstantiationContainer;
11682 
11683   static bool IsValidParamName(const std::string& name) {
11684     // Check for empty string
11685     if (name.empty())
11686       return false;
11687 
11688     // Check for invalid characters
11689     for (std::string::size_type index = 0; index < name.size(); ++index) {
11690       if (!isalnum(name[index]) && name[index] != '_')
11691         return false;
11692     }
11693 
11694     return true;
11695   }
11696 
11697   const string test_case_name_;
11698   CodeLocation code_location_;
11699   TestInfoContainer tests_;
11700   InstantiationContainer instantiations_;
11701 
11702   GTEST_DISALLOW_COPY_AND_ASSIGN_(ParameterizedTestCaseInfo);
11703 };  // class ParameterizedTestCaseInfo
11704 
11705 // INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.
11706 //
11707 // ParameterizedTestCaseRegistry contains a map of ParameterizedTestCaseInfoBase
11708 // classes accessed by test case names. TEST_P and INSTANTIATE_TEST_CASE_P
11709 // macros use it to locate their corresponding ParameterizedTestCaseInfo
11710 // descriptors.
11711 class ParameterizedTestCaseRegistry {
11712  public:
11713   ParameterizedTestCaseRegistry() {}
11714   ~ParameterizedTestCaseRegistry() {
11715     for (TestCaseInfoContainer::iterator it = test_case_infos_.begin();
11716          it != test_case_infos_.end(); ++it) {
11717       delete *it;
11718     }
11719   }
11720 
11721   // Looks up or creates and returns a structure containing information about
11722   // tests and instantiations of a particular test case.
11723   template <class TestCase>
11724   ParameterizedTestCaseInfo<TestCase>* GetTestCasePatternHolder(
11725       const char* test_case_name,
11726       CodeLocation code_location) {
11727     ParameterizedTestCaseInfo<TestCase>* typed_test_info = NULL;
11728     for (TestCaseInfoContainer::iterator it = test_case_infos_.begin();
11729          it != test_case_infos_.end(); ++it) {
11730       if ((*it)->GetTestCaseName() == test_case_name) {
11731         if ((*it)->GetTestCaseTypeId() != GetTypeId<TestCase>()) {
11732           // Complain about incorrect usage of Google Test facilities
11733           // and terminate the program since we cannot guaranty correct
11734           // test case setup and tear-down in this case.
11735           ReportInvalidTestCaseType(test_case_name, code_location);
11736           posix::Abort();
11737         } else {
11738           // At this point we are sure that the object we found is of the same
11739           // type we are looking for, so we downcast it to that type
11740           // without further checks.
11741           typed_test_info = CheckedDowncastToActualType<
11742               ParameterizedTestCaseInfo<TestCase> >(*it);
11743         }
11744         break;
11745       }
11746     }
11747     if (typed_test_info == NULL) {
11748       typed_test_info = new ParameterizedTestCaseInfo<TestCase>(
11749           test_case_name, code_location);
11750       test_case_infos_.push_back(typed_test_info);
11751     }
11752     return typed_test_info;
11753   }
11754   void RegisterTests() {
11755     for (TestCaseInfoContainer::iterator it = test_case_infos_.begin();
11756          it != test_case_infos_.end(); ++it) {
11757       (*it)->RegisterTests();
11758     }
11759   }
11760 
11761  private:
11762   typedef ::std::vector<ParameterizedTestCaseInfoBase*> TestCaseInfoContainer;
11763 
11764   TestCaseInfoContainer test_case_infos_;
11765 
11766   GTEST_DISALLOW_COPY_AND_ASSIGN_(ParameterizedTestCaseRegistry);
11767 };
11768 
11769 }  // namespace internal
11770 }  // namespace testing
11771 
11772 #endif  //  GTEST_HAS_PARAM_TEST
11773 
11774 #endif  // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PARAM_UTIL_H_
11775 // This file was GENERATED by command:
11776 //     pump.py gtest-param-util-generated.h.pump
11777 // DO NOT EDIT BY HAND!!!
11778 
11779 // Copyright 2008 Google Inc.
11780 // All Rights Reserved.
11781 //
11782 // Redistribution and use in source and binary forms, with or without
11783 // modification, are permitted provided that the following conditions are
11784 // met:
11785 //
11786 //     * Redistributions of source code must retain the above copyright
11787 // notice, this list of conditions and the following disclaimer.
11788 //     * Redistributions in binary form must reproduce the above
11789 // copyright notice, this list of conditions and the following disclaimer
11790 // in the documentation and/or other materials provided with the
11791 // distribution.
11792 //     * Neither the name of Google Inc. nor the names of its
11793 // contributors may be used to endorse or promote products derived from
11794 // this software without specific prior written permission.
11795 //
11796 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
11797 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
11798 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
11799 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
11800 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
11801 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
11802 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
11803 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
11804 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
11805 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
11806 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
11807 //
11808 // Author: vladl@google.com (Vlad Losev)
11809 
11810 // Type and function utilities for implementing parameterized tests.
11811 // This file is generated by a SCRIPT.  DO NOT EDIT BY HAND!
11812 //
11813 // Currently Google Test supports at most 50 arguments in Values,
11814 // and at most 10 arguments in Combine. Please contact
11815 // googletestframework@googlegroups.com if you need more.
11816 // Please note that the number of arguments to Combine is limited
11817 // by the maximum arity of the implementation of tuple which is
11818 // currently set at 10.
11819 
11820 #ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PARAM_UTIL_GENERATED_H_
11821 #define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PARAM_UTIL_GENERATED_H_
11822 
11823 // scripts/fuse_gtest.py depends on gtest's own header being #included
11824 // *unconditionally*.  Therefore these #includes cannot be moved
11825 // inside #if GTEST_HAS_PARAM_TEST.
11826 
11827 #if GTEST_HAS_PARAM_TEST
11828 
11829 namespace testing {
11830 
11831 // Forward declarations of ValuesIn(), which is implemented in
11832 // include/gtest/gtest-param-test.h.
11833 template <typename ForwardIterator>
11834 internal::ParamGenerator<
11835   typename ::testing::internal::IteratorTraits<ForwardIterator>::value_type>
11836 ValuesIn(ForwardIterator begin, ForwardIterator end);
11837 
11838 template <typename T, size_t N>
11839 internal::ParamGenerator<T> ValuesIn(const T (&array)[N]);
11840 
11841 template <class Container>
11842 internal::ParamGenerator<typename Container::value_type> ValuesIn(
11843     const Container& container);
11844 
11845 namespace internal {
11846 
11847 // Used in the Values() function to provide polymorphic capabilities.
11848 template <typename T1>
11849 class ValueArray1 {
11850  public:
11851   explicit ValueArray1(T1 v1) : v1_(v1) {}
11852 
11853   template <typename T>
11854   operator ParamGenerator<T>() const {
11855     const T array[] = {static_cast<T>(v1_)};
11856     return ValuesIn(array);
11857   }
11858 
11859  private:
11860   // No implementation - assignment is unsupported.
11861   void operator=(const ValueArray1& other);
11862 
11863   const T1 v1_;
11864 };
11865 
11866 template <typename T1, typename T2>
11867 class ValueArray2 {
11868  public:
11869   ValueArray2(T1 v1, T2 v2) : v1_(v1), v2_(v2) {}
11870 
11871   template <typename T>
11872   operator ParamGenerator<T>() const {
11873     const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_)};
11874     return ValuesIn(array);
11875   }
11876 
11877  private:
11878   // No implementation - assignment is unsupported.
11879   void operator=(const ValueArray2& other);
11880 
11881   const T1 v1_;
11882   const T2 v2_;
11883 };
11884 
11885 template <typename T1, typename T2, typename T3>
11886 class ValueArray3 {
11887  public:
11888   ValueArray3(T1 v1, T2 v2, T3 v3) : v1_(v1), v2_(v2), v3_(v3) {}
11889 
11890   template <typename T>
11891   operator ParamGenerator<T>() const {
11892     const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
11893         static_cast<T>(v3_)};
11894     return ValuesIn(array);
11895   }
11896 
11897  private:
11898   // No implementation - assignment is unsupported.
11899   void operator=(const ValueArray3& other);
11900 
11901   const T1 v1_;
11902   const T2 v2_;
11903   const T3 v3_;
11904 };
11905 
11906 template <typename T1, typename T2, typename T3, typename T4>
11907 class ValueArray4 {
11908  public:
11909   ValueArray4(T1 v1, T2 v2, T3 v3, T4 v4) : v1_(v1), v2_(v2), v3_(v3),
11910       v4_(v4) {}
11911 
11912   template <typename T>
11913   operator ParamGenerator<T>() const {
11914     const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
11915         static_cast<T>(v3_), static_cast<T>(v4_)};
11916     return ValuesIn(array);
11917   }
11918 
11919  private:
11920   // No implementation - assignment is unsupported.
11921   void operator=(const ValueArray4& other);
11922 
11923   const T1 v1_;
11924   const T2 v2_;
11925   const T3 v3_;
11926   const T4 v4_;
11927 };
11928 
11929 template <typename T1, typename T2, typename T3, typename T4, typename T5>
11930 class ValueArray5 {
11931  public:
11932   ValueArray5(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5) : v1_(v1), v2_(v2), v3_(v3),
11933       v4_(v4), v5_(v5) {}
11934 
11935   template <typename T>
11936   operator ParamGenerator<T>() const {
11937     const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
11938         static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_)};
11939     return ValuesIn(array);
11940   }
11941 
11942  private:
11943   // No implementation - assignment is unsupported.
11944   void operator=(const ValueArray5& other);
11945 
11946   const T1 v1_;
11947   const T2 v2_;
11948   const T3 v3_;
11949   const T4 v4_;
11950   const T5 v5_;
11951 };
11952 
11953 template <typename T1, typename T2, typename T3, typename T4, typename T5,
11954     typename T6>
11955 class ValueArray6 {
11956  public:
11957   ValueArray6(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6) : v1_(v1), v2_(v2),
11958       v3_(v3), v4_(v4), v5_(v5), v6_(v6) {}
11959 
11960   template <typename T>
11961   operator ParamGenerator<T>() const {
11962     const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
11963         static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
11964         static_cast<T>(v6_)};
11965     return ValuesIn(array);
11966   }
11967 
11968  private:
11969   // No implementation - assignment is unsupported.
11970   void operator=(const ValueArray6& other);
11971 
11972   const T1 v1_;
11973   const T2 v2_;
11974   const T3 v3_;
11975   const T4 v4_;
11976   const T5 v5_;
11977   const T6 v6_;
11978 };
11979 
11980 template <typename T1, typename T2, typename T3, typename T4, typename T5,
11981     typename T6, typename T7>
11982 class ValueArray7 {
11983  public:
11984   ValueArray7(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7) : v1_(v1),
11985       v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7) {}
11986 
11987   template <typename T>
11988   operator ParamGenerator<T>() const {
11989     const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
11990         static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
11991         static_cast<T>(v6_), static_cast<T>(v7_)};
11992     return ValuesIn(array);
11993   }
11994 
11995  private:
11996   // No implementation - assignment is unsupported.
11997   void operator=(const ValueArray7& other);
11998 
11999   const T1 v1_;
12000   const T2 v2_;
12001   const T3 v3_;
12002   const T4 v4_;
12003   const T5 v5_;
12004   const T6 v6_;
12005   const T7 v7_;
12006 };
12007 
12008 template <typename T1, typename T2, typename T3, typename T4, typename T5,
12009     typename T6, typename T7, typename T8>
12010 class ValueArray8 {
12011  public:
12012   ValueArray8(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7,
12013       T8 v8) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7),
12014       v8_(v8) {}
12015 
12016   template <typename T>
12017   operator ParamGenerator<T>() const {
12018     const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
12019         static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
12020         static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_)};
12021     return ValuesIn(array);
12022   }
12023 
12024  private:
12025   // No implementation - assignment is unsupported.
12026   void operator=(const ValueArray8& other);
12027 
12028   const T1 v1_;
12029   const T2 v2_;
12030   const T3 v3_;
12031   const T4 v4_;
12032   const T5 v5_;
12033   const T6 v6_;
12034   const T7 v7_;
12035   const T8 v8_;
12036 };
12037 
12038 template <typename T1, typename T2, typename T3, typename T4, typename T5,
12039     typename T6, typename T7, typename T8, typename T9>
12040 class ValueArray9 {
12041  public:
12042   ValueArray9(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8,
12043       T9 v9) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7),
12044       v8_(v8), v9_(v9) {}
12045 
12046   template <typename T>
12047   operator ParamGenerator<T>() const {
12048     const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
12049         static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
12050         static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
12051         static_cast<T>(v9_)};
12052     return ValuesIn(array);
12053   }
12054 
12055  private:
12056   // No implementation - assignment is unsupported.
12057   void operator=(const ValueArray9& other);
12058 
12059   const T1 v1_;
12060   const T2 v2_;
12061   const T3 v3_;
12062   const T4 v4_;
12063   const T5 v5_;
12064   const T6 v6_;
12065   const T7 v7_;
12066   const T8 v8_;
12067   const T9 v9_;
12068 };
12069 
12070 template <typename T1, typename T2, typename T3, typename T4, typename T5,
12071     typename T6, typename T7, typename T8, typename T9, typename T10>
12072 class ValueArray10 {
12073  public:
12074   ValueArray10(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
12075       T10 v10) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7),
12076       v8_(v8), v9_(v9), v10_(v10) {}
12077 
12078   template <typename T>
12079   operator ParamGenerator<T>() const {
12080     const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
12081         static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
12082         static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
12083         static_cast<T>(v9_), static_cast<T>(v10_)};
12084     return ValuesIn(array);
12085   }
12086 
12087  private:
12088   // No implementation - assignment is unsupported.
12089   void operator=(const ValueArray10& other);
12090 
12091   const T1 v1_;
12092   const T2 v2_;
12093   const T3 v3_;
12094   const T4 v4_;
12095   const T5 v5_;
12096   const T6 v6_;
12097   const T7 v7_;
12098   const T8 v8_;
12099   const T9 v9_;
12100   const T10 v10_;
12101 };
12102 
12103 template <typename T1, typename T2, typename T3, typename T4, typename T5,
12104     typename T6, typename T7, typename T8, typename T9, typename T10,
12105     typename T11>
12106 class ValueArray11 {
12107  public:
12108   ValueArray11(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
12109       T10 v10, T11 v11) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6),
12110       v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11) {}
12111 
12112   template <typename T>
12113   operator ParamGenerator<T>() const {
12114     const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
12115         static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
12116         static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
12117         static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_)};
12118     return ValuesIn(array);
12119   }
12120 
12121  private:
12122   // No implementation - assignment is unsupported.
12123   void operator=(const ValueArray11& other);
12124 
12125   const T1 v1_;
12126   const T2 v2_;
12127   const T3 v3_;
12128   const T4 v4_;
12129   const T5 v5_;
12130   const T6 v6_;
12131   const T7 v7_;
12132   const T8 v8_;
12133   const T9 v9_;
12134   const T10 v10_;
12135   const T11 v11_;
12136 };
12137 
12138 template <typename T1, typename T2, typename T3, typename T4, typename T5,
12139     typename T6, typename T7, typename T8, typename T9, typename T10,
12140     typename T11, typename T12>
12141 class ValueArray12 {
12142  public:
12143   ValueArray12(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
12144       T10 v10, T11 v11, T12 v12) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5),
12145       v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12) {}
12146 
12147   template <typename T>
12148   operator ParamGenerator<T>() const {
12149     const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
12150         static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
12151         static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
12152         static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
12153         static_cast<T>(v12_)};
12154     return ValuesIn(array);
12155   }
12156 
12157  private:
12158   // No implementation - assignment is unsupported.
12159   void operator=(const ValueArray12& other);
12160 
12161   const T1 v1_;
12162   const T2 v2_;
12163   const T3 v3_;
12164   const T4 v4_;
12165   const T5 v5_;
12166   const T6 v6_;
12167   const T7 v7_;
12168   const T8 v8_;
12169   const T9 v9_;
12170   const T10 v10_;
12171   const T11 v11_;
12172   const T12 v12_;
12173 };
12174 
12175 template <typename T1, typename T2, typename T3, typename T4, typename T5,
12176     typename T6, typename T7, typename T8, typename T9, typename T10,
12177     typename T11, typename T12, typename T13>
12178 class ValueArray13 {
12179  public:
12180   ValueArray13(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
12181       T10 v10, T11 v11, T12 v12, T13 v13) : v1_(v1), v2_(v2), v3_(v3), v4_(v4),
12182       v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11),
12183       v12_(v12), v13_(v13) {}
12184 
12185   template <typename T>
12186   operator ParamGenerator<T>() const {
12187     const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
12188         static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
12189         static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
12190         static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
12191         static_cast<T>(v12_), static_cast<T>(v13_)};
12192     return ValuesIn(array);
12193   }
12194 
12195  private:
12196   // No implementation - assignment is unsupported.
12197   void operator=(const ValueArray13& other);
12198 
12199   const T1 v1_;
12200   const T2 v2_;
12201   const T3 v3_;
12202   const T4 v4_;
12203   const T5 v5_;
12204   const T6 v6_;
12205   const T7 v7_;
12206   const T8 v8_;
12207   const T9 v9_;
12208   const T10 v10_;
12209   const T11 v11_;
12210   const T12 v12_;
12211   const T13 v13_;
12212 };
12213 
12214 template <typename T1, typename T2, typename T3, typename T4, typename T5,
12215     typename T6, typename T7, typename T8, typename T9, typename T10,
12216     typename T11, typename T12, typename T13, typename T14>
12217 class ValueArray14 {
12218  public:
12219   ValueArray14(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
12220       T10 v10, T11 v11, T12 v12, T13 v13, T14 v14) : v1_(v1), v2_(v2), v3_(v3),
12221       v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10),
12222       v11_(v11), v12_(v12), v13_(v13), v14_(v14) {}
12223 
12224   template <typename T>
12225   operator ParamGenerator<T>() const {
12226     const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
12227         static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
12228         static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
12229         static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
12230         static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_)};
12231     return ValuesIn(array);
12232   }
12233 
12234  private:
12235   // No implementation - assignment is unsupported.
12236   void operator=(const ValueArray14& other);
12237 
12238   const T1 v1_;
12239   const T2 v2_;
12240   const T3 v3_;
12241   const T4 v4_;
12242   const T5 v5_;
12243   const T6 v6_;
12244   const T7 v7_;
12245   const T8 v8_;
12246   const T9 v9_;
12247   const T10 v10_;
12248   const T11 v11_;
12249   const T12 v12_;
12250   const T13 v13_;
12251   const T14 v14_;
12252 };
12253 
12254 template <typename T1, typename T2, typename T3, typename T4, typename T5,
12255     typename T6, typename T7, typename T8, typename T9, typename T10,
12256     typename T11, typename T12, typename T13, typename T14, typename T15>
12257 class ValueArray15 {
12258  public:
12259   ValueArray15(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
12260       T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15) : v1_(v1), v2_(v2),
12261       v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10),
12262       v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15) {}
12263 
12264   template <typename T>
12265   operator ParamGenerator<T>() const {
12266     const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
12267         static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
12268         static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
12269         static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
12270         static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
12271         static_cast<T>(v15_)};
12272     return ValuesIn(array);
12273   }
12274 
12275  private:
12276   // No implementation - assignment is unsupported.
12277   void operator=(const ValueArray15& other);
12278 
12279   const T1 v1_;
12280   const T2 v2_;
12281   const T3 v3_;
12282   const T4 v4_;
12283   const T5 v5_;
12284   const T6 v6_;
12285   const T7 v7_;
12286   const T8 v8_;
12287   const T9 v9_;
12288   const T10 v10_;
12289   const T11 v11_;
12290   const T12 v12_;
12291   const T13 v13_;
12292   const T14 v14_;
12293   const T15 v15_;
12294 };
12295 
12296 template <typename T1, typename T2, typename T3, typename T4, typename T5,
12297     typename T6, typename T7, typename T8, typename T9, typename T10,
12298     typename T11, typename T12, typename T13, typename T14, typename T15,
12299     typename T16>
12300 class ValueArray16 {
12301  public:
12302   ValueArray16(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
12303       T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16) : v1_(v1),
12304       v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9),
12305       v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15),
12306       v16_(v16) {}
12307 
12308   template <typename T>
12309   operator ParamGenerator<T>() const {
12310     const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
12311         static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
12312         static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
12313         static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
12314         static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
12315         static_cast<T>(v15_), static_cast<T>(v16_)};
12316     return ValuesIn(array);
12317   }
12318 
12319  private:
12320   // No implementation - assignment is unsupported.
12321   void operator=(const ValueArray16& other);
12322 
12323   const T1 v1_;
12324   const T2 v2_;
12325   const T3 v3_;
12326   const T4 v4_;
12327   const T5 v5_;
12328   const T6 v6_;
12329   const T7 v7_;
12330   const T8 v8_;
12331   const T9 v9_;
12332   const T10 v10_;
12333   const T11 v11_;
12334   const T12 v12_;
12335   const T13 v13_;
12336   const T14 v14_;
12337   const T15 v15_;
12338   const T16 v16_;
12339 };
12340 
12341 template <typename T1, typename T2, typename T3, typename T4, typename T5,
12342     typename T6, typename T7, typename T8, typename T9, typename T10,
12343     typename T11, typename T12, typename T13, typename T14, typename T15,
12344     typename T16, typename T17>
12345 class ValueArray17 {
12346  public:
12347   ValueArray17(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
12348       T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16,
12349       T17 v17) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7),
12350       v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v14),
12351       v15_(v15), v16_(v16), v17_(v17) {}
12352 
12353   template <typename T>
12354   operator ParamGenerator<T>() const {
12355     const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
12356         static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
12357         static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
12358         static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
12359         static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
12360         static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_)};
12361     return ValuesIn(array);
12362   }
12363 
12364  private:
12365   // No implementation - assignment is unsupported.
12366   void operator=(const ValueArray17& other);
12367 
12368   const T1 v1_;
12369   const T2 v2_;
12370   const T3 v3_;
12371   const T4 v4_;
12372   const T5 v5_;
12373   const T6 v6_;
12374   const T7 v7_;
12375   const T8 v8_;
12376   const T9 v9_;
12377   const T10 v10_;
12378   const T11 v11_;
12379   const T12 v12_;
12380   const T13 v13_;
12381   const T14 v14_;
12382   const T15 v15_;
12383   const T16 v16_;
12384   const T17 v17_;
12385 };
12386 
12387 template <typename T1, typename T2, typename T3, typename T4, typename T5,
12388     typename T6, typename T7, typename T8, typename T9, typename T10,
12389     typename T11, typename T12, typename T13, typename T14, typename T15,
12390     typename T16, typename T17, typename T18>
12391 class ValueArray18 {
12392  public:
12393   ValueArray18(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
12394       T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
12395       T18 v18) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7),
12396       v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v14),
12397       v15_(v15), v16_(v16), v17_(v17), v18_(v18) {}
12398 
12399   template <typename T>
12400   operator ParamGenerator<T>() const {
12401     const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
12402         static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
12403         static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
12404         static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
12405         static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
12406         static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
12407         static_cast<T>(v18_)};
12408     return ValuesIn(array);
12409   }
12410 
12411  private:
12412   // No implementation - assignment is unsupported.
12413   void operator=(const ValueArray18& other);
12414 
12415   const T1 v1_;
12416   const T2 v2_;
12417   const T3 v3_;
12418   const T4 v4_;
12419   const T5 v5_;
12420   const T6 v6_;
12421   const T7 v7_;
12422   const T8 v8_;
12423   const T9 v9_;
12424   const T10 v10_;
12425   const T11 v11_;
12426   const T12 v12_;
12427   const T13 v13_;
12428   const T14 v14_;
12429   const T15 v15_;
12430   const T16 v16_;
12431   const T17 v17_;
12432   const T18 v18_;
12433 };
12434 
12435 template <typename T1, typename T2, typename T3, typename T4, typename T5,
12436     typename T6, typename T7, typename T8, typename T9, typename T10,
12437     typename T11, typename T12, typename T13, typename T14, typename T15,
12438     typename T16, typename T17, typename T18, typename T19>
12439 class ValueArray19 {
12440  public:
12441   ValueArray19(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
12442       T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
12443       T18 v18, T19 v19) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6),
12444       v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13),
12445       v14_(v14), v15_(v15), v16_(v16), v17_(v17), v18_(v18), v19_(v19) {}
12446 
12447   template <typename T>
12448   operator ParamGenerator<T>() const {
12449     const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
12450         static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
12451         static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
12452         static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
12453         static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
12454         static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
12455         static_cast<T>(v18_), static_cast<T>(v19_)};
12456     return ValuesIn(array);
12457   }
12458 
12459  private:
12460   // No implementation - assignment is unsupported.
12461   void operator=(const ValueArray19& other);
12462 
12463   const T1 v1_;
12464   const T2 v2_;
12465   const T3 v3_;
12466   const T4 v4_;
12467   const T5 v5_;
12468   const T6 v6_;
12469   const T7 v7_;
12470   const T8 v8_;
12471   const T9 v9_;
12472   const T10 v10_;
12473   const T11 v11_;
12474   const T12 v12_;
12475   const T13 v13_;
12476   const T14 v14_;
12477   const T15 v15_;
12478   const T16 v16_;
12479   const T17 v17_;
12480   const T18 v18_;
12481   const T19 v19_;
12482 };
12483 
12484 template <typename T1, typename T2, typename T3, typename T4, typename T5,
12485     typename T6, typename T7, typename T8, typename T9, typename T10,
12486     typename T11, typename T12, typename T13, typename T14, typename T15,
12487     typename T16, typename T17, typename T18, typename T19, typename T20>
12488 class ValueArray20 {
12489  public:
12490   ValueArray20(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
12491       T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
12492       T18 v18, T19 v19, T20 v20) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5),
12493       v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12),
12494       v13_(v13), v14_(v14), v15_(v15), v16_(v16), v17_(v17), v18_(v18),
12495       v19_(v19), v20_(v20) {}
12496 
12497   template <typename T>
12498   operator ParamGenerator<T>() const {
12499     const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
12500         static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
12501         static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
12502         static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
12503         static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
12504         static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
12505         static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_)};
12506     return ValuesIn(array);
12507   }
12508 
12509  private:
12510   // No implementation - assignment is unsupported.
12511   void operator=(const ValueArray20& other);
12512 
12513   const T1 v1_;
12514   const T2 v2_;
12515   const T3 v3_;
12516   const T4 v4_;
12517   const T5 v5_;
12518   const T6 v6_;
12519   const T7 v7_;
12520   const T8 v8_;
12521   const T9 v9_;
12522   const T10 v10_;
12523   const T11 v11_;
12524   const T12 v12_;
12525   const T13 v13_;
12526   const T14 v14_;
12527   const T15 v15_;
12528   const T16 v16_;
12529   const T17 v17_;
12530   const T18 v18_;
12531   const T19 v19_;
12532   const T20 v20_;
12533 };
12534 
12535 template <typename T1, typename T2, typename T3, typename T4, typename T5,
12536     typename T6, typename T7, typename T8, typename T9, typename T10,
12537     typename T11, typename T12, typename T13, typename T14, typename T15,
12538     typename T16, typename T17, typename T18, typename T19, typename T20,
12539     typename T21>
12540 class ValueArray21 {
12541  public:
12542   ValueArray21(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
12543       T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
12544       T18 v18, T19 v19, T20 v20, T21 v21) : v1_(v1), v2_(v2), v3_(v3), v4_(v4),
12545       v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11),
12546       v12_(v12), v13_(v13), v14_(v14), v15_(v15), v16_(v16), v17_(v17),
12547       v18_(v18), v19_(v19), v20_(v20), v21_(v21) {}
12548 
12549   template <typename T>
12550   operator ParamGenerator<T>() const {
12551     const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
12552         static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
12553         static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
12554         static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
12555         static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
12556         static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
12557         static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
12558         static_cast<T>(v21_)};
12559     return ValuesIn(array);
12560   }
12561 
12562  private:
12563   // No implementation - assignment is unsupported.
12564   void operator=(const ValueArray21& other);
12565 
12566   const T1 v1_;
12567   const T2 v2_;
12568   const T3 v3_;
12569   const T4 v4_;
12570   const T5 v5_;
12571   const T6 v6_;
12572   const T7 v7_;
12573   const T8 v8_;
12574   const T9 v9_;
12575   const T10 v10_;
12576   const T11 v11_;
12577   const T12 v12_;
12578   const T13 v13_;
12579   const T14 v14_;
12580   const T15 v15_;
12581   const T16 v16_;
12582   const T17 v17_;
12583   const T18 v18_;
12584   const T19 v19_;
12585   const T20 v20_;
12586   const T21 v21_;
12587 };
12588 
12589 template <typename T1, typename T2, typename T3, typename T4, typename T5,
12590     typename T6, typename T7, typename T8, typename T9, typename T10,
12591     typename T11, typename T12, typename T13, typename T14, typename T15,
12592     typename T16, typename T17, typename T18, typename T19, typename T20,
12593     typename T21, typename T22>
12594 class ValueArray22 {
12595  public:
12596   ValueArray22(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
12597       T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
12598       T18 v18, T19 v19, T20 v20, T21 v21, T22 v22) : v1_(v1), v2_(v2), v3_(v3),
12599       v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10),
12600       v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15), v16_(v16),
12601       v17_(v17), v18_(v18), v19_(v19), v20_(v20), v21_(v21), v22_(v22) {}
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_)};
12613     return ValuesIn(array);
12614   }
12615 
12616  private:
12617   // No implementation - assignment is unsupported.
12618   void operator=(const ValueArray22& other);
12619 
12620   const T1 v1_;
12621   const T2 v2_;
12622   const T3 v3_;
12623   const T4 v4_;
12624   const T5 v5_;
12625   const T6 v6_;
12626   const T7 v7_;
12627   const T8 v8_;
12628   const T9 v9_;
12629   const T10 v10_;
12630   const T11 v11_;
12631   const T12 v12_;
12632   const T13 v13_;
12633   const T14 v14_;
12634   const T15 v15_;
12635   const T16 v16_;
12636   const T17 v17_;
12637   const T18 v18_;
12638   const T19 v19_;
12639   const T20 v20_;
12640   const T21 v21_;
12641   const T22 v22_;
12642 };
12643 
12644 template <typename T1, typename T2, typename T3, typename T4, typename T5,
12645     typename T6, typename T7, typename T8, typename T9, typename T10,
12646     typename T11, typename T12, typename T13, typename T14, typename T15,
12647     typename T16, typename T17, typename T18, typename T19, typename T20,
12648     typename T21, typename T22, typename T23>
12649 class ValueArray23 {
12650  public:
12651   ValueArray23(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
12652       T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
12653       T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23) : v1_(v1), v2_(v2),
12654       v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10),
12655       v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15), v16_(v16),
12656       v17_(v17), v18_(v18), v19_(v19), v20_(v20), v21_(v21), v22_(v22),
12657       v23_(v23) {}
12658 
12659   template <typename T>
12660   operator ParamGenerator<T>() const {
12661     const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
12662         static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
12663         static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
12664         static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
12665         static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
12666         static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
12667         static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
12668         static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_)};
12669     return ValuesIn(array);
12670   }
12671 
12672  private:
12673   // No implementation - assignment is unsupported.
12674   void operator=(const ValueArray23& other);
12675 
12676   const T1 v1_;
12677   const T2 v2_;
12678   const T3 v3_;
12679   const T4 v4_;
12680   const T5 v5_;
12681   const T6 v6_;
12682   const T7 v7_;
12683   const T8 v8_;
12684   const T9 v9_;
12685   const T10 v10_;
12686   const T11 v11_;
12687   const T12 v12_;
12688   const T13 v13_;
12689   const T14 v14_;
12690   const T15 v15_;
12691   const T16 v16_;
12692   const T17 v17_;
12693   const T18 v18_;
12694   const T19 v19_;
12695   const T20 v20_;
12696   const T21 v21_;
12697   const T22 v22_;
12698   const T23 v23_;
12699 };
12700 
12701 template <typename T1, typename T2, typename T3, typename T4, typename T5,
12702     typename T6, typename T7, typename T8, typename T9, typename T10,
12703     typename T11, typename T12, typename T13, typename T14, typename T15,
12704     typename T16, typename T17, typename T18, typename T19, typename T20,
12705     typename T21, typename T22, typename T23, typename T24>
12706 class ValueArray24 {
12707  public:
12708   ValueArray24(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
12709       T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
12710       T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24) : v1_(v1),
12711       v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9),
12712       v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15),
12713       v16_(v16), v17_(v17), v18_(v18), v19_(v19), v20_(v20), v21_(v21),
12714       v22_(v22), v23_(v23), v24_(v24) {}
12715 
12716   template <typename T>
12717   operator ParamGenerator<T>() const {
12718     const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
12719         static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
12720         static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
12721         static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
12722         static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
12723         static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
12724         static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
12725         static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
12726         static_cast<T>(v24_)};
12727     return ValuesIn(array);
12728   }
12729 
12730  private:
12731   // No implementation - assignment is unsupported.
12732   void operator=(const ValueArray24& other);
12733 
12734   const T1 v1_;
12735   const T2 v2_;
12736   const T3 v3_;
12737   const T4 v4_;
12738   const T5 v5_;
12739   const T6 v6_;
12740   const T7 v7_;
12741   const T8 v8_;
12742   const T9 v9_;
12743   const T10 v10_;
12744   const T11 v11_;
12745   const T12 v12_;
12746   const T13 v13_;
12747   const T14 v14_;
12748   const T15 v15_;
12749   const T16 v16_;
12750   const T17 v17_;
12751   const T18 v18_;
12752   const T19 v19_;
12753   const T20 v20_;
12754   const T21 v21_;
12755   const T22 v22_;
12756   const T23 v23_;
12757   const T24 v24_;
12758 };
12759 
12760 template <typename T1, typename T2, typename T3, typename T4, typename T5,
12761     typename T6, typename T7, typename T8, typename T9, typename T10,
12762     typename T11, typename T12, typename T13, typename T14, typename T15,
12763     typename T16, typename T17, typename T18, typename T19, typename T20,
12764     typename T21, typename T22, typename T23, typename T24, typename T25>
12765 class ValueArray25 {
12766  public:
12767   ValueArray25(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
12768       T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
12769       T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24,
12770       T25 v25) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7),
12771       v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v14),
12772       v15_(v15), v16_(v16), v17_(v17), v18_(v18), v19_(v19), v20_(v20),
12773       v21_(v21), v22_(v22), v23_(v23), v24_(v24), v25_(v25) {}
12774 
12775   template <typename T>
12776   operator ParamGenerator<T>() const {
12777     const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
12778         static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
12779         static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
12780         static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
12781         static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
12782         static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
12783         static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
12784         static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
12785         static_cast<T>(v24_), static_cast<T>(v25_)};
12786     return ValuesIn(array);
12787   }
12788 
12789  private:
12790   // No implementation - assignment is unsupported.
12791   void operator=(const ValueArray25& other);
12792 
12793   const T1 v1_;
12794   const T2 v2_;
12795   const T3 v3_;
12796   const T4 v4_;
12797   const T5 v5_;
12798   const T6 v6_;
12799   const T7 v7_;
12800   const T8 v8_;
12801   const T9 v9_;
12802   const T10 v10_;
12803   const T11 v11_;
12804   const T12 v12_;
12805   const T13 v13_;
12806   const T14 v14_;
12807   const T15 v15_;
12808   const T16 v16_;
12809   const T17 v17_;
12810   const T18 v18_;
12811   const T19 v19_;
12812   const T20 v20_;
12813   const T21 v21_;
12814   const T22 v22_;
12815   const T23 v23_;
12816   const T24 v24_;
12817   const T25 v25_;
12818 };
12819 
12820 template <typename T1, typename T2, typename T3, typename T4, typename T5,
12821     typename T6, typename T7, typename T8, typename T9, typename T10,
12822     typename T11, typename T12, typename T13, typename T14, typename T15,
12823     typename T16, typename T17, typename T18, typename T19, typename T20,
12824     typename T21, typename T22, typename T23, typename T24, typename T25,
12825     typename T26>
12826 class ValueArray26 {
12827  public:
12828   ValueArray26(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
12829       T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
12830       T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
12831       T26 v26) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7),
12832       v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v14),
12833       v15_(v15), v16_(v16), v17_(v17), v18_(v18), v19_(v19), v20_(v20),
12834       v21_(v21), v22_(v22), v23_(v23), v24_(v24), v25_(v25), v26_(v26) {}
12835 
12836   template <typename T>
12837   operator ParamGenerator<T>() const {
12838     const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
12839         static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
12840         static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
12841         static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
12842         static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
12843         static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
12844         static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
12845         static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
12846         static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_)};
12847     return ValuesIn(array);
12848   }
12849 
12850  private:
12851   // No implementation - assignment is unsupported.
12852   void operator=(const ValueArray26& other);
12853 
12854   const T1 v1_;
12855   const T2 v2_;
12856   const T3 v3_;
12857   const T4 v4_;
12858   const T5 v5_;
12859   const T6 v6_;
12860   const T7 v7_;
12861   const T8 v8_;
12862   const T9 v9_;
12863   const T10 v10_;
12864   const T11 v11_;
12865   const T12 v12_;
12866   const T13 v13_;
12867   const T14 v14_;
12868   const T15 v15_;
12869   const T16 v16_;
12870   const T17 v17_;
12871   const T18 v18_;
12872   const T19 v19_;
12873   const T20 v20_;
12874   const T21 v21_;
12875   const T22 v22_;
12876   const T23 v23_;
12877   const T24 v24_;
12878   const T25 v25_;
12879   const T26 v26_;
12880 };
12881 
12882 template <typename T1, typename T2, typename T3, typename T4, typename T5,
12883     typename T6, typename T7, typename T8, typename T9, typename T10,
12884     typename T11, typename T12, typename T13, typename T14, typename T15,
12885     typename T16, typename T17, typename T18, typename T19, typename T20,
12886     typename T21, typename T22, typename T23, typename T24, typename T25,
12887     typename T26, typename T27>
12888 class ValueArray27 {
12889  public:
12890   ValueArray27(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
12891       T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
12892       T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
12893       T26 v26, T27 v27) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6),
12894       v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13),
12895       v14_(v14), v15_(v15), v16_(v16), v17_(v17), v18_(v18), v19_(v19),
12896       v20_(v20), v21_(v21), v22_(v22), v23_(v23), v24_(v24), v25_(v25),
12897       v26_(v26), v27_(v27) {}
12898 
12899   template <typename T>
12900   operator ParamGenerator<T>() const {
12901     const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
12902         static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
12903         static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
12904         static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
12905         static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
12906         static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
12907         static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
12908         static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
12909         static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),
12910         static_cast<T>(v27_)};
12911     return ValuesIn(array);
12912   }
12913 
12914  private:
12915   // No implementation - assignment is unsupported.
12916   void operator=(const ValueArray27& other);
12917 
12918   const T1 v1_;
12919   const T2 v2_;
12920   const T3 v3_;
12921   const T4 v4_;
12922   const T5 v5_;
12923   const T6 v6_;
12924   const T7 v7_;
12925   const T8 v8_;
12926   const T9 v9_;
12927   const T10 v10_;
12928   const T11 v11_;
12929   const T12 v12_;
12930   const T13 v13_;
12931   const T14 v14_;
12932   const T15 v15_;
12933   const T16 v16_;
12934   const T17 v17_;
12935   const T18 v18_;
12936   const T19 v19_;
12937   const T20 v20_;
12938   const T21 v21_;
12939   const T22 v22_;
12940   const T23 v23_;
12941   const T24 v24_;
12942   const T25 v25_;
12943   const T26 v26_;
12944   const T27 v27_;
12945 };
12946 
12947 template <typename T1, typename T2, typename T3, typename T4, typename T5,
12948     typename T6, typename T7, typename T8, typename T9, typename T10,
12949     typename T11, typename T12, typename T13, typename T14, typename T15,
12950     typename T16, typename T17, typename T18, typename T19, typename T20,
12951     typename T21, typename T22, typename T23, typename T24, typename T25,
12952     typename T26, typename T27, typename T28>
12953 class ValueArray28 {
12954  public:
12955   ValueArray28(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
12956       T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
12957       T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
12958       T26 v26, T27 v27, T28 v28) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5),
12959       v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12),
12960       v13_(v13), v14_(v14), v15_(v15), v16_(v16), v17_(v17), v18_(v18),
12961       v19_(v19), v20_(v20), v21_(v21), v22_(v22), v23_(v23), v24_(v24),
12962       v25_(v25), v26_(v26), v27_(v27), v28_(v28) {}
12963 
12964   template <typename T>
12965   operator ParamGenerator<T>() const {
12966     const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
12967         static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
12968         static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
12969         static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
12970         static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
12971         static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
12972         static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
12973         static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
12974         static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),
12975         static_cast<T>(v27_), static_cast<T>(v28_)};
12976     return ValuesIn(array);
12977   }
12978 
12979  private:
12980   // No implementation - assignment is unsupported.
12981   void operator=(const ValueArray28& other);
12982 
12983   const T1 v1_;
12984   const T2 v2_;
12985   const T3 v3_;
12986   const T4 v4_;
12987   const T5 v5_;
12988   const T6 v6_;
12989   const T7 v7_;
12990   const T8 v8_;
12991   const T9 v9_;
12992   const T10 v10_;
12993   const T11 v11_;
12994   const T12 v12_;
12995   const T13 v13_;
12996   const T14 v14_;
12997   const T15 v15_;
12998   const T16 v16_;
12999   const T17 v17_;
13000   const T18 v18_;
13001   const T19 v19_;
13002   const T20 v20_;
13003   const T21 v21_;
13004   const T22 v22_;
13005   const T23 v23_;
13006   const T24 v24_;
13007   const T25 v25_;
13008   const T26 v26_;
13009   const T27 v27_;
13010   const T28 v28_;
13011 };
13012 
13013 template <typename T1, typename T2, typename T3, typename T4, typename T5,
13014     typename T6, typename T7, typename T8, typename T9, typename T10,
13015     typename T11, typename T12, typename T13, typename T14, typename T15,
13016     typename T16, typename T17, typename T18, typename T19, typename T20,
13017     typename T21, typename T22, typename T23, typename T24, typename T25,
13018     typename T26, typename T27, typename T28, typename T29>
13019 class ValueArray29 {
13020  public:
13021   ValueArray29(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
13022       T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
13023       T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
13024       T26 v26, T27 v27, T28 v28, T29 v29) : v1_(v1), v2_(v2), v3_(v3), v4_(v4),
13025       v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11),
13026       v12_(v12), v13_(v13), v14_(v14), v15_(v15), v16_(v16), v17_(v17),
13027       v18_(v18), v19_(v19), v20_(v20), v21_(v21), v22_(v22), v23_(v23),
13028       v24_(v24), v25_(v25), v26_(v26), v27_(v27), v28_(v28), v29_(v29) {}
13029 
13030   template <typename T>
13031   operator ParamGenerator<T>() const {
13032     const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
13033         static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
13034         static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
13035         static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
13036         static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
13037         static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
13038         static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
13039         static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
13040         static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),
13041         static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_)};
13042     return ValuesIn(array);
13043   }
13044 
13045  private:
13046   // No implementation - assignment is unsupported.
13047   void operator=(const ValueArray29& other);
13048 
13049   const T1 v1_;
13050   const T2 v2_;
13051   const T3 v3_;
13052   const T4 v4_;
13053   const T5 v5_;
13054   const T6 v6_;
13055   const T7 v7_;
13056   const T8 v8_;
13057   const T9 v9_;
13058   const T10 v10_;
13059   const T11 v11_;
13060   const T12 v12_;
13061   const T13 v13_;
13062   const T14 v14_;
13063   const T15 v15_;
13064   const T16 v16_;
13065   const T17 v17_;
13066   const T18 v18_;
13067   const T19 v19_;
13068   const T20 v20_;
13069   const T21 v21_;
13070   const T22 v22_;
13071   const T23 v23_;
13072   const T24 v24_;
13073   const T25 v25_;
13074   const T26 v26_;
13075   const T27 v27_;
13076   const T28 v28_;
13077   const T29 v29_;
13078 };
13079 
13080 template <typename T1, typename T2, typename T3, typename T4, typename T5,
13081     typename T6, typename T7, typename T8, typename T9, typename T10,
13082     typename T11, typename T12, typename T13, typename T14, typename T15,
13083     typename T16, typename T17, typename T18, typename T19, typename T20,
13084     typename T21, typename T22, typename T23, typename T24, typename T25,
13085     typename T26, typename T27, typename T28, typename T29, typename T30>
13086 class ValueArray30 {
13087  public:
13088   ValueArray30(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
13089       T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
13090       T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
13091       T26 v26, T27 v27, T28 v28, T29 v29, T30 v30) : v1_(v1), v2_(v2), v3_(v3),
13092       v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10),
13093       v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15), v16_(v16),
13094       v17_(v17), v18_(v18), v19_(v19), v20_(v20), v21_(v21), v22_(v22),
13095       v23_(v23), v24_(v24), v25_(v25), v26_(v26), v27_(v27), v28_(v28),
13096       v29_(v29), v30_(v30) {}
13097 
13098   template <typename T>
13099   operator ParamGenerator<T>() const {
13100     const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
13101         static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
13102         static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
13103         static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
13104         static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
13105         static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
13106         static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
13107         static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
13108         static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),
13109         static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_),
13110         static_cast<T>(v30_)};
13111     return ValuesIn(array);
13112   }
13113 
13114  private:
13115   // No implementation - assignment is unsupported.
13116   void operator=(const ValueArray30& other);
13117 
13118   const T1 v1_;
13119   const T2 v2_;
13120   const T3 v3_;
13121   const T4 v4_;
13122   const T5 v5_;
13123   const T6 v6_;
13124   const T7 v7_;
13125   const T8 v8_;
13126   const T9 v9_;
13127   const T10 v10_;
13128   const T11 v11_;
13129   const T12 v12_;
13130   const T13 v13_;
13131   const T14 v14_;
13132   const T15 v15_;
13133   const T16 v16_;
13134   const T17 v17_;
13135   const T18 v18_;
13136   const T19 v19_;
13137   const T20 v20_;
13138   const T21 v21_;
13139   const T22 v22_;
13140   const T23 v23_;
13141   const T24 v24_;
13142   const T25 v25_;
13143   const T26 v26_;
13144   const T27 v27_;
13145   const T28 v28_;
13146   const T29 v29_;
13147   const T30 v30_;
13148 };
13149 
13150 template <typename T1, typename T2, typename T3, typename T4, typename T5,
13151     typename T6, typename T7, typename T8, typename T9, typename T10,
13152     typename T11, typename T12, typename T13, typename T14, typename T15,
13153     typename T16, typename T17, typename T18, typename T19, typename T20,
13154     typename T21, typename T22, typename T23, typename T24, typename T25,
13155     typename T26, typename T27, typename T28, typename T29, typename T30,
13156     typename T31>
13157 class ValueArray31 {
13158  public:
13159   ValueArray31(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
13160       T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
13161       T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
13162       T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31) : v1_(v1), v2_(v2),
13163       v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10),
13164       v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15), v16_(v16),
13165       v17_(v17), v18_(v18), v19_(v19), v20_(v20), v21_(v21), v22_(v22),
13166       v23_(v23), v24_(v24), v25_(v25), v26_(v26), v27_(v27), v28_(v28),
13167       v29_(v29), v30_(v30), v31_(v31) {}
13168 
13169   template <typename T>
13170   operator ParamGenerator<T>() const {
13171     const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
13172         static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
13173         static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
13174         static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
13175         static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
13176         static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
13177         static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
13178         static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
13179         static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),
13180         static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_),
13181         static_cast<T>(v30_), static_cast<T>(v31_)};
13182     return ValuesIn(array);
13183   }
13184 
13185  private:
13186   // No implementation - assignment is unsupported.
13187   void operator=(const ValueArray31& other);
13188 
13189   const T1 v1_;
13190   const T2 v2_;
13191   const T3 v3_;
13192   const T4 v4_;
13193   const T5 v5_;
13194   const T6 v6_;
13195   const T7 v7_;
13196   const T8 v8_;
13197   const T9 v9_;
13198   const T10 v10_;
13199   const T11 v11_;
13200   const T12 v12_;
13201   const T13 v13_;
13202   const T14 v14_;
13203   const T15 v15_;
13204   const T16 v16_;
13205   const T17 v17_;
13206   const T18 v18_;
13207   const T19 v19_;
13208   const T20 v20_;
13209   const T21 v21_;
13210   const T22 v22_;
13211   const T23 v23_;
13212   const T24 v24_;
13213   const T25 v25_;
13214   const T26 v26_;
13215   const T27 v27_;
13216   const T28 v28_;
13217   const T29 v29_;
13218   const T30 v30_;
13219   const T31 v31_;
13220 };
13221 
13222 template <typename T1, typename T2, typename T3, typename T4, typename T5,
13223     typename T6, typename T7, typename T8, typename T9, typename T10,
13224     typename T11, typename T12, typename T13, typename T14, typename T15,
13225     typename T16, typename T17, typename T18, typename T19, typename T20,
13226     typename T21, typename T22, typename T23, typename T24, typename T25,
13227     typename T26, typename T27, typename T28, typename T29, typename T30,
13228     typename T31, typename T32>
13229 class ValueArray32 {
13230  public:
13231   ValueArray32(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
13232       T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
13233       T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
13234       T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32) : v1_(v1),
13235       v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9),
13236       v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15),
13237       v16_(v16), v17_(v17), v18_(v18), v19_(v19), v20_(v20), v21_(v21),
13238       v22_(v22), v23_(v23), v24_(v24), v25_(v25), v26_(v26), v27_(v27),
13239       v28_(v28), v29_(v29), v30_(v30), v31_(v31), v32_(v32) {}
13240 
13241   template <typename T>
13242   operator ParamGenerator<T>() const {
13243     const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
13244         static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
13245         static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
13246         static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
13247         static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
13248         static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
13249         static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
13250         static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
13251         static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),
13252         static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_),
13253         static_cast<T>(v30_), static_cast<T>(v31_), static_cast<T>(v32_)};
13254     return ValuesIn(array);
13255   }
13256 
13257  private:
13258   // No implementation - assignment is unsupported.
13259   void operator=(const ValueArray32& other);
13260 
13261   const T1 v1_;
13262   const T2 v2_;
13263   const T3 v3_;
13264   const T4 v4_;
13265   const T5 v5_;
13266   const T6 v6_;
13267   const T7 v7_;
13268   const T8 v8_;
13269   const T9 v9_;
13270   const T10 v10_;
13271   const T11 v11_;
13272   const T12 v12_;
13273   const T13 v13_;
13274   const T14 v14_;
13275   const T15 v15_;
13276   const T16 v16_;
13277   const T17 v17_;
13278   const T18 v18_;
13279   const T19 v19_;
13280   const T20 v20_;
13281   const T21 v21_;
13282   const T22 v22_;
13283   const T23 v23_;
13284   const T24 v24_;
13285   const T25 v25_;
13286   const T26 v26_;
13287   const T27 v27_;
13288   const T28 v28_;
13289   const T29 v29_;
13290   const T30 v30_;
13291   const T31 v31_;
13292   const T32 v32_;
13293 };
13294 
13295 template <typename T1, typename T2, typename T3, typename T4, typename T5,
13296     typename T6, typename T7, typename T8, typename T9, typename T10,
13297     typename T11, typename T12, typename T13, typename T14, typename T15,
13298     typename T16, typename T17, typename T18, typename T19, typename T20,
13299     typename T21, typename T22, typename T23, typename T24, typename T25,
13300     typename T26, typename T27, typename T28, typename T29, typename T30,
13301     typename T31, typename T32, typename T33>
13302 class ValueArray33 {
13303  public:
13304   ValueArray33(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
13305       T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
13306       T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
13307       T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32,
13308       T33 v33) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7),
13309       v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v14),
13310       v15_(v15), v16_(v16), v17_(v17), v18_(v18), v19_(v19), v20_(v20),
13311       v21_(v21), v22_(v22), v23_(v23), v24_(v24), v25_(v25), v26_(v26),
13312       v27_(v27), v28_(v28), v29_(v29), v30_(v30), v31_(v31), v32_(v32),
13313       v33_(v33) {}
13314 
13315   template <typename T>
13316   operator ParamGenerator<T>() const {
13317     const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
13318         static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
13319         static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
13320         static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
13321         static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
13322         static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
13323         static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
13324         static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
13325         static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),
13326         static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_),
13327         static_cast<T>(v30_), static_cast<T>(v31_), static_cast<T>(v32_),
13328         static_cast<T>(v33_)};
13329     return ValuesIn(array);
13330   }
13331 
13332  private:
13333   // No implementation - assignment is unsupported.
13334   void operator=(const ValueArray33& other);
13335 
13336   const T1 v1_;
13337   const T2 v2_;
13338   const T3 v3_;
13339   const T4 v4_;
13340   const T5 v5_;
13341   const T6 v6_;
13342   const T7 v7_;
13343   const T8 v8_;
13344   const T9 v9_;
13345   const T10 v10_;
13346   const T11 v11_;
13347   const T12 v12_;
13348   const T13 v13_;
13349   const T14 v14_;
13350   const T15 v15_;
13351   const T16 v16_;
13352   const T17 v17_;
13353   const T18 v18_;
13354   const T19 v19_;
13355   const T20 v20_;
13356   const T21 v21_;
13357   const T22 v22_;
13358   const T23 v23_;
13359   const T24 v24_;
13360   const T25 v25_;
13361   const T26 v26_;
13362   const T27 v27_;
13363   const T28 v28_;
13364   const T29 v29_;
13365   const T30 v30_;
13366   const T31 v31_;
13367   const T32 v32_;
13368   const T33 v33_;
13369 };
13370 
13371 template <typename T1, typename T2, typename T3, typename T4, typename T5,
13372     typename T6, typename T7, typename T8, typename T9, typename T10,
13373     typename T11, typename T12, typename T13, typename T14, typename T15,
13374     typename T16, typename T17, typename T18, typename T19, typename T20,
13375     typename T21, typename T22, typename T23, typename T24, typename T25,
13376     typename T26, typename T27, typename T28, typename T29, typename T30,
13377     typename T31, typename T32, typename T33, typename T34>
13378 class ValueArray34 {
13379  public:
13380   ValueArray34(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
13381       T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
13382       T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
13383       T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33,
13384       T34 v34) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7),
13385       v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v14),
13386       v15_(v15), v16_(v16), v17_(v17), v18_(v18), v19_(v19), v20_(v20),
13387       v21_(v21), v22_(v22), v23_(v23), v24_(v24), v25_(v25), v26_(v26),
13388       v27_(v27), v28_(v28), v29_(v29), v30_(v30), v31_(v31), v32_(v32),
13389       v33_(v33), v34_(v34) {}
13390 
13391   template <typename T>
13392   operator ParamGenerator<T>() const {
13393     const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
13394         static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
13395         static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
13396         static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
13397         static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
13398         static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
13399         static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
13400         static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
13401         static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),
13402         static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_),
13403         static_cast<T>(v30_), static_cast<T>(v31_), static_cast<T>(v32_),
13404         static_cast<T>(v33_), static_cast<T>(v34_)};
13405     return ValuesIn(array);
13406   }
13407 
13408  private:
13409   // No implementation - assignment is unsupported.
13410   void operator=(const ValueArray34& other);
13411 
13412   const T1 v1_;
13413   const T2 v2_;
13414   const T3 v3_;
13415   const T4 v4_;
13416   const T5 v5_;
13417   const T6 v6_;
13418   const T7 v7_;
13419   const T8 v8_;
13420   const T9 v9_;
13421   const T10 v10_;
13422   const T11 v11_;
13423   const T12 v12_;
13424   const T13 v13_;
13425   const T14 v14_;
13426   const T15 v15_;
13427   const T16 v16_;
13428   const T17 v17_;
13429   const T18 v18_;
13430   const T19 v19_;
13431   const T20 v20_;
13432   const T21 v21_;
13433   const T22 v22_;
13434   const T23 v23_;
13435   const T24 v24_;
13436   const T25 v25_;
13437   const T26 v26_;
13438   const T27 v27_;
13439   const T28 v28_;
13440   const T29 v29_;
13441   const T30 v30_;
13442   const T31 v31_;
13443   const T32 v32_;
13444   const T33 v33_;
13445   const T34 v34_;
13446 };
13447 
13448 template <typename T1, typename T2, typename T3, typename T4, typename T5,
13449     typename T6, typename T7, typename T8, typename T9, typename T10,
13450     typename T11, typename T12, typename T13, typename T14, typename T15,
13451     typename T16, typename T17, typename T18, typename T19, typename T20,
13452     typename T21, typename T22, typename T23, typename T24, typename T25,
13453     typename T26, typename T27, typename T28, typename T29, typename T30,
13454     typename T31, typename T32, typename T33, typename T34, typename T35>
13455 class ValueArray35 {
13456  public:
13457   ValueArray35(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
13458       T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
13459       T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
13460       T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33,
13461       T34 v34, T35 v35) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6),
13462       v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13),
13463       v14_(v14), v15_(v15), v16_(v16), v17_(v17), v18_(v18), v19_(v19),
13464       v20_(v20), v21_(v21), v22_(v22), v23_(v23), v24_(v24), v25_(v25),
13465       v26_(v26), v27_(v27), v28_(v28), v29_(v29), v30_(v30), v31_(v31),
13466       v32_(v32), v33_(v33), v34_(v34), v35_(v35) {}
13467 
13468   template <typename T>
13469   operator ParamGenerator<T>() const {
13470     const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
13471         static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
13472         static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
13473         static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
13474         static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
13475         static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
13476         static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
13477         static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
13478         static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),
13479         static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_),
13480         static_cast<T>(v30_), static_cast<T>(v31_), static_cast<T>(v32_),
13481         static_cast<T>(v33_), static_cast<T>(v34_), static_cast<T>(v35_)};
13482     return ValuesIn(array);
13483   }
13484 
13485  private:
13486   // No implementation - assignment is unsupported.
13487   void operator=(const ValueArray35& other);
13488 
13489   const T1 v1_;
13490   const T2 v2_;
13491   const T3 v3_;
13492   const T4 v4_;
13493   const T5 v5_;
13494   const T6 v6_;
13495   const T7 v7_;
13496   const T8 v8_;
13497   const T9 v9_;
13498   const T10 v10_;
13499   const T11 v11_;
13500   const T12 v12_;
13501   const T13 v13_;
13502   const T14 v14_;
13503   const T15 v15_;
13504   const T16 v16_;
13505   const T17 v17_;
13506   const T18 v18_;
13507   const T19 v19_;
13508   const T20 v20_;
13509   const T21 v21_;
13510   const T22 v22_;
13511   const T23 v23_;
13512   const T24 v24_;
13513   const T25 v25_;
13514   const T26 v26_;
13515   const T27 v27_;
13516   const T28 v28_;
13517   const T29 v29_;
13518   const T30 v30_;
13519   const T31 v31_;
13520   const T32 v32_;
13521   const T33 v33_;
13522   const T34 v34_;
13523   const T35 v35_;
13524 };
13525 
13526 template <typename T1, typename T2, typename T3, typename T4, typename T5,
13527     typename T6, typename T7, typename T8, typename T9, typename T10,
13528     typename T11, typename T12, typename T13, typename T14, typename T15,
13529     typename T16, typename T17, typename T18, typename T19, typename T20,
13530     typename T21, typename T22, typename T23, typename T24, typename T25,
13531     typename T26, typename T27, typename T28, typename T29, typename T30,
13532     typename T31, typename T32, typename T33, typename T34, typename T35,
13533     typename T36>
13534 class ValueArray36 {
13535  public:
13536   ValueArray36(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
13537       T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
13538       T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
13539       T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33,
13540       T34 v34, T35 v35, T36 v36) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5),
13541       v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12),
13542       v13_(v13), v14_(v14), v15_(v15), v16_(v16), v17_(v17), v18_(v18),
13543       v19_(v19), v20_(v20), v21_(v21), v22_(v22), v23_(v23), v24_(v24),
13544       v25_(v25), v26_(v26), v27_(v27), v28_(v28), v29_(v29), v30_(v30),
13545       v31_(v31), v32_(v32), v33_(v33), v34_(v34), v35_(v35), v36_(v36) {}
13546 
13547   template <typename T>
13548   operator ParamGenerator<T>() const {
13549     const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
13550         static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
13551         static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
13552         static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
13553         static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
13554         static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
13555         static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
13556         static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
13557         static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),
13558         static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_),
13559         static_cast<T>(v30_), static_cast<T>(v31_), static_cast<T>(v32_),
13560         static_cast<T>(v33_), static_cast<T>(v34_), static_cast<T>(v35_),
13561         static_cast<T>(v36_)};
13562     return ValuesIn(array);
13563   }
13564 
13565  private:
13566   // No implementation - assignment is unsupported.
13567   void operator=(const ValueArray36& other);
13568 
13569   const T1 v1_;
13570   const T2 v2_;
13571   const T3 v3_;
13572   const T4 v4_;
13573   const T5 v5_;
13574   const T6 v6_;
13575   const T7 v7_;
13576   const T8 v8_;
13577   const T9 v9_;
13578   const T10 v10_;
13579   const T11 v11_;
13580   const T12 v12_;
13581   const T13 v13_;
13582   const T14 v14_;
13583   const T15 v15_;
13584   const T16 v16_;
13585   const T17 v17_;
13586   const T18 v18_;
13587   const T19 v19_;
13588   const T20 v20_;
13589   const T21 v21_;
13590   const T22 v22_;
13591   const T23 v23_;
13592   const T24 v24_;
13593   const T25 v25_;
13594   const T26 v26_;
13595   const T27 v27_;
13596   const T28 v28_;
13597   const T29 v29_;
13598   const T30 v30_;
13599   const T31 v31_;
13600   const T32 v32_;
13601   const T33 v33_;
13602   const T34 v34_;
13603   const T35 v35_;
13604   const T36 v36_;
13605 };
13606 
13607 template <typename T1, typename T2, typename T3, typename T4, typename T5,
13608     typename T6, typename T7, typename T8, typename T9, typename T10,
13609     typename T11, typename T12, typename T13, typename T14, typename T15,
13610     typename T16, typename T17, typename T18, typename T19, typename T20,
13611     typename T21, typename T22, typename T23, typename T24, typename T25,
13612     typename T26, typename T27, typename T28, typename T29, typename T30,
13613     typename T31, typename T32, typename T33, typename T34, typename T35,
13614     typename T36, typename T37>
13615 class ValueArray37 {
13616  public:
13617   ValueArray37(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
13618       T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
13619       T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
13620       T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33,
13621       T34 v34, T35 v35, T36 v36, T37 v37) : v1_(v1), v2_(v2), v3_(v3), v4_(v4),
13622       v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11),
13623       v12_(v12), v13_(v13), v14_(v14), v15_(v15), v16_(v16), v17_(v17),
13624       v18_(v18), v19_(v19), v20_(v20), v21_(v21), v22_(v22), v23_(v23),
13625       v24_(v24), v25_(v25), v26_(v26), v27_(v27), v28_(v28), v29_(v29),
13626       v30_(v30), v31_(v31), v32_(v32), v33_(v33), v34_(v34), v35_(v35),
13627       v36_(v36), v37_(v37) {}
13628 
13629   template <typename T>
13630   operator ParamGenerator<T>() const {
13631     const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
13632         static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
13633         static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
13634         static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
13635         static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
13636         static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
13637         static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
13638         static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
13639         static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),
13640         static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_),
13641         static_cast<T>(v30_), static_cast<T>(v31_), static_cast<T>(v32_),
13642         static_cast<T>(v33_), static_cast<T>(v34_), static_cast<T>(v35_),
13643         static_cast<T>(v36_), static_cast<T>(v37_)};
13644     return ValuesIn(array);
13645   }
13646 
13647  private:
13648   // No implementation - assignment is unsupported.
13649   void operator=(const ValueArray37& other);
13650 
13651   const T1 v1_;
13652   const T2 v2_;
13653   const T3 v3_;
13654   const T4 v4_;
13655   const T5 v5_;
13656   const T6 v6_;
13657   const T7 v7_;
13658   const T8 v8_;
13659   const T9 v9_;
13660   const T10 v10_;
13661   const T11 v11_;
13662   const T12 v12_;
13663   const T13 v13_;
13664   const T14 v14_;
13665   const T15 v15_;
13666   const T16 v16_;
13667   const T17 v17_;
13668   const T18 v18_;
13669   const T19 v19_;
13670   const T20 v20_;
13671   const T21 v21_;
13672   const T22 v22_;
13673   const T23 v23_;
13674   const T24 v24_;
13675   const T25 v25_;
13676   const T26 v26_;
13677   const T27 v27_;
13678   const T28 v28_;
13679   const T29 v29_;
13680   const T30 v30_;
13681   const T31 v31_;
13682   const T32 v32_;
13683   const T33 v33_;
13684   const T34 v34_;
13685   const T35 v35_;
13686   const T36 v36_;
13687   const T37 v37_;
13688 };
13689 
13690 template <typename T1, typename T2, typename T3, typename T4, typename T5,
13691     typename T6, typename T7, typename T8, typename T9, typename T10,
13692     typename T11, typename T12, typename T13, typename T14, typename T15,
13693     typename T16, typename T17, typename T18, typename T19, typename T20,
13694     typename T21, typename T22, typename T23, typename T24, typename T25,
13695     typename T26, typename T27, typename T28, typename T29, typename T30,
13696     typename T31, typename T32, typename T33, typename T34, typename T35,
13697     typename T36, typename T37, typename T38>
13698 class ValueArray38 {
13699  public:
13700   ValueArray38(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
13701       T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
13702       T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
13703       T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33,
13704       T34 v34, T35 v35, T36 v36, T37 v37, T38 v38) : v1_(v1), v2_(v2), v3_(v3),
13705       v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10),
13706       v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15), v16_(v16),
13707       v17_(v17), v18_(v18), v19_(v19), v20_(v20), v21_(v21), v22_(v22),
13708       v23_(v23), v24_(v24), v25_(v25), v26_(v26), v27_(v27), v28_(v28),
13709       v29_(v29), v30_(v30), v31_(v31), v32_(v32), v33_(v33), v34_(v34),
13710       v35_(v35), v36_(v36), v37_(v37), v38_(v38) {}
13711 
13712   template <typename T>
13713   operator ParamGenerator<T>() const {
13714     const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
13715         static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
13716         static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
13717         static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
13718         static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
13719         static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
13720         static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
13721         static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
13722         static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),
13723         static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_),
13724         static_cast<T>(v30_), static_cast<T>(v31_), static_cast<T>(v32_),
13725         static_cast<T>(v33_), static_cast<T>(v34_), static_cast<T>(v35_),
13726         static_cast<T>(v36_), static_cast<T>(v37_), static_cast<T>(v38_)};
13727     return ValuesIn(array);
13728   }
13729 
13730  private:
13731   // No implementation - assignment is unsupported.
13732   void operator=(const ValueArray38& other);
13733 
13734   const T1 v1_;
13735   const T2 v2_;
13736   const T3 v3_;
13737   const T4 v4_;
13738   const T5 v5_;
13739   const T6 v6_;
13740   const T7 v7_;
13741   const T8 v8_;
13742   const T9 v9_;
13743   const T10 v10_;
13744   const T11 v11_;
13745   const T12 v12_;
13746   const T13 v13_;
13747   const T14 v14_;
13748   const T15 v15_;
13749   const T16 v16_;
13750   const T17 v17_;
13751   const T18 v18_;
13752   const T19 v19_;
13753   const T20 v20_;
13754   const T21 v21_;
13755   const T22 v22_;
13756   const T23 v23_;
13757   const T24 v24_;
13758   const T25 v25_;
13759   const T26 v26_;
13760   const T27 v27_;
13761   const T28 v28_;
13762   const T29 v29_;
13763   const T30 v30_;
13764   const T31 v31_;
13765   const T32 v32_;
13766   const T33 v33_;
13767   const T34 v34_;
13768   const T35 v35_;
13769   const T36 v36_;
13770   const T37 v37_;
13771   const T38 v38_;
13772 };
13773 
13774 template <typename T1, typename T2, typename T3, typename T4, typename T5,
13775     typename T6, typename T7, typename T8, typename T9, typename T10,
13776     typename T11, typename T12, typename T13, typename T14, typename T15,
13777     typename T16, typename T17, typename T18, typename T19, typename T20,
13778     typename T21, typename T22, typename T23, typename T24, typename T25,
13779     typename T26, typename T27, typename T28, typename T29, typename T30,
13780     typename T31, typename T32, typename T33, typename T34, typename T35,
13781     typename T36, typename T37, typename T38, typename T39>
13782 class ValueArray39 {
13783  public:
13784   ValueArray39(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
13785       T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
13786       T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
13787       T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33,
13788       T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39) : v1_(v1), v2_(v2),
13789       v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10),
13790       v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15), v16_(v16),
13791       v17_(v17), v18_(v18), v19_(v19), v20_(v20), v21_(v21), v22_(v22),
13792       v23_(v23), v24_(v24), v25_(v25), v26_(v26), v27_(v27), v28_(v28),
13793       v29_(v29), v30_(v30), v31_(v31), v32_(v32), v33_(v33), v34_(v34),
13794       v35_(v35), v36_(v36), v37_(v37), v38_(v38), v39_(v39) {}
13795 
13796   template <typename T>
13797   operator ParamGenerator<T>() const {
13798     const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
13799         static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
13800         static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
13801         static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
13802         static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
13803         static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
13804         static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
13805         static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
13806         static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),
13807         static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_),
13808         static_cast<T>(v30_), static_cast<T>(v31_), static_cast<T>(v32_),
13809         static_cast<T>(v33_), static_cast<T>(v34_), static_cast<T>(v35_),
13810         static_cast<T>(v36_), static_cast<T>(v37_), static_cast<T>(v38_),
13811         static_cast<T>(v39_)};
13812     return ValuesIn(array);
13813   }
13814 
13815  private:
13816   // No implementation - assignment is unsupported.
13817   void operator=(const ValueArray39& other);
13818 
13819   const T1 v1_;
13820   const T2 v2_;
13821   const T3 v3_;
13822   const T4 v4_;
13823   const T5 v5_;
13824   const T6 v6_;
13825   const T7 v7_;
13826   const T8 v8_;
13827   const T9 v9_;
13828   const T10 v10_;
13829   const T11 v11_;
13830   const T12 v12_;
13831   const T13 v13_;
13832   const T14 v14_;
13833   const T15 v15_;
13834   const T16 v16_;
13835   const T17 v17_;
13836   const T18 v18_;
13837   const T19 v19_;
13838   const T20 v20_;
13839   const T21 v21_;
13840   const T22 v22_;
13841   const T23 v23_;
13842   const T24 v24_;
13843   const T25 v25_;
13844   const T26 v26_;
13845   const T27 v27_;
13846   const T28 v28_;
13847   const T29 v29_;
13848   const T30 v30_;
13849   const T31 v31_;
13850   const T32 v32_;
13851   const T33 v33_;
13852   const T34 v34_;
13853   const T35 v35_;
13854   const T36 v36_;
13855   const T37 v37_;
13856   const T38 v38_;
13857   const T39 v39_;
13858 };
13859 
13860 template <typename T1, typename T2, typename T3, typename T4, typename T5,
13861     typename T6, typename T7, typename T8, typename T9, typename T10,
13862     typename T11, typename T12, typename T13, typename T14, typename T15,
13863     typename T16, typename T17, typename T18, typename T19, typename T20,
13864     typename T21, typename T22, typename T23, typename T24, typename T25,
13865     typename T26, typename T27, typename T28, typename T29, typename T30,
13866     typename T31, typename T32, typename T33, typename T34, typename T35,
13867     typename T36, typename T37, typename T38, typename T39, typename T40>
13868 class ValueArray40 {
13869  public:
13870   ValueArray40(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
13871       T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
13872       T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
13873       T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33,
13874       T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39, T40 v40) : v1_(v1),
13875       v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9),
13876       v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15),
13877       v16_(v16), v17_(v17), v18_(v18), v19_(v19), v20_(v20), v21_(v21),
13878       v22_(v22), v23_(v23), v24_(v24), v25_(v25), v26_(v26), v27_(v27),
13879       v28_(v28), v29_(v29), v30_(v30), v31_(v31), v32_(v32), v33_(v33),
13880       v34_(v34), v35_(v35), v36_(v36), v37_(v37), v38_(v38), v39_(v39),
13881       v40_(v40) {}
13882 
13883   template <typename T>
13884   operator ParamGenerator<T>() const {
13885     const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
13886         static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
13887         static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
13888         static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
13889         static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
13890         static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
13891         static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
13892         static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
13893         static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),
13894         static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_),
13895         static_cast<T>(v30_), static_cast<T>(v31_), static_cast<T>(v32_),
13896         static_cast<T>(v33_), static_cast<T>(v34_), static_cast<T>(v35_),
13897         static_cast<T>(v36_), static_cast<T>(v37_), static_cast<T>(v38_),
13898         static_cast<T>(v39_), static_cast<T>(v40_)};
13899     return ValuesIn(array);
13900   }
13901 
13902  private:
13903   // No implementation - assignment is unsupported.
13904   void operator=(const ValueArray40& other);
13905 
13906   const T1 v1_;
13907   const T2 v2_;
13908   const T3 v3_;
13909   const T4 v4_;
13910   const T5 v5_;
13911   const T6 v6_;
13912   const T7 v7_;
13913   const T8 v8_;
13914   const T9 v9_;
13915   const T10 v10_;
13916   const T11 v11_;
13917   const T12 v12_;
13918   const T13 v13_;
13919   const T14 v14_;
13920   const T15 v15_;
13921   const T16 v16_;
13922   const T17 v17_;
13923   const T18 v18_;
13924   const T19 v19_;
13925   const T20 v20_;
13926   const T21 v21_;
13927   const T22 v22_;
13928   const T23 v23_;
13929   const T24 v24_;
13930   const T25 v25_;
13931   const T26 v26_;
13932   const T27 v27_;
13933   const T28 v28_;
13934   const T29 v29_;
13935   const T30 v30_;
13936   const T31 v31_;
13937   const T32 v32_;
13938   const T33 v33_;
13939   const T34 v34_;
13940   const T35 v35_;
13941   const T36 v36_;
13942   const T37 v37_;
13943   const T38 v38_;
13944   const T39 v39_;
13945   const T40 v40_;
13946 };
13947 
13948 template <typename T1, typename T2, typename T3, typename T4, typename T5,
13949     typename T6, typename T7, typename T8, typename T9, typename T10,
13950     typename T11, typename T12, typename T13, typename T14, typename T15,
13951     typename T16, typename T17, typename T18, typename T19, typename T20,
13952     typename T21, typename T22, typename T23, typename T24, typename T25,
13953     typename T26, typename T27, typename T28, typename T29, typename T30,
13954     typename T31, typename T32, typename T33, typename T34, typename T35,
13955     typename T36, typename T37, typename T38, typename T39, typename T40,
13956     typename T41>
13957 class ValueArray41 {
13958  public:
13959   ValueArray41(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
13960       T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
13961       T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
13962       T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33,
13963       T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39, T40 v40,
13964       T41 v41) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7),
13965       v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v14),
13966       v15_(v15), v16_(v16), v17_(v17), v18_(v18), v19_(v19), v20_(v20),
13967       v21_(v21), v22_(v22), v23_(v23), v24_(v24), v25_(v25), v26_(v26),
13968       v27_(v27), v28_(v28), v29_(v29), v30_(v30), v31_(v31), v32_(v32),
13969       v33_(v33), v34_(v34), v35_(v35), v36_(v36), v37_(v37), v38_(v38),
13970       v39_(v39), v40_(v40), v41_(v41) {}
13971 
13972   template <typename T>
13973   operator ParamGenerator<T>() const {
13974     const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
13975         static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
13976         static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
13977         static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
13978         static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
13979         static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
13980         static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
13981         static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
13982         static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),
13983         static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_),
13984         static_cast<T>(v30_), static_cast<T>(v31_), static_cast<T>(v32_),
13985         static_cast<T>(v33_), static_cast<T>(v34_), static_cast<T>(v35_),
13986         static_cast<T>(v36_), static_cast<T>(v37_), static_cast<T>(v38_),
13987         static_cast<T>(v39_), static_cast<T>(v40_), static_cast<T>(v41_)};
13988     return ValuesIn(array);
13989   }
13990 
13991  private:
13992   // No implementation - assignment is unsupported.
13993   void operator=(const ValueArray41& other);
13994 
13995   const T1 v1_;
13996   const T2 v2_;
13997   const T3 v3_;
13998   const T4 v4_;
13999   const T5 v5_;
14000   const T6 v6_;
14001   const T7 v7_;
14002   const T8 v8_;
14003   const T9 v9_;
14004   const T10 v10_;
14005   const T11 v11_;
14006   const T12 v12_;
14007   const T13 v13_;
14008   const T14 v14_;
14009   const T15 v15_;
14010   const T16 v16_;
14011   const T17 v17_;
14012   const T18 v18_;
14013   const T19 v19_;
14014   const T20 v20_;
14015   const T21 v21_;
14016   const T22 v22_;
14017   const T23 v23_;
14018   const T24 v24_;
14019   const T25 v25_;
14020   const T26 v26_;
14021   const T27 v27_;
14022   const T28 v28_;
14023   const T29 v29_;
14024   const T30 v30_;
14025   const T31 v31_;
14026   const T32 v32_;
14027   const T33 v33_;
14028   const T34 v34_;
14029   const T35 v35_;
14030   const T36 v36_;
14031   const T37 v37_;
14032   const T38 v38_;
14033   const T39 v39_;
14034   const T40 v40_;
14035   const T41 v41_;
14036 };
14037 
14038 template <typename T1, typename T2, typename T3, typename T4, typename T5,
14039     typename T6, typename T7, typename T8, typename T9, typename T10,
14040     typename T11, typename T12, typename T13, typename T14, typename T15,
14041     typename T16, typename T17, typename T18, typename T19, typename T20,
14042     typename T21, typename T22, typename T23, typename T24, typename T25,
14043     typename T26, typename T27, typename T28, typename T29, typename T30,
14044     typename T31, typename T32, typename T33, typename T34, typename T35,
14045     typename T36, typename T37, typename T38, typename T39, typename T40,
14046     typename T41, typename T42>
14047 class ValueArray42 {
14048  public:
14049   ValueArray42(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
14050       T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
14051       T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
14052       T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33,
14053       T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39, T40 v40, T41 v41,
14054       T42 v42) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7),
14055       v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v14),
14056       v15_(v15), v16_(v16), v17_(v17), v18_(v18), v19_(v19), v20_(v20),
14057       v21_(v21), v22_(v22), v23_(v23), v24_(v24), v25_(v25), v26_(v26),
14058       v27_(v27), v28_(v28), v29_(v29), v30_(v30), v31_(v31), v32_(v32),
14059       v33_(v33), v34_(v34), v35_(v35), v36_(v36), v37_(v37), v38_(v38),
14060       v39_(v39), v40_(v40), v41_(v41), v42_(v42) {}
14061 
14062   template <typename T>
14063   operator ParamGenerator<T>() const {
14064     const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
14065         static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
14066         static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
14067         static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
14068         static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
14069         static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
14070         static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
14071         static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
14072         static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),
14073         static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_),
14074         static_cast<T>(v30_), static_cast<T>(v31_), static_cast<T>(v32_),
14075         static_cast<T>(v33_), static_cast<T>(v34_), static_cast<T>(v35_),
14076         static_cast<T>(v36_), static_cast<T>(v37_), static_cast<T>(v38_),
14077         static_cast<T>(v39_), static_cast<T>(v40_), static_cast<T>(v41_),
14078         static_cast<T>(v42_)};
14079     return ValuesIn(array);
14080   }
14081 
14082  private:
14083   // No implementation - assignment is unsupported.
14084   void operator=(const ValueArray42& other);
14085 
14086   const T1 v1_;
14087   const T2 v2_;
14088   const T3 v3_;
14089   const T4 v4_;
14090   const T5 v5_;
14091   const T6 v6_;
14092   const T7 v7_;
14093   const T8 v8_;
14094   const T9 v9_;
14095   const T10 v10_;
14096   const T11 v11_;
14097   const T12 v12_;
14098   const T13 v13_;
14099   const T14 v14_;
14100   const T15 v15_;
14101   const T16 v16_;
14102   const T17 v17_;
14103   const T18 v18_;
14104   const T19 v19_;
14105   const T20 v20_;
14106   const T21 v21_;
14107   const T22 v22_;
14108   const T23 v23_;
14109   const T24 v24_;
14110   const T25 v25_;
14111   const T26 v26_;
14112   const T27 v27_;
14113   const T28 v28_;
14114   const T29 v29_;
14115   const T30 v30_;
14116   const T31 v31_;
14117   const T32 v32_;
14118   const T33 v33_;
14119   const T34 v34_;
14120   const T35 v35_;
14121   const T36 v36_;
14122   const T37 v37_;
14123   const T38 v38_;
14124   const T39 v39_;
14125   const T40 v40_;
14126   const T41 v41_;
14127   const T42 v42_;
14128 };
14129 
14130 template <typename T1, typename T2, typename T3, typename T4, typename T5,
14131     typename T6, typename T7, typename T8, typename T9, typename T10,
14132     typename T11, typename T12, typename T13, typename T14, typename T15,
14133     typename T16, typename T17, typename T18, typename T19, typename T20,
14134     typename T21, typename T22, typename T23, typename T24, typename T25,
14135     typename T26, typename T27, typename T28, typename T29, typename T30,
14136     typename T31, typename T32, typename T33, typename T34, typename T35,
14137     typename T36, typename T37, typename T38, typename T39, typename T40,
14138     typename T41, typename T42, typename T43>
14139 class ValueArray43 {
14140  public:
14141   ValueArray43(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
14142       T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
14143       T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
14144       T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33,
14145       T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39, T40 v40, T41 v41,
14146       T42 v42, T43 v43) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6),
14147       v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13),
14148       v14_(v14), v15_(v15), v16_(v16), v17_(v17), v18_(v18), v19_(v19),
14149       v20_(v20), v21_(v21), v22_(v22), v23_(v23), v24_(v24), v25_(v25),
14150       v26_(v26), v27_(v27), v28_(v28), v29_(v29), v30_(v30), v31_(v31),
14151       v32_(v32), v33_(v33), v34_(v34), v35_(v35), v36_(v36), v37_(v37),
14152       v38_(v38), v39_(v39), v40_(v40), v41_(v41), v42_(v42), v43_(v43) {}
14153 
14154   template <typename T>
14155   operator ParamGenerator<T>() const {
14156     const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
14157         static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
14158         static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
14159         static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
14160         static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
14161         static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
14162         static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
14163         static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
14164         static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),
14165         static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_),
14166         static_cast<T>(v30_), static_cast<T>(v31_), static_cast<T>(v32_),
14167         static_cast<T>(v33_), static_cast<T>(v34_), static_cast<T>(v35_),
14168         static_cast<T>(v36_), static_cast<T>(v37_), static_cast<T>(v38_),
14169         static_cast<T>(v39_), static_cast<T>(v40_), static_cast<T>(v41_),
14170         static_cast<T>(v42_), static_cast<T>(v43_)};
14171     return ValuesIn(array);
14172   }
14173 
14174  private:
14175   // No implementation - assignment is unsupported.
14176   void operator=(const ValueArray43& other);
14177 
14178   const T1 v1_;
14179   const T2 v2_;
14180   const T3 v3_;
14181   const T4 v4_;
14182   const T5 v5_;
14183   const T6 v6_;
14184   const T7 v7_;
14185   const T8 v8_;
14186   const T9 v9_;
14187   const T10 v10_;
14188   const T11 v11_;
14189   const T12 v12_;
14190   const T13 v13_;
14191   const T14 v14_;
14192   const T15 v15_;
14193   const T16 v16_;
14194   const T17 v17_;
14195   const T18 v18_;
14196   const T19 v19_;
14197   const T20 v20_;
14198   const T21 v21_;
14199   const T22 v22_;
14200   const T23 v23_;
14201   const T24 v24_;
14202   const T25 v25_;
14203   const T26 v26_;
14204   const T27 v27_;
14205   const T28 v28_;
14206   const T29 v29_;
14207   const T30 v30_;
14208   const T31 v31_;
14209   const T32 v32_;
14210   const T33 v33_;
14211   const T34 v34_;
14212   const T35 v35_;
14213   const T36 v36_;
14214   const T37 v37_;
14215   const T38 v38_;
14216   const T39 v39_;
14217   const T40 v40_;
14218   const T41 v41_;
14219   const T42 v42_;
14220   const T43 v43_;
14221 };
14222 
14223 template <typename T1, typename T2, typename T3, typename T4, typename T5,
14224     typename T6, typename T7, typename T8, typename T9, typename T10,
14225     typename T11, typename T12, typename T13, typename T14, typename T15,
14226     typename T16, typename T17, typename T18, typename T19, typename T20,
14227     typename T21, typename T22, typename T23, typename T24, typename T25,
14228     typename T26, typename T27, typename T28, typename T29, typename T30,
14229     typename T31, typename T32, typename T33, typename T34, typename T35,
14230     typename T36, typename T37, typename T38, typename T39, typename T40,
14231     typename T41, typename T42, typename T43, typename T44>
14232 class ValueArray44 {
14233  public:
14234   ValueArray44(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
14235       T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
14236       T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
14237       T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33,
14238       T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39, T40 v40, T41 v41,
14239       T42 v42, T43 v43, T44 v44) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5),
14240       v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12),
14241       v13_(v13), v14_(v14), v15_(v15), v16_(v16), v17_(v17), v18_(v18),
14242       v19_(v19), v20_(v20), v21_(v21), v22_(v22), v23_(v23), v24_(v24),
14243       v25_(v25), v26_(v26), v27_(v27), v28_(v28), v29_(v29), v30_(v30),
14244       v31_(v31), v32_(v32), v33_(v33), v34_(v34), v35_(v35), v36_(v36),
14245       v37_(v37), v38_(v38), v39_(v39), v40_(v40), v41_(v41), v42_(v42),
14246       v43_(v43), v44_(v44) {}
14247 
14248   template <typename T>
14249   operator ParamGenerator<T>() const {
14250     const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
14251         static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
14252         static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
14253         static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
14254         static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
14255         static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
14256         static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
14257         static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
14258         static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),
14259         static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_),
14260         static_cast<T>(v30_), static_cast<T>(v31_), static_cast<T>(v32_),
14261         static_cast<T>(v33_), static_cast<T>(v34_), static_cast<T>(v35_),
14262         static_cast<T>(v36_), static_cast<T>(v37_), static_cast<T>(v38_),
14263         static_cast<T>(v39_), static_cast<T>(v40_), static_cast<T>(v41_),
14264         static_cast<T>(v42_), static_cast<T>(v43_), static_cast<T>(v44_)};
14265     return ValuesIn(array);
14266   }
14267 
14268  private:
14269   // No implementation - assignment is unsupported.
14270   void operator=(const ValueArray44& other);
14271 
14272   const T1 v1_;
14273   const T2 v2_;
14274   const T3 v3_;
14275   const T4 v4_;
14276   const T5 v5_;
14277   const T6 v6_;
14278   const T7 v7_;
14279   const T8 v8_;
14280   const T9 v9_;
14281   const T10 v10_;
14282   const T11 v11_;
14283   const T12 v12_;
14284   const T13 v13_;
14285   const T14 v14_;
14286   const T15 v15_;
14287   const T16 v16_;
14288   const T17 v17_;
14289   const T18 v18_;
14290   const T19 v19_;
14291   const T20 v20_;
14292   const T21 v21_;
14293   const T22 v22_;
14294   const T23 v23_;
14295   const T24 v24_;
14296   const T25 v25_;
14297   const T26 v26_;
14298   const T27 v27_;
14299   const T28 v28_;
14300   const T29 v29_;
14301   const T30 v30_;
14302   const T31 v31_;
14303   const T32 v32_;
14304   const T33 v33_;
14305   const T34 v34_;
14306   const T35 v35_;
14307   const T36 v36_;
14308   const T37 v37_;
14309   const T38 v38_;
14310   const T39 v39_;
14311   const T40 v40_;
14312   const T41 v41_;
14313   const T42 v42_;
14314   const T43 v43_;
14315   const T44 v44_;
14316 };
14317 
14318 template <typename T1, typename T2, typename T3, typename T4, typename T5,
14319     typename T6, typename T7, typename T8, typename T9, typename T10,
14320     typename T11, typename T12, typename T13, typename T14, typename T15,
14321     typename T16, typename T17, typename T18, typename T19, typename T20,
14322     typename T21, typename T22, typename T23, typename T24, typename T25,
14323     typename T26, typename T27, typename T28, typename T29, typename T30,
14324     typename T31, typename T32, typename T33, typename T34, typename T35,
14325     typename T36, typename T37, typename T38, typename T39, typename T40,
14326     typename T41, typename T42, typename T43, typename T44, typename T45>
14327 class ValueArray45 {
14328  public:
14329   ValueArray45(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
14330       T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
14331       T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
14332       T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33,
14333       T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39, T40 v40, T41 v41,
14334       T42 v42, T43 v43, T44 v44, T45 v45) : v1_(v1), v2_(v2), v3_(v3), v4_(v4),
14335       v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11),
14336       v12_(v12), v13_(v13), v14_(v14), v15_(v15), v16_(v16), v17_(v17),
14337       v18_(v18), v19_(v19), v20_(v20), v21_(v21), v22_(v22), v23_(v23),
14338       v24_(v24), v25_(v25), v26_(v26), v27_(v27), v28_(v28), v29_(v29),
14339       v30_(v30), v31_(v31), v32_(v32), v33_(v33), v34_(v34), v35_(v35),
14340       v36_(v36), v37_(v37), v38_(v38), v39_(v39), v40_(v40), v41_(v41),
14341       v42_(v42), v43_(v43), v44_(v44), v45_(v45) {}
14342 
14343   template <typename T>
14344   operator ParamGenerator<T>() const {
14345     const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
14346         static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
14347         static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
14348         static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
14349         static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
14350         static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
14351         static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
14352         static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
14353         static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),
14354         static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_),
14355         static_cast<T>(v30_), static_cast<T>(v31_), static_cast<T>(v32_),
14356         static_cast<T>(v33_), static_cast<T>(v34_), static_cast<T>(v35_),
14357         static_cast<T>(v36_), static_cast<T>(v37_), static_cast<T>(v38_),
14358         static_cast<T>(v39_), static_cast<T>(v40_), static_cast<T>(v41_),
14359         static_cast<T>(v42_), static_cast<T>(v43_), static_cast<T>(v44_),
14360         static_cast<T>(v45_)};
14361     return ValuesIn(array);
14362   }
14363 
14364  private:
14365   // No implementation - assignment is unsupported.
14366   void operator=(const ValueArray45& other);
14367 
14368   const T1 v1_;
14369   const T2 v2_;
14370   const T3 v3_;
14371   const T4 v4_;
14372   const T5 v5_;
14373   const T6 v6_;
14374   const T7 v7_;
14375   const T8 v8_;
14376   const T9 v9_;
14377   const T10 v10_;
14378   const T11 v11_;
14379   const T12 v12_;
14380   const T13 v13_;
14381   const T14 v14_;
14382   const T15 v15_;
14383   const T16 v16_;
14384   const T17 v17_;
14385   const T18 v18_;
14386   const T19 v19_;
14387   const T20 v20_;
14388   const T21 v21_;
14389   const T22 v22_;
14390   const T23 v23_;
14391   const T24 v24_;
14392   const T25 v25_;
14393   const T26 v26_;
14394   const T27 v27_;
14395   const T28 v28_;
14396   const T29 v29_;
14397   const T30 v30_;
14398   const T31 v31_;
14399   const T32 v32_;
14400   const T33 v33_;
14401   const T34 v34_;
14402   const T35 v35_;
14403   const T36 v36_;
14404   const T37 v37_;
14405   const T38 v38_;
14406   const T39 v39_;
14407   const T40 v40_;
14408   const T41 v41_;
14409   const T42 v42_;
14410   const T43 v43_;
14411   const T44 v44_;
14412   const T45 v45_;
14413 };
14414 
14415 template <typename T1, typename T2, typename T3, typename T4, typename T5,
14416     typename T6, typename T7, typename T8, typename T9, typename T10,
14417     typename T11, typename T12, typename T13, typename T14, typename T15,
14418     typename T16, typename T17, typename T18, typename T19, typename T20,
14419     typename T21, typename T22, typename T23, typename T24, typename T25,
14420     typename T26, typename T27, typename T28, typename T29, typename T30,
14421     typename T31, typename T32, typename T33, typename T34, typename T35,
14422     typename T36, typename T37, typename T38, typename T39, typename T40,
14423     typename T41, typename T42, typename T43, typename T44, typename T45,
14424     typename T46>
14425 class ValueArray46 {
14426  public:
14427   ValueArray46(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
14428       T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
14429       T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
14430       T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33,
14431       T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39, T40 v40, T41 v41,
14432       T42 v42, T43 v43, T44 v44, T45 v45, T46 v46) : v1_(v1), v2_(v2), v3_(v3),
14433       v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10),
14434       v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15), v16_(v16),
14435       v17_(v17), v18_(v18), v19_(v19), v20_(v20), v21_(v21), v22_(v22),
14436       v23_(v23), v24_(v24), v25_(v25), v26_(v26), v27_(v27), v28_(v28),
14437       v29_(v29), v30_(v30), v31_(v31), v32_(v32), v33_(v33), v34_(v34),
14438       v35_(v35), v36_(v36), v37_(v37), v38_(v38), v39_(v39), v40_(v40),
14439       v41_(v41), v42_(v42), v43_(v43), v44_(v44), v45_(v45), v46_(v46) {}
14440 
14441   template <typename T>
14442   operator ParamGenerator<T>() const {
14443     const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
14444         static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
14445         static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
14446         static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
14447         static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
14448         static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
14449         static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
14450         static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
14451         static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),
14452         static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_),
14453         static_cast<T>(v30_), static_cast<T>(v31_), static_cast<T>(v32_),
14454         static_cast<T>(v33_), static_cast<T>(v34_), static_cast<T>(v35_),
14455         static_cast<T>(v36_), static_cast<T>(v37_), static_cast<T>(v38_),
14456         static_cast<T>(v39_), static_cast<T>(v40_), static_cast<T>(v41_),
14457         static_cast<T>(v42_), static_cast<T>(v43_), static_cast<T>(v44_),
14458         static_cast<T>(v45_), static_cast<T>(v46_)};
14459     return ValuesIn(array);
14460   }
14461 
14462  private:
14463   // No implementation - assignment is unsupported.
14464   void operator=(const ValueArray46& other);
14465 
14466   const T1 v1_;
14467   const T2 v2_;
14468   const T3 v3_;
14469   const T4 v4_;
14470   const T5 v5_;
14471   const T6 v6_;
14472   const T7 v7_;
14473   const T8 v8_;
14474   const T9 v9_;
14475   const T10 v10_;
14476   const T11 v11_;
14477   const T12 v12_;
14478   const T13 v13_;
14479   const T14 v14_;
14480   const T15 v15_;
14481   const T16 v16_;
14482   const T17 v17_;
14483   const T18 v18_;
14484   const T19 v19_;
14485   const T20 v20_;
14486   const T21 v21_;
14487   const T22 v22_;
14488   const T23 v23_;
14489   const T24 v24_;
14490   const T25 v25_;
14491   const T26 v26_;
14492   const T27 v27_;
14493   const T28 v28_;
14494   const T29 v29_;
14495   const T30 v30_;
14496   const T31 v31_;
14497   const T32 v32_;
14498   const T33 v33_;
14499   const T34 v34_;
14500   const T35 v35_;
14501   const T36 v36_;
14502   const T37 v37_;
14503   const T38 v38_;
14504   const T39 v39_;
14505   const T40 v40_;
14506   const T41 v41_;
14507   const T42 v42_;
14508   const T43 v43_;
14509   const T44 v44_;
14510   const T45 v45_;
14511   const T46 v46_;
14512 };
14513 
14514 template <typename T1, typename T2, typename T3, typename T4, typename T5,
14515     typename T6, typename T7, typename T8, typename T9, typename T10,
14516     typename T11, typename T12, typename T13, typename T14, typename T15,
14517     typename T16, typename T17, typename T18, typename T19, typename T20,
14518     typename T21, typename T22, typename T23, typename T24, typename T25,
14519     typename T26, typename T27, typename T28, typename T29, typename T30,
14520     typename T31, typename T32, typename T33, typename T34, typename T35,
14521     typename T36, typename T37, typename T38, typename T39, typename T40,
14522     typename T41, typename T42, typename T43, typename T44, typename T45,
14523     typename T46, typename T47>
14524 class ValueArray47 {
14525  public:
14526   ValueArray47(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
14527       T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
14528       T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
14529       T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33,
14530       T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39, T40 v40, T41 v41,
14531       T42 v42, T43 v43, T44 v44, T45 v45, T46 v46, T47 v47) : v1_(v1), v2_(v2),
14532       v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10),
14533       v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15), v16_(v16),
14534       v17_(v17), v18_(v18), v19_(v19), v20_(v20), v21_(v21), v22_(v22),
14535       v23_(v23), v24_(v24), v25_(v25), v26_(v26), v27_(v27), v28_(v28),
14536       v29_(v29), v30_(v30), v31_(v31), v32_(v32), v33_(v33), v34_(v34),
14537       v35_(v35), v36_(v36), v37_(v37), v38_(v38), v39_(v39), v40_(v40),
14538       v41_(v41), v42_(v42), v43_(v43), v44_(v44), v45_(v45), v46_(v46),
14539       v47_(v47) {}
14540 
14541   template <typename T>
14542   operator ParamGenerator<T>() const {
14543     const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
14544         static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
14545         static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
14546         static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
14547         static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
14548         static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
14549         static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
14550         static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
14551         static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),
14552         static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_),
14553         static_cast<T>(v30_), static_cast<T>(v31_), static_cast<T>(v32_),
14554         static_cast<T>(v33_), static_cast<T>(v34_), static_cast<T>(v35_),
14555         static_cast<T>(v36_), static_cast<T>(v37_), static_cast<T>(v38_),
14556         static_cast<T>(v39_), static_cast<T>(v40_), static_cast<T>(v41_),
14557         static_cast<T>(v42_), static_cast<T>(v43_), static_cast<T>(v44_),
14558         static_cast<T>(v45_), static_cast<T>(v46_), static_cast<T>(v47_)};
14559     return ValuesIn(array);
14560   }
14561 
14562  private:
14563   // No implementation - assignment is unsupported.
14564   void operator=(const ValueArray47& other);
14565 
14566   const T1 v1_;
14567   const T2 v2_;
14568   const T3 v3_;
14569   const T4 v4_;
14570   const T5 v5_;
14571   const T6 v6_;
14572   const T7 v7_;
14573   const T8 v8_;
14574   const T9 v9_;
14575   const T10 v10_;
14576   const T11 v11_;
14577   const T12 v12_;
14578   const T13 v13_;
14579   const T14 v14_;
14580   const T15 v15_;
14581   const T16 v16_;
14582   const T17 v17_;
14583   const T18 v18_;
14584   const T19 v19_;
14585   const T20 v20_;
14586   const T21 v21_;
14587   const T22 v22_;
14588   const T23 v23_;
14589   const T24 v24_;
14590   const T25 v25_;
14591   const T26 v26_;
14592   const T27 v27_;
14593   const T28 v28_;
14594   const T29 v29_;
14595   const T30 v30_;
14596   const T31 v31_;
14597   const T32 v32_;
14598   const T33 v33_;
14599   const T34 v34_;
14600   const T35 v35_;
14601   const T36 v36_;
14602   const T37 v37_;
14603   const T38 v38_;
14604   const T39 v39_;
14605   const T40 v40_;
14606   const T41 v41_;
14607   const T42 v42_;
14608   const T43 v43_;
14609   const T44 v44_;
14610   const T45 v45_;
14611   const T46 v46_;
14612   const T47 v47_;
14613 };
14614 
14615 template <typename T1, typename T2, typename T3, typename T4, typename T5,
14616     typename T6, typename T7, typename T8, typename T9, typename T10,
14617     typename T11, typename T12, typename T13, typename T14, typename T15,
14618     typename T16, typename T17, typename T18, typename T19, typename T20,
14619     typename T21, typename T22, typename T23, typename T24, typename T25,
14620     typename T26, typename T27, typename T28, typename T29, typename T30,
14621     typename T31, typename T32, typename T33, typename T34, typename T35,
14622     typename T36, typename T37, typename T38, typename T39, typename T40,
14623     typename T41, typename T42, typename T43, typename T44, typename T45,
14624     typename T46, typename T47, typename T48>
14625 class ValueArray48 {
14626  public:
14627   ValueArray48(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
14628       T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
14629       T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
14630       T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33,
14631       T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39, T40 v40, T41 v41,
14632       T42 v42, T43 v43, T44 v44, T45 v45, T46 v46, T47 v47, T48 v48) : v1_(v1),
14633       v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9),
14634       v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15),
14635       v16_(v16), v17_(v17), v18_(v18), v19_(v19), v20_(v20), v21_(v21),
14636       v22_(v22), v23_(v23), v24_(v24), v25_(v25), v26_(v26), v27_(v27),
14637       v28_(v28), v29_(v29), v30_(v30), v31_(v31), v32_(v32), v33_(v33),
14638       v34_(v34), v35_(v35), v36_(v36), v37_(v37), v38_(v38), v39_(v39),
14639       v40_(v40), v41_(v41), v42_(v42), v43_(v43), v44_(v44), v45_(v45),
14640       v46_(v46), v47_(v47), v48_(v48) {}
14641 
14642   template <typename T>
14643   operator ParamGenerator<T>() const {
14644     const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
14645         static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
14646         static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
14647         static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
14648         static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
14649         static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
14650         static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
14651         static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
14652         static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),
14653         static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_),
14654         static_cast<T>(v30_), static_cast<T>(v31_), static_cast<T>(v32_),
14655         static_cast<T>(v33_), static_cast<T>(v34_), static_cast<T>(v35_),
14656         static_cast<T>(v36_), static_cast<T>(v37_), static_cast<T>(v38_),
14657         static_cast<T>(v39_), static_cast<T>(v40_), static_cast<T>(v41_),
14658         static_cast<T>(v42_), static_cast<T>(v43_), static_cast<T>(v44_),
14659         static_cast<T>(v45_), static_cast<T>(v46_), static_cast<T>(v47_),
14660         static_cast<T>(v48_)};
14661     return ValuesIn(array);
14662   }
14663 
14664  private:
14665   // No implementation - assignment is unsupported.
14666   void operator=(const ValueArray48& other);
14667 
14668   const T1 v1_;
14669   const T2 v2_;
14670   const T3 v3_;
14671   const T4 v4_;
14672   const T5 v5_;
14673   const T6 v6_;
14674   const T7 v7_;
14675   const T8 v8_;
14676   const T9 v9_;
14677   const T10 v10_;
14678   const T11 v11_;
14679   const T12 v12_;
14680   const T13 v13_;
14681   const T14 v14_;
14682   const T15 v15_;
14683   const T16 v16_;
14684   const T17 v17_;
14685   const T18 v18_;
14686   const T19 v19_;
14687   const T20 v20_;
14688   const T21 v21_;
14689   const T22 v22_;
14690   const T23 v23_;
14691   const T24 v24_;
14692   const T25 v25_;
14693   const T26 v26_;
14694   const T27 v27_;
14695   const T28 v28_;
14696   const T29 v29_;
14697   const T30 v30_;
14698   const T31 v31_;
14699   const T32 v32_;
14700   const T33 v33_;
14701   const T34 v34_;
14702   const T35 v35_;
14703   const T36 v36_;
14704   const T37 v37_;
14705   const T38 v38_;
14706   const T39 v39_;
14707   const T40 v40_;
14708   const T41 v41_;
14709   const T42 v42_;
14710   const T43 v43_;
14711   const T44 v44_;
14712   const T45 v45_;
14713   const T46 v46_;
14714   const T47 v47_;
14715   const T48 v48_;
14716 };
14717 
14718 template <typename T1, typename T2, typename T3, typename T4, typename T5,
14719     typename T6, typename T7, typename T8, typename T9, typename T10,
14720     typename T11, typename T12, typename T13, typename T14, typename T15,
14721     typename T16, typename T17, typename T18, typename T19, typename T20,
14722     typename T21, typename T22, typename T23, typename T24, typename T25,
14723     typename T26, typename T27, typename T28, typename T29, typename T30,
14724     typename T31, typename T32, typename T33, typename T34, typename T35,
14725     typename T36, typename T37, typename T38, typename T39, typename T40,
14726     typename T41, typename T42, typename T43, typename T44, typename T45,
14727     typename T46, typename T47, typename T48, typename T49>
14728 class ValueArray49 {
14729  public:
14730   ValueArray49(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
14731       T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
14732       T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
14733       T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33,
14734       T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39, T40 v40, T41 v41,
14735       T42 v42, T43 v43, T44 v44, T45 v45, T46 v46, T47 v47, T48 v48,
14736       T49 v49) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7),
14737       v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v14),
14738       v15_(v15), v16_(v16), v17_(v17), v18_(v18), v19_(v19), v20_(v20),
14739       v21_(v21), v22_(v22), v23_(v23), v24_(v24), v25_(v25), v26_(v26),
14740       v27_(v27), v28_(v28), v29_(v29), v30_(v30), v31_(v31), v32_(v32),
14741       v33_(v33), v34_(v34), v35_(v35), v36_(v36), v37_(v37), v38_(v38),
14742       v39_(v39), v40_(v40), v41_(v41), v42_(v42), v43_(v43), v44_(v44),
14743       v45_(v45), v46_(v46), v47_(v47), v48_(v48), v49_(v49) {}
14744 
14745   template <typename T>
14746   operator ParamGenerator<T>() const {
14747     const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
14748         static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
14749         static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
14750         static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
14751         static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
14752         static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
14753         static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
14754         static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
14755         static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),
14756         static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_),
14757         static_cast<T>(v30_), static_cast<T>(v31_), static_cast<T>(v32_),
14758         static_cast<T>(v33_), static_cast<T>(v34_), static_cast<T>(v35_),
14759         static_cast<T>(v36_), static_cast<T>(v37_), static_cast<T>(v38_),
14760         static_cast<T>(v39_), static_cast<T>(v40_), static_cast<T>(v41_),
14761         static_cast<T>(v42_), static_cast<T>(v43_), static_cast<T>(v44_),
14762         static_cast<T>(v45_), static_cast<T>(v46_), static_cast<T>(v47_),
14763         static_cast<T>(v48_), static_cast<T>(v49_)};
14764     return ValuesIn(array);
14765   }
14766 
14767  private:
14768   // No implementation - assignment is unsupported.
14769   void operator=(const ValueArray49& other);
14770 
14771   const T1 v1_;
14772   const T2 v2_;
14773   const T3 v3_;
14774   const T4 v4_;
14775   const T5 v5_;
14776   const T6 v6_;
14777   const T7 v7_;
14778   const T8 v8_;
14779   const T9 v9_;
14780   const T10 v10_;
14781   const T11 v11_;
14782   const T12 v12_;
14783   const T13 v13_;
14784   const T14 v14_;
14785   const T15 v15_;
14786   const T16 v16_;
14787   const T17 v17_;
14788   const T18 v18_;
14789   const T19 v19_;
14790   const T20 v20_;
14791   const T21 v21_;
14792   const T22 v22_;
14793   const T23 v23_;
14794   const T24 v24_;
14795   const T25 v25_;
14796   const T26 v26_;
14797   const T27 v27_;
14798   const T28 v28_;
14799   const T29 v29_;
14800   const T30 v30_;
14801   const T31 v31_;
14802   const T32 v32_;
14803   const T33 v33_;
14804   const T34 v34_;
14805   const T35 v35_;
14806   const T36 v36_;
14807   const T37 v37_;
14808   const T38 v38_;
14809   const T39 v39_;
14810   const T40 v40_;
14811   const T41 v41_;
14812   const T42 v42_;
14813   const T43 v43_;
14814   const T44 v44_;
14815   const T45 v45_;
14816   const T46 v46_;
14817   const T47 v47_;
14818   const T48 v48_;
14819   const T49 v49_;
14820 };
14821 
14822 template <typename T1, typename T2, typename T3, typename T4, typename T5,
14823     typename T6, typename T7, typename T8, typename T9, typename T10,
14824     typename T11, typename T12, typename T13, typename T14, typename T15,
14825     typename T16, typename T17, typename T18, typename T19, typename T20,
14826     typename T21, typename T22, typename T23, typename T24, typename T25,
14827     typename T26, typename T27, typename T28, typename T29, typename T30,
14828     typename T31, typename T32, typename T33, typename T34, typename T35,
14829     typename T36, typename T37, typename T38, typename T39, typename T40,
14830     typename T41, typename T42, typename T43, typename T44, typename T45,
14831     typename T46, typename T47, typename T48, typename T49, typename T50>
14832 class ValueArray50 {
14833  public:
14834   ValueArray50(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
14835       T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
14836       T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
14837       T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33,
14838       T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39, T40 v40, T41 v41,
14839       T42 v42, T43 v43, T44 v44, T45 v45, T46 v46, T47 v47, T48 v48, T49 v49,
14840       T50 v50) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7),
14841       v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v14),
14842       v15_(v15), v16_(v16), v17_(v17), v18_(v18), v19_(v19), v20_(v20),
14843       v21_(v21), v22_(v22), v23_(v23), v24_(v24), v25_(v25), v26_(v26),
14844       v27_(v27), v28_(v28), v29_(v29), v30_(v30), v31_(v31), v32_(v32),
14845       v33_(v33), v34_(v34), v35_(v35), v36_(v36), v37_(v37), v38_(v38),
14846       v39_(v39), v40_(v40), v41_(v41), v42_(v42), v43_(v43), v44_(v44),
14847       v45_(v45), v46_(v46), v47_(v47), v48_(v48), v49_(v49), v50_(v50) {}
14848 
14849   template <typename T>
14850   operator ParamGenerator<T>() const {
14851     const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
14852         static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
14853         static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
14854         static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
14855         static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
14856         static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
14857         static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
14858         static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
14859         static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),
14860         static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_),
14861         static_cast<T>(v30_), static_cast<T>(v31_), static_cast<T>(v32_),
14862         static_cast<T>(v33_), static_cast<T>(v34_), static_cast<T>(v35_),
14863         static_cast<T>(v36_), static_cast<T>(v37_), static_cast<T>(v38_),
14864         static_cast<T>(v39_), static_cast<T>(v40_), static_cast<T>(v41_),
14865         static_cast<T>(v42_), static_cast<T>(v43_), static_cast<T>(v44_),
14866         static_cast<T>(v45_), static_cast<T>(v46_), static_cast<T>(v47_),
14867         static_cast<T>(v48_), static_cast<T>(v49_), static_cast<T>(v50_)};
14868     return ValuesIn(array);
14869   }
14870 
14871  private:
14872   // No implementation - assignment is unsupported.
14873   void operator=(const ValueArray50& other);
14874 
14875   const T1 v1_;
14876   const T2 v2_;
14877   const T3 v3_;
14878   const T4 v4_;
14879   const T5 v5_;
14880   const T6 v6_;
14881   const T7 v7_;
14882   const T8 v8_;
14883   const T9 v9_;
14884   const T10 v10_;
14885   const T11 v11_;
14886   const T12 v12_;
14887   const T13 v13_;
14888   const T14 v14_;
14889   const T15 v15_;
14890   const T16 v16_;
14891   const T17 v17_;
14892   const T18 v18_;
14893   const T19 v19_;
14894   const T20 v20_;
14895   const T21 v21_;
14896   const T22 v22_;
14897   const T23 v23_;
14898   const T24 v24_;
14899   const T25 v25_;
14900   const T26 v26_;
14901   const T27 v27_;
14902   const T28 v28_;
14903   const T29 v29_;
14904   const T30 v30_;
14905   const T31 v31_;
14906   const T32 v32_;
14907   const T33 v33_;
14908   const T34 v34_;
14909   const T35 v35_;
14910   const T36 v36_;
14911   const T37 v37_;
14912   const T38 v38_;
14913   const T39 v39_;
14914   const T40 v40_;
14915   const T41 v41_;
14916   const T42 v42_;
14917   const T43 v43_;
14918   const T44 v44_;
14919   const T45 v45_;
14920   const T46 v46_;
14921   const T47 v47_;
14922   const T48 v48_;
14923   const T49 v49_;
14924   const T50 v50_;
14925 };
14926 
14927 # if GTEST_HAS_COMBINE
14928 // INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.
14929 //
14930 // Generates values from the Cartesian product of values produced
14931 // by the argument generators.
14932 //
14933 template <typename T1, typename T2>
14934 class CartesianProductGenerator2
14935     : public ParamGeneratorInterface< ::testing::tuple<T1, T2> > {
14936  public:
14937   typedef ::testing::tuple<T1, T2> ParamType;
14938 
14939   CartesianProductGenerator2(const ParamGenerator<T1>& g1,
14940       const ParamGenerator<T2>& g2)
14941       : g1_(g1), g2_(g2) {}
14942   virtual ~CartesianProductGenerator2() {}
14943 
14944   virtual ParamIteratorInterface<ParamType>* Begin() const {
14945     return new Iterator(this, g1_, g1_.begin(), g2_, g2_.begin());
14946   }
14947   virtual ParamIteratorInterface<ParamType>* End() const {
14948     return new Iterator(this, g1_, g1_.end(), g2_, g2_.end());
14949   }
14950 
14951  private:
14952   class Iterator : public ParamIteratorInterface<ParamType> {
14953    public:
14954     Iterator(const ParamGeneratorInterface<ParamType>* base,
14955       const ParamGenerator<T1>& g1,
14956       const typename ParamGenerator<T1>::iterator& current1,
14957       const ParamGenerator<T2>& g2,
14958       const typename ParamGenerator<T2>::iterator& current2)
14959         : base_(base),
14960           begin1_(g1.begin()), end1_(g1.end()), current1_(current1),
14961           begin2_(g2.begin()), end2_(g2.end()), current2_(current2)    {
14962       ComputeCurrentValue();
14963     }
14964     virtual ~Iterator() {}
14965 
14966     virtual const ParamGeneratorInterface<ParamType>* BaseGenerator() const {
14967       return base_;
14968     }
14969     // Advance should not be called on beyond-of-range iterators
14970     // so no component iterators must be beyond end of range, either.
14971     virtual void Advance() {
14972       assert(!AtEnd());
14973       ++current2_;
14974       if (current2_ == end2_) {
14975         current2_ = begin2_;
14976         ++current1_;
14977       }
14978       ComputeCurrentValue();
14979     }
14980     virtual ParamIteratorInterface<ParamType>* Clone() const {
14981       return new Iterator(*this);
14982     }
14983     virtual const ParamType* Current() const { return &current_value_; }
14984     virtual bool Equals(const ParamIteratorInterface<ParamType>& other) const {
14985       // Having the same base generator guarantees that the other
14986       // iterator is of the same type and we can downcast.
14987       GTEST_CHECK_(BaseGenerator() == other.BaseGenerator())
14988           << "The program attempted to compare iterators "
14989           << "from different generators." << std::endl;
14990       const Iterator* typed_other =
14991           CheckedDowncastToActualType<const Iterator>(&other);
14992       // We must report iterators equal if they both point beyond their
14993       // respective ranges. That can happen in a variety of fashions,
14994       // so we have to consult AtEnd().
14995       return (AtEnd() && typed_other->AtEnd()) ||
14996          (
14997           current1_ == typed_other->current1_ &&
14998           current2_ == typed_other->current2_);
14999     }
15000 
15001    private:
15002     Iterator(const Iterator& other)
15003         : base_(other.base_),
15004         begin1_(other.begin1_),
15005         end1_(other.end1_),
15006         current1_(other.current1_),
15007         begin2_(other.begin2_),
15008         end2_(other.end2_),
15009         current2_(other.current2_) {
15010       ComputeCurrentValue();
15011     }
15012 
15013     void ComputeCurrentValue() {
15014       if (!AtEnd())
15015         current_value_ = ParamType(*current1_, *current2_);
15016     }
15017     bool AtEnd() const {
15018       // We must report iterator past the end of the range when either of the
15019       // component iterators has reached the end of its range.
15020       return
15021           current1_ == end1_ ||
15022           current2_ == end2_;
15023     }
15024 
15025     // No implementation - assignment is unsupported.
15026     void operator=(const Iterator& other);
15027 
15028     const ParamGeneratorInterface<ParamType>* const base_;
15029     // begin[i]_ and end[i]_ define the i-th range that Iterator traverses.
15030     // current[i]_ is the actual traversing iterator.
15031     const typename ParamGenerator<T1>::iterator begin1_;
15032     const typename ParamGenerator<T1>::iterator end1_;
15033     typename ParamGenerator<T1>::iterator current1_;
15034     const typename ParamGenerator<T2>::iterator begin2_;
15035     const typename ParamGenerator<T2>::iterator end2_;
15036     typename ParamGenerator<T2>::iterator current2_;
15037     ParamType current_value_;
15038   };  // class CartesianProductGenerator2::Iterator
15039 
15040   // No implementation - assignment is unsupported.
15041   void operator=(const CartesianProductGenerator2& other);
15042 
15043   const ParamGenerator<T1> g1_;
15044   const ParamGenerator<T2> g2_;
15045 };  // class CartesianProductGenerator2
15046 
15047 
15048 template <typename T1, typename T2, typename T3>
15049 class CartesianProductGenerator3
15050     : public ParamGeneratorInterface< ::testing::tuple<T1, T2, T3> > {
15051  public:
15052   typedef ::testing::tuple<T1, T2, T3> ParamType;
15053 
15054   CartesianProductGenerator3(const ParamGenerator<T1>& g1,
15055       const ParamGenerator<T2>& g2, const ParamGenerator<T3>& g3)
15056       : g1_(g1), g2_(g2), g3_(g3) {}
15057   virtual ~CartesianProductGenerator3() {}
15058 
15059   virtual ParamIteratorInterface<ParamType>* Begin() const {
15060     return new Iterator(this, g1_, g1_.begin(), g2_, g2_.begin(), g3_,
15061         g3_.begin());
15062   }
15063   virtual ParamIteratorInterface<ParamType>* End() const {
15064     return new Iterator(this, g1_, g1_.end(), g2_, g2_.end(), g3_, g3_.end());
15065   }
15066 
15067  private:
15068   class Iterator : public ParamIteratorInterface<ParamType> {
15069    public:
15070     Iterator(const ParamGeneratorInterface<ParamType>* base,
15071       const ParamGenerator<T1>& g1,
15072       const typename ParamGenerator<T1>::iterator& current1,
15073       const ParamGenerator<T2>& g2,
15074       const typename ParamGenerator<T2>::iterator& current2,
15075       const ParamGenerator<T3>& g3,
15076       const typename ParamGenerator<T3>::iterator& current3)
15077         : base_(base),
15078           begin1_(g1.begin()), end1_(g1.end()), current1_(current1),
15079           begin2_(g2.begin()), end2_(g2.end()), current2_(current2),
15080           begin3_(g3.begin()), end3_(g3.end()), current3_(current3)    {
15081       ComputeCurrentValue();
15082     }
15083     virtual ~Iterator() {}
15084 
15085     virtual const ParamGeneratorInterface<ParamType>* BaseGenerator() const {
15086       return base_;
15087     }
15088     // Advance should not be called on beyond-of-range iterators
15089     // so no component iterators must be beyond end of range, either.
15090     virtual void Advance() {
15091       assert(!AtEnd());
15092       ++current3_;
15093       if (current3_ == end3_) {
15094         current3_ = begin3_;
15095         ++current2_;
15096       }
15097       if (current2_ == end2_) {
15098         current2_ = begin2_;
15099         ++current1_;
15100       }
15101       ComputeCurrentValue();
15102     }
15103     virtual ParamIteratorInterface<ParamType>* Clone() const {
15104       return new Iterator(*this);
15105     }
15106     virtual const ParamType* Current() const { return &current_value_; }
15107     virtual bool Equals(const ParamIteratorInterface<ParamType>& other) const {
15108       // Having the same base generator guarantees that the other
15109       // iterator is of the same type and we can downcast.
15110       GTEST_CHECK_(BaseGenerator() == other.BaseGenerator())
15111           << "The program attempted to compare iterators "
15112           << "from different generators." << std::endl;
15113       const Iterator* typed_other =
15114           CheckedDowncastToActualType<const Iterator>(&other);
15115       // We must report iterators equal if they both point beyond their
15116       // respective ranges. That can happen in a variety of fashions,
15117       // so we have to consult AtEnd().
15118       return (AtEnd() && typed_other->AtEnd()) ||
15119          (
15120           current1_ == typed_other->current1_ &&
15121           current2_ == typed_other->current2_ &&
15122           current3_ == typed_other->current3_);
15123     }
15124 
15125    private:
15126     Iterator(const Iterator& other)
15127         : base_(other.base_),
15128         begin1_(other.begin1_),
15129         end1_(other.end1_),
15130         current1_(other.current1_),
15131         begin2_(other.begin2_),
15132         end2_(other.end2_),
15133         current2_(other.current2_),
15134         begin3_(other.begin3_),
15135         end3_(other.end3_),
15136         current3_(other.current3_) {
15137       ComputeCurrentValue();
15138     }
15139 
15140     void ComputeCurrentValue() {
15141       if (!AtEnd())
15142         current_value_ = ParamType(*current1_, *current2_, *current3_);
15143     }
15144     bool AtEnd() const {
15145       // We must report iterator past the end of the range when either of the
15146       // component iterators has reached the end of its range.
15147       return
15148           current1_ == end1_ ||
15149           current2_ == end2_ ||
15150           current3_ == end3_;
15151     }
15152 
15153     // No implementation - assignment is unsupported.
15154     void operator=(const Iterator& other);
15155 
15156     const ParamGeneratorInterface<ParamType>* const base_;
15157     // begin[i]_ and end[i]_ define the i-th range that Iterator traverses.
15158     // current[i]_ is the actual traversing iterator.
15159     const typename ParamGenerator<T1>::iterator begin1_;
15160     const typename ParamGenerator<T1>::iterator end1_;
15161     typename ParamGenerator<T1>::iterator current1_;
15162     const typename ParamGenerator<T2>::iterator begin2_;
15163     const typename ParamGenerator<T2>::iterator end2_;
15164     typename ParamGenerator<T2>::iterator current2_;
15165     const typename ParamGenerator<T3>::iterator begin3_;
15166     const typename ParamGenerator<T3>::iterator end3_;
15167     typename ParamGenerator<T3>::iterator current3_;
15168     ParamType current_value_;
15169   };  // class CartesianProductGenerator3::Iterator
15170 
15171   // No implementation - assignment is unsupported.
15172   void operator=(const CartesianProductGenerator3& other);
15173 
15174   const ParamGenerator<T1> g1_;
15175   const ParamGenerator<T2> g2_;
15176   const ParamGenerator<T3> g3_;
15177 };  // class CartesianProductGenerator3
15178 
15179 
15180 template <typename T1, typename T2, typename T3, typename T4>
15181 class CartesianProductGenerator4
15182     : public ParamGeneratorInterface< ::testing::tuple<T1, T2, T3, T4> > {
15183  public:
15184   typedef ::testing::tuple<T1, T2, T3, T4> ParamType;
15185 
15186   CartesianProductGenerator4(const ParamGenerator<T1>& g1,
15187       const ParamGenerator<T2>& g2, const ParamGenerator<T3>& g3,
15188       const ParamGenerator<T4>& g4)
15189       : g1_(g1), g2_(g2), g3_(g3), g4_(g4) {}
15190   virtual ~CartesianProductGenerator4() {}
15191 
15192   virtual ParamIteratorInterface<ParamType>* Begin() const {
15193     return new Iterator(this, g1_, g1_.begin(), g2_, g2_.begin(), g3_,
15194         g3_.begin(), g4_, g4_.begin());
15195   }
15196   virtual ParamIteratorInterface<ParamType>* End() const {
15197     return new Iterator(this, g1_, g1_.end(), g2_, g2_.end(), g3_, g3_.end(),
15198         g4_, g4_.end());
15199   }
15200 
15201  private:
15202   class Iterator : public ParamIteratorInterface<ParamType> {
15203    public:
15204     Iterator(const ParamGeneratorInterface<ParamType>* base,
15205       const ParamGenerator<T1>& g1,
15206       const typename ParamGenerator<T1>::iterator& current1,
15207       const ParamGenerator<T2>& g2,
15208       const typename ParamGenerator<T2>::iterator& current2,
15209       const ParamGenerator<T3>& g3,
15210       const typename ParamGenerator<T3>::iterator& current3,
15211       const ParamGenerator<T4>& g4,
15212       const typename ParamGenerator<T4>::iterator& current4)
15213         : base_(base),
15214           begin1_(g1.begin()), end1_(g1.end()), current1_(current1),
15215           begin2_(g2.begin()), end2_(g2.end()), current2_(current2),
15216           begin3_(g3.begin()), end3_(g3.end()), current3_(current3),
15217           begin4_(g4.begin()), end4_(g4.end()), current4_(current4)    {
15218       ComputeCurrentValue();
15219     }
15220     virtual ~Iterator() {}
15221 
15222     virtual const ParamGeneratorInterface<ParamType>* BaseGenerator() const {
15223       return base_;
15224     }
15225     // Advance should not be called on beyond-of-range iterators
15226     // so no component iterators must be beyond end of range, either.
15227     virtual void Advance() {
15228       assert(!AtEnd());
15229       ++current4_;
15230       if (current4_ == end4_) {
15231         current4_ = begin4_;
15232         ++current3_;
15233       }
15234       if (current3_ == end3_) {
15235         current3_ = begin3_;
15236         ++current2_;
15237       }
15238       if (current2_ == end2_) {
15239         current2_ = begin2_;
15240         ++current1_;
15241       }
15242       ComputeCurrentValue();
15243     }
15244     virtual ParamIteratorInterface<ParamType>* Clone() const {
15245       return new Iterator(*this);
15246     }
15247     virtual const ParamType* Current() const { return &current_value_; }
15248     virtual bool Equals(const ParamIteratorInterface<ParamType>& other) const {
15249       // Having the same base generator guarantees that the other
15250       // iterator is of the same type and we can downcast.
15251       GTEST_CHECK_(BaseGenerator() == other.BaseGenerator())
15252           << "The program attempted to compare iterators "
15253           << "from different generators." << std::endl;
15254       const Iterator* typed_other =
15255           CheckedDowncastToActualType<const Iterator>(&other);
15256       // We must report iterators equal if they both point beyond their
15257       // respective ranges. That can happen in a variety of fashions,
15258       // so we have to consult AtEnd().
15259       return (AtEnd() && typed_other->AtEnd()) ||
15260          (
15261           current1_ == typed_other->current1_ &&
15262           current2_ == typed_other->current2_ &&
15263           current3_ == typed_other->current3_ &&
15264           current4_ == typed_other->current4_);
15265     }
15266 
15267    private:
15268     Iterator(const Iterator& other)
15269         : base_(other.base_),
15270         begin1_(other.begin1_),
15271         end1_(other.end1_),
15272         current1_(other.current1_),
15273         begin2_(other.begin2_),
15274         end2_(other.end2_),
15275         current2_(other.current2_),
15276         begin3_(other.begin3_),
15277         end3_(other.end3_),
15278         current3_(other.current3_),
15279         begin4_(other.begin4_),
15280         end4_(other.end4_),
15281         current4_(other.current4_) {
15282       ComputeCurrentValue();
15283     }
15284 
15285     void ComputeCurrentValue() {
15286       if (!AtEnd())
15287         current_value_ = ParamType(*current1_, *current2_, *current3_,
15288             *current4_);
15289     }
15290     bool AtEnd() const {
15291       // We must report iterator past the end of the range when either of the
15292       // component iterators has reached the end of its range.
15293       return
15294           current1_ == end1_ ||
15295           current2_ == end2_ ||
15296           current3_ == end3_ ||
15297           current4_ == end4_;
15298     }
15299 
15300     // No implementation - assignment is unsupported.
15301     void operator=(const Iterator& other);
15302 
15303     const ParamGeneratorInterface<ParamType>* const base_;
15304     // begin[i]_ and end[i]_ define the i-th range that Iterator traverses.
15305     // current[i]_ is the actual traversing iterator.
15306     const typename ParamGenerator<T1>::iterator begin1_;
15307     const typename ParamGenerator<T1>::iterator end1_;
15308     typename ParamGenerator<T1>::iterator current1_;
15309     const typename ParamGenerator<T2>::iterator begin2_;
15310     const typename ParamGenerator<T2>::iterator end2_;
15311     typename ParamGenerator<T2>::iterator current2_;
15312     const typename ParamGenerator<T3>::iterator begin3_;
15313     const typename ParamGenerator<T3>::iterator end3_;
15314     typename ParamGenerator<T3>::iterator current3_;
15315     const typename ParamGenerator<T4>::iterator begin4_;
15316     const typename ParamGenerator<T4>::iterator end4_;
15317     typename ParamGenerator<T4>::iterator current4_;
15318     ParamType current_value_;
15319   };  // class CartesianProductGenerator4::Iterator
15320 
15321   // No implementation - assignment is unsupported.
15322   void operator=(const CartesianProductGenerator4& other);
15323 
15324   const ParamGenerator<T1> g1_;
15325   const ParamGenerator<T2> g2_;
15326   const ParamGenerator<T3> g3_;
15327   const ParamGenerator<T4> g4_;
15328 };  // class CartesianProductGenerator4
15329 
15330 
15331 template <typename T1, typename T2, typename T3, typename T4, typename T5>
15332 class CartesianProductGenerator5
15333     : public ParamGeneratorInterface< ::testing::tuple<T1, T2, T3, T4, T5> > {
15334  public:
15335   typedef ::testing::tuple<T1, T2, T3, T4, T5> ParamType;
15336 
15337   CartesianProductGenerator5(const ParamGenerator<T1>& g1,
15338       const ParamGenerator<T2>& g2, const ParamGenerator<T3>& g3,
15339       const ParamGenerator<T4>& g4, const ParamGenerator<T5>& g5)
15340       : g1_(g1), g2_(g2), g3_(g3), g4_(g4), g5_(g5) {}
15341   virtual ~CartesianProductGenerator5() {}
15342 
15343   virtual ParamIteratorInterface<ParamType>* Begin() const {
15344     return new Iterator(this, g1_, g1_.begin(), g2_, g2_.begin(), g3_,
15345         g3_.begin(), g4_, g4_.begin(), g5_, g5_.begin());
15346   }
15347   virtual ParamIteratorInterface<ParamType>* End() const {
15348     return new Iterator(this, g1_, g1_.end(), g2_, g2_.end(), g3_, g3_.end(),
15349         g4_, g4_.end(), g5_, g5_.end());
15350   }
15351 
15352  private:
15353   class Iterator : public ParamIteratorInterface<ParamType> {
15354    public:
15355     Iterator(const ParamGeneratorInterface<ParamType>* base,
15356       const ParamGenerator<T1>& g1,
15357       const typename ParamGenerator<T1>::iterator& current1,
15358       const ParamGenerator<T2>& g2,
15359       const typename ParamGenerator<T2>::iterator& current2,
15360       const ParamGenerator<T3>& g3,
15361       const typename ParamGenerator<T3>::iterator& current3,
15362       const ParamGenerator<T4>& g4,
15363       const typename ParamGenerator<T4>::iterator& current4,
15364       const ParamGenerator<T5>& g5,
15365       const typename ParamGenerator<T5>::iterator& current5)
15366         : base_(base),
15367           begin1_(g1.begin()), end1_(g1.end()), current1_(current1),
15368           begin2_(g2.begin()), end2_(g2.end()), current2_(current2),
15369           begin3_(g3.begin()), end3_(g3.end()), current3_(current3),
15370           begin4_(g4.begin()), end4_(g4.end()), current4_(current4),
15371           begin5_(g5.begin()), end5_(g5.end()), current5_(current5)    {
15372       ComputeCurrentValue();
15373     }
15374     virtual ~Iterator() {}
15375 
15376     virtual const ParamGeneratorInterface<ParamType>* BaseGenerator() const {
15377       return base_;
15378     }
15379     // Advance should not be called on beyond-of-range iterators
15380     // so no component iterators must be beyond end of range, either.
15381     virtual void Advance() {
15382       assert(!AtEnd());
15383       ++current5_;
15384       if (current5_ == end5_) {
15385         current5_ = begin5_;
15386         ++current4_;
15387       }
15388       if (current4_ == end4_) {
15389         current4_ = begin4_;
15390         ++current3_;
15391       }
15392       if (current3_ == end3_) {
15393         current3_ = begin3_;
15394         ++current2_;
15395       }
15396       if (current2_ == end2_) {
15397         current2_ = begin2_;
15398         ++current1_;
15399       }
15400       ComputeCurrentValue();
15401     }
15402     virtual ParamIteratorInterface<ParamType>* Clone() const {
15403       return new Iterator(*this);
15404     }
15405     virtual const ParamType* Current() const { return &current_value_; }
15406     virtual bool Equals(const ParamIteratorInterface<ParamType>& other) const {
15407       // Having the same base generator guarantees that the other
15408       // iterator is of the same type and we can downcast.
15409       GTEST_CHECK_(BaseGenerator() == other.BaseGenerator())
15410           << "The program attempted to compare iterators "
15411           << "from different generators." << std::endl;
15412       const Iterator* typed_other =
15413           CheckedDowncastToActualType<const Iterator>(&other);
15414       // We must report iterators equal if they both point beyond their
15415       // respective ranges. That can happen in a variety of fashions,
15416       // so we have to consult AtEnd().
15417       return (AtEnd() && typed_other->AtEnd()) ||
15418          (
15419           current1_ == typed_other->current1_ &&
15420           current2_ == typed_other->current2_ &&
15421           current3_ == typed_other->current3_ &&
15422           current4_ == typed_other->current4_ &&
15423           current5_ == typed_other->current5_);
15424     }
15425 
15426    private:
15427     Iterator(const Iterator& other)
15428         : base_(other.base_),
15429         begin1_(other.begin1_),
15430         end1_(other.end1_),
15431         current1_(other.current1_),
15432         begin2_(other.begin2_),
15433         end2_(other.end2_),
15434         current2_(other.current2_),
15435         begin3_(other.begin3_),
15436         end3_(other.end3_),
15437         current3_(other.current3_),
15438         begin4_(other.begin4_),
15439         end4_(other.end4_),
15440         current4_(other.current4_),
15441         begin5_(other.begin5_),
15442         end5_(other.end5_),
15443         current5_(other.current5_) {
15444       ComputeCurrentValue();
15445     }
15446 
15447     void ComputeCurrentValue() {
15448       if (!AtEnd())
15449         current_value_ = ParamType(*current1_, *current2_, *current3_,
15450             *current4_, *current5_);
15451     }
15452     bool AtEnd() const {
15453       // We must report iterator past the end of the range when either of the
15454       // component iterators has reached the end of its range.
15455       return
15456           current1_ == end1_ ||
15457           current2_ == end2_ ||
15458           current3_ == end3_ ||
15459           current4_ == end4_ ||
15460           current5_ == end5_;
15461     }
15462 
15463     // No implementation - assignment is unsupported.
15464     void operator=(const Iterator& other);
15465 
15466     const ParamGeneratorInterface<ParamType>* const base_;
15467     // begin[i]_ and end[i]_ define the i-th range that Iterator traverses.
15468     // current[i]_ is the actual traversing iterator.
15469     const typename ParamGenerator<T1>::iterator begin1_;
15470     const typename ParamGenerator<T1>::iterator end1_;
15471     typename ParamGenerator<T1>::iterator current1_;
15472     const typename ParamGenerator<T2>::iterator begin2_;
15473     const typename ParamGenerator<T2>::iterator end2_;
15474     typename ParamGenerator<T2>::iterator current2_;
15475     const typename ParamGenerator<T3>::iterator begin3_;
15476     const typename ParamGenerator<T3>::iterator end3_;
15477     typename ParamGenerator<T3>::iterator current3_;
15478     const typename ParamGenerator<T4>::iterator begin4_;
15479     const typename ParamGenerator<T4>::iterator end4_;
15480     typename ParamGenerator<T4>::iterator current4_;
15481     const typename ParamGenerator<T5>::iterator begin5_;
15482     const typename ParamGenerator<T5>::iterator end5_;
15483     typename ParamGenerator<T5>::iterator current5_;
15484     ParamType current_value_;
15485   };  // class CartesianProductGenerator5::Iterator
15486 
15487   // No implementation - assignment is unsupported.
15488   void operator=(const CartesianProductGenerator5& other);
15489 
15490   const ParamGenerator<T1> g1_;
15491   const ParamGenerator<T2> g2_;
15492   const ParamGenerator<T3> g3_;
15493   const ParamGenerator<T4> g4_;
15494   const ParamGenerator<T5> g5_;
15495 };  // class CartesianProductGenerator5
15496 
15497 
15498 template <typename T1, typename T2, typename T3, typename T4, typename T5,
15499     typename T6>
15500 class CartesianProductGenerator6
15501     : public ParamGeneratorInterface< ::testing::tuple<T1, T2, T3, T4, T5,
15502         T6> > {
15503  public:
15504   typedef ::testing::tuple<T1, T2, T3, T4, T5, T6> ParamType;
15505 
15506   CartesianProductGenerator6(const ParamGenerator<T1>& g1,
15507       const ParamGenerator<T2>& g2, const ParamGenerator<T3>& g3,
15508       const ParamGenerator<T4>& g4, const ParamGenerator<T5>& g5,
15509       const ParamGenerator<T6>& g6)
15510       : g1_(g1), g2_(g2), g3_(g3), g4_(g4), g5_(g5), g6_(g6) {}
15511   virtual ~CartesianProductGenerator6() {}
15512 
15513   virtual ParamIteratorInterface<ParamType>* Begin() const {
15514     return new Iterator(this, g1_, g1_.begin(), g2_, g2_.begin(), g3_,
15515         g3_.begin(), g4_, g4_.begin(), g5_, g5_.begin(), g6_, g6_.begin());
15516   }
15517   virtual ParamIteratorInterface<ParamType>* End() const {
15518     return new Iterator(this, g1_, g1_.end(), g2_, g2_.end(), g3_, g3_.end(),
15519         g4_, g4_.end(), g5_, g5_.end(), g6_, g6_.end());
15520   }
15521 
15522  private:
15523   class Iterator : public ParamIteratorInterface<ParamType> {
15524    public:
15525     Iterator(const ParamGeneratorInterface<ParamType>* base,
15526       const ParamGenerator<T1>& g1,
15527       const typename ParamGenerator<T1>::iterator& current1,
15528       const ParamGenerator<T2>& g2,
15529       const typename ParamGenerator<T2>::iterator& current2,
15530       const ParamGenerator<T3>& g3,
15531       const typename ParamGenerator<T3>::iterator& current3,
15532       const ParamGenerator<T4>& g4,
15533       const typename ParamGenerator<T4>::iterator& current4,
15534       const ParamGenerator<T5>& g5,
15535       const typename ParamGenerator<T5>::iterator& current5,
15536       const ParamGenerator<T6>& g6,
15537       const typename ParamGenerator<T6>::iterator& current6)
15538         : base_(base),
15539           begin1_(g1.begin()), end1_(g1.end()), current1_(current1),
15540           begin2_(g2.begin()), end2_(g2.end()), current2_(current2),
15541           begin3_(g3.begin()), end3_(g3.end()), current3_(current3),
15542           begin4_(g4.begin()), end4_(g4.end()), current4_(current4),
15543           begin5_(g5.begin()), end5_(g5.end()), current5_(current5),
15544           begin6_(g6.begin()), end6_(g6.end()), current6_(current6)    {
15545       ComputeCurrentValue();
15546     }
15547     virtual ~Iterator() {}
15548 
15549     virtual const ParamGeneratorInterface<ParamType>* BaseGenerator() const {
15550       return base_;
15551     }
15552     // Advance should not be called on beyond-of-range iterators
15553     // so no component iterators must be beyond end of range, either.
15554     virtual void Advance() {
15555       assert(!AtEnd());
15556       ++current6_;
15557       if (current6_ == end6_) {
15558         current6_ = begin6_;
15559         ++current5_;
15560       }
15561       if (current5_ == end5_) {
15562         current5_ = begin5_;
15563         ++current4_;
15564       }
15565       if (current4_ == end4_) {
15566         current4_ = begin4_;
15567         ++current3_;
15568       }
15569       if (current3_ == end3_) {
15570         current3_ = begin3_;
15571         ++current2_;
15572       }
15573       if (current2_ == end2_) {
15574         current2_ = begin2_;
15575         ++current1_;
15576       }
15577       ComputeCurrentValue();
15578     }
15579     virtual ParamIteratorInterface<ParamType>* Clone() const {
15580       return new Iterator(*this);
15581     }
15582     virtual const ParamType* Current() const { return &current_value_; }
15583     virtual bool Equals(const ParamIteratorInterface<ParamType>& other) const {
15584       // Having the same base generator guarantees that the other
15585       // iterator is of the same type and we can downcast.
15586       GTEST_CHECK_(BaseGenerator() == other.BaseGenerator())
15587           << "The program attempted to compare iterators "
15588           << "from different generators." << std::endl;
15589       const Iterator* typed_other =
15590           CheckedDowncastToActualType<const Iterator>(&other);
15591       // We must report iterators equal if they both point beyond their
15592       // respective ranges. That can happen in a variety of fashions,
15593       // so we have to consult AtEnd().
15594       return (AtEnd() && typed_other->AtEnd()) ||
15595          (
15596           current1_ == typed_other->current1_ &&
15597           current2_ == typed_other->current2_ &&
15598           current3_ == typed_other->current3_ &&
15599           current4_ == typed_other->current4_ &&
15600           current5_ == typed_other->current5_ &&
15601           current6_ == typed_other->current6_);
15602     }
15603 
15604    private:
15605     Iterator(const Iterator& other)
15606         : base_(other.base_),
15607         begin1_(other.begin1_),
15608         end1_(other.end1_),
15609         current1_(other.current1_),
15610         begin2_(other.begin2_),
15611         end2_(other.end2_),
15612         current2_(other.current2_),
15613         begin3_(other.begin3_),
15614         end3_(other.end3_),
15615         current3_(other.current3_),
15616         begin4_(other.begin4_),
15617         end4_(other.end4_),
15618         current4_(other.current4_),
15619         begin5_(other.begin5_),
15620         end5_(other.end5_),
15621         current5_(other.current5_),
15622         begin6_(other.begin6_),
15623         end6_(other.end6_),
15624         current6_(other.current6_) {
15625       ComputeCurrentValue();
15626     }
15627 
15628     void ComputeCurrentValue() {
15629       if (!AtEnd())
15630         current_value_ = ParamType(*current1_, *current2_, *current3_,
15631             *current4_, *current5_, *current6_);
15632     }
15633     bool AtEnd() const {
15634       // We must report iterator past the end of the range when either of the
15635       // component iterators has reached the end of its range.
15636       return
15637           current1_ == end1_ ||
15638           current2_ == end2_ ||
15639           current3_ == end3_ ||
15640           current4_ == end4_ ||
15641           current5_ == end5_ ||
15642           current6_ == end6_;
15643     }
15644 
15645     // No implementation - assignment is unsupported.
15646     void operator=(const Iterator& other);
15647 
15648     const ParamGeneratorInterface<ParamType>* const base_;
15649     // begin[i]_ and end[i]_ define the i-th range that Iterator traverses.
15650     // current[i]_ is the actual traversing iterator.
15651     const typename ParamGenerator<T1>::iterator begin1_;
15652     const typename ParamGenerator<T1>::iterator end1_;
15653     typename ParamGenerator<T1>::iterator current1_;
15654     const typename ParamGenerator<T2>::iterator begin2_;
15655     const typename ParamGenerator<T2>::iterator end2_;
15656     typename ParamGenerator<T2>::iterator current2_;
15657     const typename ParamGenerator<T3>::iterator begin3_;
15658     const typename ParamGenerator<T3>::iterator end3_;
15659     typename ParamGenerator<T3>::iterator current3_;
15660     const typename ParamGenerator<T4>::iterator begin4_;
15661     const typename ParamGenerator<T4>::iterator end4_;
15662     typename ParamGenerator<T4>::iterator current4_;
15663     const typename ParamGenerator<T5>::iterator begin5_;
15664     const typename ParamGenerator<T5>::iterator end5_;
15665     typename ParamGenerator<T5>::iterator current5_;
15666     const typename ParamGenerator<T6>::iterator begin6_;
15667     const typename ParamGenerator<T6>::iterator end6_;
15668     typename ParamGenerator<T6>::iterator current6_;
15669     ParamType current_value_;
15670   };  // class CartesianProductGenerator6::Iterator
15671 
15672   // No implementation - assignment is unsupported.
15673   void operator=(const CartesianProductGenerator6& other);
15674 
15675   const ParamGenerator<T1> g1_;
15676   const ParamGenerator<T2> g2_;
15677   const ParamGenerator<T3> g3_;
15678   const ParamGenerator<T4> g4_;
15679   const ParamGenerator<T5> g5_;
15680   const ParamGenerator<T6> g6_;
15681 };  // class CartesianProductGenerator6
15682 
15683 
15684 template <typename T1, typename T2, typename T3, typename T4, typename T5,
15685     typename T6, typename T7>
15686 class CartesianProductGenerator7
15687     : public ParamGeneratorInterface< ::testing::tuple<T1, T2, T3, T4, T5, T6,
15688         T7> > {
15689  public:
15690   typedef ::testing::tuple<T1, T2, T3, T4, T5, T6, T7> ParamType;
15691 
15692   CartesianProductGenerator7(const ParamGenerator<T1>& g1,
15693       const ParamGenerator<T2>& g2, const ParamGenerator<T3>& g3,
15694       const ParamGenerator<T4>& g4, const ParamGenerator<T5>& g5,
15695       const ParamGenerator<T6>& g6, const ParamGenerator<T7>& g7)
15696       : g1_(g1), g2_(g2), g3_(g3), g4_(g4), g5_(g5), g6_(g6), g7_(g7) {}
15697   virtual ~CartesianProductGenerator7() {}
15698 
15699   virtual ParamIteratorInterface<ParamType>* Begin() const {
15700     return new Iterator(this, g1_, g1_.begin(), g2_, g2_.begin(), g3_,
15701         g3_.begin(), g4_, g4_.begin(), g5_, g5_.begin(), g6_, g6_.begin(), g7_,
15702         g7_.begin());
15703   }
15704   virtual ParamIteratorInterface<ParamType>* End() const {
15705     return new Iterator(this, g1_, g1_.end(), g2_, g2_.end(), g3_, g3_.end(),
15706         g4_, g4_.end(), g5_, g5_.end(), g6_, g6_.end(), g7_, g7_.end());
15707   }
15708 
15709  private:
15710   class Iterator : public ParamIteratorInterface<ParamType> {
15711    public:
15712     Iterator(const ParamGeneratorInterface<ParamType>* base,
15713       const ParamGenerator<T1>& g1,
15714       const typename ParamGenerator<T1>::iterator& current1,
15715       const ParamGenerator<T2>& g2,
15716       const typename ParamGenerator<T2>::iterator& current2,
15717       const ParamGenerator<T3>& g3,
15718       const typename ParamGenerator<T3>::iterator& current3,
15719       const ParamGenerator<T4>& g4,
15720       const typename ParamGenerator<T4>::iterator& current4,
15721       const ParamGenerator<T5>& g5,
15722       const typename ParamGenerator<T5>::iterator& current5,
15723       const ParamGenerator<T6>& g6,
15724       const typename ParamGenerator<T6>::iterator& current6,
15725       const ParamGenerator<T7>& g7,
15726       const typename ParamGenerator<T7>::iterator& current7)
15727         : base_(base),
15728           begin1_(g1.begin()), end1_(g1.end()), current1_(current1),
15729           begin2_(g2.begin()), end2_(g2.end()), current2_(current2),
15730           begin3_(g3.begin()), end3_(g3.end()), current3_(current3),
15731           begin4_(g4.begin()), end4_(g4.end()), current4_(current4),
15732           begin5_(g5.begin()), end5_(g5.end()), current5_(current5),
15733           begin6_(g6.begin()), end6_(g6.end()), current6_(current6),
15734           begin7_(g7.begin()), end7_(g7.end()), current7_(current7)    {
15735       ComputeCurrentValue();
15736     }
15737     virtual ~Iterator() {}
15738 
15739     virtual const ParamGeneratorInterface<ParamType>* BaseGenerator() const {
15740       return base_;
15741     }
15742     // Advance should not be called on beyond-of-range iterators
15743     // so no component iterators must be beyond end of range, either.
15744     virtual void Advance() {
15745       assert(!AtEnd());
15746       ++current7_;
15747       if (current7_ == end7_) {
15748         current7_ = begin7_;
15749         ++current6_;
15750       }
15751       if (current6_ == end6_) {
15752         current6_ = begin6_;
15753         ++current5_;
15754       }
15755       if (current5_ == end5_) {
15756         current5_ = begin5_;
15757         ++current4_;
15758       }
15759       if (current4_ == end4_) {
15760         current4_ = begin4_;
15761         ++current3_;
15762       }
15763       if (current3_ == end3_) {
15764         current3_ = begin3_;
15765         ++current2_;
15766       }
15767       if (current2_ == end2_) {
15768         current2_ = begin2_;
15769         ++current1_;
15770       }
15771       ComputeCurrentValue();
15772     }
15773     virtual ParamIteratorInterface<ParamType>* Clone() const {
15774       return new Iterator(*this);
15775     }
15776     virtual const ParamType* Current() const { return &current_value_; }
15777     virtual bool Equals(const ParamIteratorInterface<ParamType>& other) const {
15778       // Having the same base generator guarantees that the other
15779       // iterator is of the same type and we can downcast.
15780       GTEST_CHECK_(BaseGenerator() == other.BaseGenerator())
15781           << "The program attempted to compare iterators "
15782           << "from different generators." << std::endl;
15783       const Iterator* typed_other =
15784           CheckedDowncastToActualType<const Iterator>(&other);
15785       // We must report iterators equal if they both point beyond their
15786       // respective ranges. That can happen in a variety of fashions,
15787       // so we have to consult AtEnd().
15788       return (AtEnd() && typed_other->AtEnd()) ||
15789          (
15790           current1_ == typed_other->current1_ &&
15791           current2_ == typed_other->current2_ &&
15792           current3_ == typed_other->current3_ &&
15793           current4_ == typed_other->current4_ &&
15794           current5_ == typed_other->current5_ &&
15795           current6_ == typed_other->current6_ &&
15796           current7_ == typed_other->current7_);
15797     }
15798 
15799    private:
15800     Iterator(const Iterator& other)
15801         : base_(other.base_),
15802         begin1_(other.begin1_),
15803         end1_(other.end1_),
15804         current1_(other.current1_),
15805         begin2_(other.begin2_),
15806         end2_(other.end2_),
15807         current2_(other.current2_),
15808         begin3_(other.begin3_),
15809         end3_(other.end3_),
15810         current3_(other.current3_),
15811         begin4_(other.begin4_),
15812         end4_(other.end4_),
15813         current4_(other.current4_),
15814         begin5_(other.begin5_),
15815         end5_(other.end5_),
15816         current5_(other.current5_),
15817         begin6_(other.begin6_),
15818         end6_(other.end6_),
15819         current6_(other.current6_),
15820         begin7_(other.begin7_),
15821         end7_(other.end7_),
15822         current7_(other.current7_) {
15823       ComputeCurrentValue();
15824     }
15825 
15826     void ComputeCurrentValue() {
15827       if (!AtEnd())
15828         current_value_ = ParamType(*current1_, *current2_, *current3_,
15829             *current4_, *current5_, *current6_, *current7_);
15830     }
15831     bool AtEnd() const {
15832       // We must report iterator past the end of the range when either of the
15833       // component iterators has reached the end of its range.
15834       return
15835           current1_ == end1_ ||
15836           current2_ == end2_ ||
15837           current3_ == end3_ ||
15838           current4_ == end4_ ||
15839           current5_ == end5_ ||
15840           current6_ == end6_ ||
15841           current7_ == end7_;
15842     }
15843 
15844     // No implementation - assignment is unsupported.
15845     void operator=(const Iterator& other);
15846 
15847     const ParamGeneratorInterface<ParamType>* const base_;
15848     // begin[i]_ and end[i]_ define the i-th range that Iterator traverses.
15849     // current[i]_ is the actual traversing iterator.
15850     const typename ParamGenerator<T1>::iterator begin1_;
15851     const typename ParamGenerator<T1>::iterator end1_;
15852     typename ParamGenerator<T1>::iterator current1_;
15853     const typename ParamGenerator<T2>::iterator begin2_;
15854     const typename ParamGenerator<T2>::iterator end2_;
15855     typename ParamGenerator<T2>::iterator current2_;
15856     const typename ParamGenerator<T3>::iterator begin3_;
15857     const typename ParamGenerator<T3>::iterator end3_;
15858     typename ParamGenerator<T3>::iterator current3_;
15859     const typename ParamGenerator<T4>::iterator begin4_;
15860     const typename ParamGenerator<T4>::iterator end4_;
15861     typename ParamGenerator<T4>::iterator current4_;
15862     const typename ParamGenerator<T5>::iterator begin5_;
15863     const typename ParamGenerator<T5>::iterator end5_;
15864     typename ParamGenerator<T5>::iterator current5_;
15865     const typename ParamGenerator<T6>::iterator begin6_;
15866     const typename ParamGenerator<T6>::iterator end6_;
15867     typename ParamGenerator<T6>::iterator current6_;
15868     const typename ParamGenerator<T7>::iterator begin7_;
15869     const typename ParamGenerator<T7>::iterator end7_;
15870     typename ParamGenerator<T7>::iterator current7_;
15871     ParamType current_value_;
15872   };  // class CartesianProductGenerator7::Iterator
15873 
15874   // No implementation - assignment is unsupported.
15875   void operator=(const CartesianProductGenerator7& other);
15876 
15877   const ParamGenerator<T1> g1_;
15878   const ParamGenerator<T2> g2_;
15879   const ParamGenerator<T3> g3_;
15880   const ParamGenerator<T4> g4_;
15881   const ParamGenerator<T5> g5_;
15882   const ParamGenerator<T6> g6_;
15883   const ParamGenerator<T7> g7_;
15884 };  // class CartesianProductGenerator7
15885 
15886 
15887 template <typename T1, typename T2, typename T3, typename T4, typename T5,
15888     typename T6, typename T7, typename T8>
15889 class CartesianProductGenerator8
15890     : public ParamGeneratorInterface< ::testing::tuple<T1, T2, T3, T4, T5, T6,
15891         T7, T8> > {
15892  public:
15893   typedef ::testing::tuple<T1, T2, T3, T4, T5, T6, T7, T8> ParamType;
15894 
15895   CartesianProductGenerator8(const ParamGenerator<T1>& g1,
15896       const ParamGenerator<T2>& g2, const ParamGenerator<T3>& g3,
15897       const ParamGenerator<T4>& g4, const ParamGenerator<T5>& g5,
15898       const ParamGenerator<T6>& g6, const ParamGenerator<T7>& g7,
15899       const ParamGenerator<T8>& g8)
15900       : g1_(g1), g2_(g2), g3_(g3), g4_(g4), g5_(g5), g6_(g6), g7_(g7),
15901           g8_(g8) {}
15902   virtual ~CartesianProductGenerator8() {}
15903 
15904   virtual ParamIteratorInterface<ParamType>* Begin() const {
15905     return new Iterator(this, g1_, g1_.begin(), g2_, g2_.begin(), g3_,
15906         g3_.begin(), g4_, g4_.begin(), g5_, g5_.begin(), g6_, g6_.begin(), g7_,
15907         g7_.begin(), g8_, g8_.begin());
15908   }
15909   virtual ParamIteratorInterface<ParamType>* End() const {
15910     return new Iterator(this, g1_, g1_.end(), g2_, g2_.end(), g3_, g3_.end(),
15911         g4_, g4_.end(), g5_, g5_.end(), g6_, g6_.end(), g7_, g7_.end(), g8_,
15912         g8_.end());
15913   }
15914 
15915  private:
15916   class Iterator : public ParamIteratorInterface<ParamType> {
15917    public:
15918     Iterator(const ParamGeneratorInterface<ParamType>* base,
15919       const ParamGenerator<T1>& g1,
15920       const typename ParamGenerator<T1>::iterator& current1,
15921       const ParamGenerator<T2>& g2,
15922       const typename ParamGenerator<T2>::iterator& current2,
15923       const ParamGenerator<T3>& g3,
15924       const typename ParamGenerator<T3>::iterator& current3,
15925       const ParamGenerator<T4>& g4,
15926       const typename ParamGenerator<T4>::iterator& current4,
15927       const ParamGenerator<T5>& g5,
15928       const typename ParamGenerator<T5>::iterator& current5,
15929       const ParamGenerator<T6>& g6,
15930       const typename ParamGenerator<T6>::iterator& current6,
15931       const ParamGenerator<T7>& g7,
15932       const typename ParamGenerator<T7>::iterator& current7,
15933       const ParamGenerator<T8>& g8,
15934       const typename ParamGenerator<T8>::iterator& current8)
15935         : base_(base),
15936           begin1_(g1.begin()), end1_(g1.end()), current1_(current1),
15937           begin2_(g2.begin()), end2_(g2.end()), current2_(current2),
15938           begin3_(g3.begin()), end3_(g3.end()), current3_(current3),
15939           begin4_(g4.begin()), end4_(g4.end()), current4_(current4),
15940           begin5_(g5.begin()), end5_(g5.end()), current5_(current5),
15941           begin6_(g6.begin()), end6_(g6.end()), current6_(current6),
15942           begin7_(g7.begin()), end7_(g7.end()), current7_(current7),
15943           begin8_(g8.begin()), end8_(g8.end()), current8_(current8)    {
15944       ComputeCurrentValue();
15945     }
15946     virtual ~Iterator() {}
15947 
15948     virtual const ParamGeneratorInterface<ParamType>* BaseGenerator() const {
15949       return base_;
15950     }
15951     // Advance should not be called on beyond-of-range iterators
15952     // so no component iterators must be beyond end of range, either.
15953     virtual void Advance() {
15954       assert(!AtEnd());
15955       ++current8_;
15956       if (current8_ == end8_) {
15957         current8_ = begin8_;
15958         ++current7_;
15959       }
15960       if (current7_ == end7_) {
15961         current7_ = begin7_;
15962         ++current6_;
15963       }
15964       if (current6_ == end6_) {
15965         current6_ = begin6_;
15966         ++current5_;
15967       }
15968       if (current5_ == end5_) {
15969         current5_ = begin5_;
15970         ++current4_;
15971       }
15972       if (current4_ == end4_) {
15973         current4_ = begin4_;
15974         ++current3_;
15975       }
15976       if (current3_ == end3_) {
15977         current3_ = begin3_;
15978         ++current2_;
15979       }
15980       if (current2_ == end2_) {
15981         current2_ = begin2_;
15982         ++current1_;
15983       }
15984       ComputeCurrentValue();
15985     }
15986     virtual ParamIteratorInterface<ParamType>* Clone() const {
15987       return new Iterator(*this);
15988     }
15989     virtual const ParamType* Current() const { return &current_value_; }
15990     virtual bool Equals(const ParamIteratorInterface<ParamType>& other) const {
15991       // Having the same base generator guarantees that the other
15992       // iterator is of the same type and we can downcast.
15993       GTEST_CHECK_(BaseGenerator() == other.BaseGenerator())
15994           << "The program attempted to compare iterators "
15995           << "from different generators." << std::endl;
15996       const Iterator* typed_other =
15997           CheckedDowncastToActualType<const Iterator>(&other);
15998       // We must report iterators equal if they both point beyond their
15999       // respective ranges. That can happen in a variety of fashions,
16000       // so we have to consult AtEnd().
16001       return (AtEnd() && typed_other->AtEnd()) ||
16002          (
16003           current1_ == typed_other->current1_ &&
16004           current2_ == typed_other->current2_ &&
16005           current3_ == typed_other->current3_ &&
16006           current4_ == typed_other->current4_ &&
16007           current5_ == typed_other->current5_ &&
16008           current6_ == typed_other->current6_ &&
16009           current7_ == typed_other->current7_ &&
16010           current8_ == typed_other->current8_);
16011     }
16012 
16013    private:
16014     Iterator(const Iterator& other)
16015         : base_(other.base_),
16016         begin1_(other.begin1_),
16017         end1_(other.end1_),
16018         current1_(other.current1_),
16019         begin2_(other.begin2_),
16020         end2_(other.end2_),
16021         current2_(other.current2_),
16022         begin3_(other.begin3_),
16023         end3_(other.end3_),
16024         current3_(other.current3_),
16025         begin4_(other.begin4_),
16026         end4_(other.end4_),
16027         current4_(other.current4_),
16028         begin5_(other.begin5_),
16029         end5_(other.end5_),
16030         current5_(other.current5_),
16031         begin6_(other.begin6_),
16032         end6_(other.end6_),
16033         current6_(other.current6_),
16034         begin7_(other.begin7_),
16035         end7_(other.end7_),
16036         current7_(other.current7_),
16037         begin8_(other.begin8_),
16038         end8_(other.end8_),
16039         current8_(other.current8_) {
16040       ComputeCurrentValue();
16041     }
16042 
16043     void ComputeCurrentValue() {
16044       if (!AtEnd())
16045         current_value_ = ParamType(*current1_, *current2_, *current3_,
16046             *current4_, *current5_, *current6_, *current7_, *current8_);
16047     }
16048     bool AtEnd() const {
16049       // We must report iterator past the end of the range when either of the
16050       // component iterators has reached the end of its range.
16051       return
16052           current1_ == end1_ ||
16053           current2_ == end2_ ||
16054           current3_ == end3_ ||
16055           current4_ == end4_ ||
16056           current5_ == end5_ ||
16057           current6_ == end6_ ||
16058           current7_ == end7_ ||
16059           current8_ == end8_;
16060     }
16061 
16062     // No implementation - assignment is unsupported.
16063     void operator=(const Iterator& other);
16064 
16065     const ParamGeneratorInterface<ParamType>* const base_;
16066     // begin[i]_ and end[i]_ define the i-th range that Iterator traverses.
16067     // current[i]_ is the actual traversing iterator.
16068     const typename ParamGenerator<T1>::iterator begin1_;
16069     const typename ParamGenerator<T1>::iterator end1_;
16070     typename ParamGenerator<T1>::iterator current1_;
16071     const typename ParamGenerator<T2>::iterator begin2_;
16072     const typename ParamGenerator<T2>::iterator end2_;
16073     typename ParamGenerator<T2>::iterator current2_;
16074     const typename ParamGenerator<T3>::iterator begin3_;
16075     const typename ParamGenerator<T3>::iterator end3_;
16076     typename ParamGenerator<T3>::iterator current3_;
16077     const typename ParamGenerator<T4>::iterator begin4_;
16078     const typename ParamGenerator<T4>::iterator end4_;
16079     typename ParamGenerator<T4>::iterator current4_;
16080     const typename ParamGenerator<T5>::iterator begin5_;
16081     const typename ParamGenerator<T5>::iterator end5_;
16082     typename ParamGenerator<T5>::iterator current5_;
16083     const typename ParamGenerator<T6>::iterator begin6_;
16084     const typename ParamGenerator<T6>::iterator end6_;
16085     typename ParamGenerator<T6>::iterator current6_;
16086     const typename ParamGenerator<T7>::iterator begin7_;
16087     const typename ParamGenerator<T7>::iterator end7_;
16088     typename ParamGenerator<T7>::iterator current7_;
16089     const typename ParamGenerator<T8>::iterator begin8_;
16090     const typename ParamGenerator<T8>::iterator end8_;
16091     typename ParamGenerator<T8>::iterator current8_;
16092     ParamType current_value_;
16093   };  // class CartesianProductGenerator8::Iterator
16094 
16095   // No implementation - assignment is unsupported.
16096   void operator=(const CartesianProductGenerator8& other);
16097 
16098   const ParamGenerator<T1> g1_;
16099   const ParamGenerator<T2> g2_;
16100   const ParamGenerator<T3> g3_;
16101   const ParamGenerator<T4> g4_;
16102   const ParamGenerator<T5> g5_;
16103   const ParamGenerator<T6> g6_;
16104   const ParamGenerator<T7> g7_;
16105   const ParamGenerator<T8> g8_;
16106 };  // class CartesianProductGenerator8
16107 
16108 
16109 template <typename T1, typename T2, typename T3, typename T4, typename T5,
16110     typename T6, typename T7, typename T8, typename T9>
16111 class CartesianProductGenerator9
16112     : public ParamGeneratorInterface< ::testing::tuple<T1, T2, T3, T4, T5, T6,
16113         T7, T8, T9> > {
16114  public:
16115   typedef ::testing::tuple<T1, T2, T3, T4, T5, T6, T7, T8, T9> ParamType;
16116 
16117   CartesianProductGenerator9(const ParamGenerator<T1>& g1,
16118       const ParamGenerator<T2>& g2, const ParamGenerator<T3>& g3,
16119       const ParamGenerator<T4>& g4, const ParamGenerator<T5>& g5,
16120       const ParamGenerator<T6>& g6, const ParamGenerator<T7>& g7,
16121       const ParamGenerator<T8>& g8, const ParamGenerator<T9>& g9)
16122       : g1_(g1), g2_(g2), g3_(g3), g4_(g4), g5_(g5), g6_(g6), g7_(g7), g8_(g8),
16123           g9_(g9) {}
16124   virtual ~CartesianProductGenerator9() {}
16125 
16126   virtual ParamIteratorInterface<ParamType>* Begin() const {
16127     return new Iterator(this, g1_, g1_.begin(), g2_, g2_.begin(), g3_,
16128         g3_.begin(), g4_, g4_.begin(), g5_, g5_.begin(), g6_, g6_.begin(), g7_,
16129         g7_.begin(), g8_, g8_.begin(), g9_, g9_.begin());
16130   }
16131   virtual ParamIteratorInterface<ParamType>* End() const {
16132     return new Iterator(this, g1_, g1_.end(), g2_, g2_.end(), g3_, g3_.end(),
16133         g4_, g4_.end(), g5_, g5_.end(), g6_, g6_.end(), g7_, g7_.end(), g8_,
16134         g8_.end(), g9_, g9_.end());
16135   }
16136 
16137  private:
16138   class Iterator : public ParamIteratorInterface<ParamType> {
16139    public:
16140     Iterator(const ParamGeneratorInterface<ParamType>* base,
16141       const ParamGenerator<T1>& g1,
16142       const typename ParamGenerator<T1>::iterator& current1,
16143       const ParamGenerator<T2>& g2,
16144       const typename ParamGenerator<T2>::iterator& current2,
16145       const ParamGenerator<T3>& g3,
16146       const typename ParamGenerator<T3>::iterator& current3,
16147       const ParamGenerator<T4>& g4,
16148       const typename ParamGenerator<T4>::iterator& current4,
16149       const ParamGenerator<T5>& g5,
16150       const typename ParamGenerator<T5>::iterator& current5,
16151       const ParamGenerator<T6>& g6,
16152       const typename ParamGenerator<T6>::iterator& current6,
16153       const ParamGenerator<T7>& g7,
16154       const typename ParamGenerator<T7>::iterator& current7,
16155       const ParamGenerator<T8>& g8,
16156       const typename ParamGenerator<T8>::iterator& current8,
16157       const ParamGenerator<T9>& g9,
16158       const typename ParamGenerator<T9>::iterator& current9)
16159         : base_(base),
16160           begin1_(g1.begin()), end1_(g1.end()), current1_(current1),
16161           begin2_(g2.begin()), end2_(g2.end()), current2_(current2),
16162           begin3_(g3.begin()), end3_(g3.end()), current3_(current3),
16163           begin4_(g4.begin()), end4_(g4.end()), current4_(current4),
16164           begin5_(g5.begin()), end5_(g5.end()), current5_(current5),
16165           begin6_(g6.begin()), end6_(g6.end()), current6_(current6),
16166           begin7_(g7.begin()), end7_(g7.end()), current7_(current7),
16167           begin8_(g8.begin()), end8_(g8.end()), current8_(current8),
16168           begin9_(g9.begin()), end9_(g9.end()), current9_(current9)    {
16169       ComputeCurrentValue();
16170     }
16171     virtual ~Iterator() {}
16172 
16173     virtual const ParamGeneratorInterface<ParamType>* BaseGenerator() const {
16174       return base_;
16175     }
16176     // Advance should not be called on beyond-of-range iterators
16177     // so no component iterators must be beyond end of range, either.
16178     virtual void Advance() {
16179       assert(!AtEnd());
16180       ++current9_;
16181       if (current9_ == end9_) {
16182         current9_ = begin9_;
16183         ++current8_;
16184       }
16185       if (current8_ == end8_) {
16186         current8_ = begin8_;
16187         ++current7_;
16188       }
16189       if (current7_ == end7_) {
16190         current7_ = begin7_;
16191         ++current6_;
16192       }
16193       if (current6_ == end6_) {
16194         current6_ = begin6_;
16195         ++current5_;
16196       }
16197       if (current5_ == end5_) {
16198         current5_ = begin5_;
16199         ++current4_;
16200       }
16201       if (current4_ == end4_) {
16202         current4_ = begin4_;
16203         ++current3_;
16204       }
16205       if (current3_ == end3_) {
16206         current3_ = begin3_;
16207         ++current2_;
16208       }
16209       if (current2_ == end2_) {
16210         current2_ = begin2_;
16211         ++current1_;
16212       }
16213       ComputeCurrentValue();
16214     }
16215     virtual ParamIteratorInterface<ParamType>* Clone() const {
16216       return new Iterator(*this);
16217     }
16218     virtual const ParamType* Current() const { return &current_value_; }
16219     virtual bool Equals(const ParamIteratorInterface<ParamType>& other) const {
16220       // Having the same base generator guarantees that the other
16221       // iterator is of the same type and we can downcast.
16222       GTEST_CHECK_(BaseGenerator() == other.BaseGenerator())
16223           << "The program attempted to compare iterators "
16224           << "from different generators." << std::endl;
16225       const Iterator* typed_other =
16226           CheckedDowncastToActualType<const Iterator>(&other);
16227       // We must report iterators equal if they both point beyond their
16228       // respective ranges. That can happen in a variety of fashions,
16229       // so we have to consult AtEnd().
16230       return (AtEnd() && typed_other->AtEnd()) ||
16231          (
16232           current1_ == typed_other->current1_ &&
16233           current2_ == typed_other->current2_ &&
16234           current3_ == typed_other->current3_ &&
16235           current4_ == typed_other->current4_ &&
16236           current5_ == typed_other->current5_ &&
16237           current6_ == typed_other->current6_ &&
16238           current7_ == typed_other->current7_ &&
16239           current8_ == typed_other->current8_ &&
16240           current9_ == typed_other->current9_);
16241     }
16242 
16243    private:
16244     Iterator(const Iterator& other)
16245         : base_(other.base_),
16246         begin1_(other.begin1_),
16247         end1_(other.end1_),
16248         current1_(other.current1_),
16249         begin2_(other.begin2_),
16250         end2_(other.end2_),
16251         current2_(other.current2_),
16252         begin3_(other.begin3_),
16253         end3_(other.end3_),
16254         current3_(other.current3_),
16255         begin4_(other.begin4_),
16256         end4_(other.end4_),
16257         current4_(other.current4_),
16258         begin5_(other.begin5_),
16259         end5_(other.end5_),
16260         current5_(other.current5_),
16261         begin6_(other.begin6_),
16262         end6_(other.end6_),
16263         current6_(other.current6_),
16264         begin7_(other.begin7_),
16265         end7_(other.end7_),
16266         current7_(other.current7_),
16267         begin8_(other.begin8_),
16268         end8_(other.end8_),
16269         current8_(other.current8_),
16270         begin9_(other.begin9_),
16271         end9_(other.end9_),
16272         current9_(other.current9_) {
16273       ComputeCurrentValue();
16274     }
16275 
16276     void ComputeCurrentValue() {
16277       if (!AtEnd())
16278         current_value_ = ParamType(*current1_, *current2_, *current3_,
16279             *current4_, *current5_, *current6_, *current7_, *current8_,
16280             *current9_);
16281     }
16282     bool AtEnd() const {
16283       // We must report iterator past the end of the range when either of the
16284       // component iterators has reached the end of its range.
16285       return
16286           current1_ == end1_ ||
16287           current2_ == end2_ ||
16288           current3_ == end3_ ||
16289           current4_ == end4_ ||
16290           current5_ == end5_ ||
16291           current6_ == end6_ ||
16292           current7_ == end7_ ||
16293           current8_ == end8_ ||
16294           current9_ == end9_;
16295     }
16296 
16297     // No implementation - assignment is unsupported.
16298     void operator=(const Iterator& other);
16299 
16300     const ParamGeneratorInterface<ParamType>* const base_;
16301     // begin[i]_ and end[i]_ define the i-th range that Iterator traverses.
16302     // current[i]_ is the actual traversing iterator.
16303     const typename ParamGenerator<T1>::iterator begin1_;
16304     const typename ParamGenerator<T1>::iterator end1_;
16305     typename ParamGenerator<T1>::iterator current1_;
16306     const typename ParamGenerator<T2>::iterator begin2_;
16307     const typename ParamGenerator<T2>::iterator end2_;
16308     typename ParamGenerator<T2>::iterator current2_;
16309     const typename ParamGenerator<T3>::iterator begin3_;
16310     const typename ParamGenerator<T3>::iterator end3_;
16311     typename ParamGenerator<T3>::iterator current3_;
16312     const typename ParamGenerator<T4>::iterator begin4_;
16313     const typename ParamGenerator<T4>::iterator end4_;
16314     typename ParamGenerator<T4>::iterator current4_;
16315     const typename ParamGenerator<T5>::iterator begin5_;
16316     const typename ParamGenerator<T5>::iterator end5_;
16317     typename ParamGenerator<T5>::iterator current5_;
16318     const typename ParamGenerator<T6>::iterator begin6_;
16319     const typename ParamGenerator<T6>::iterator end6_;
16320     typename ParamGenerator<T6>::iterator current6_;
16321     const typename ParamGenerator<T7>::iterator begin7_;
16322     const typename ParamGenerator<T7>::iterator end7_;
16323     typename ParamGenerator<T7>::iterator current7_;
16324     const typename ParamGenerator<T8>::iterator begin8_;
16325     const typename ParamGenerator<T8>::iterator end8_;
16326     typename ParamGenerator<T8>::iterator current8_;
16327     const typename ParamGenerator<T9>::iterator begin9_;
16328     const typename ParamGenerator<T9>::iterator end9_;
16329     typename ParamGenerator<T9>::iterator current9_;
16330     ParamType current_value_;
16331   };  // class CartesianProductGenerator9::Iterator
16332 
16333   // No implementation - assignment is unsupported.
16334   void operator=(const CartesianProductGenerator9& other);
16335 
16336   const ParamGenerator<T1> g1_;
16337   const ParamGenerator<T2> g2_;
16338   const ParamGenerator<T3> g3_;
16339   const ParamGenerator<T4> g4_;
16340   const ParamGenerator<T5> g5_;
16341   const ParamGenerator<T6> g6_;
16342   const ParamGenerator<T7> g7_;
16343   const ParamGenerator<T8> g8_;
16344   const ParamGenerator<T9> g9_;
16345 };  // class CartesianProductGenerator9
16346 
16347 
16348 template <typename T1, typename T2, typename T3, typename T4, typename T5,
16349     typename T6, typename T7, typename T8, typename T9, typename T10>
16350 class CartesianProductGenerator10
16351     : public ParamGeneratorInterface< ::testing::tuple<T1, T2, T3, T4, T5, T6,
16352         T7, T8, T9, T10> > {
16353  public:
16354   typedef ::testing::tuple<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> ParamType;
16355 
16356   CartesianProductGenerator10(const ParamGenerator<T1>& g1,
16357       const ParamGenerator<T2>& g2, const ParamGenerator<T3>& g3,
16358       const ParamGenerator<T4>& g4, const ParamGenerator<T5>& g5,
16359       const ParamGenerator<T6>& g6, const ParamGenerator<T7>& g7,
16360       const ParamGenerator<T8>& g8, const ParamGenerator<T9>& g9,
16361       const ParamGenerator<T10>& g10)
16362       : g1_(g1), g2_(g2), g3_(g3), g4_(g4), g5_(g5), g6_(g6), g7_(g7), g8_(g8),
16363           g9_(g9), g10_(g10) {}
16364   virtual ~CartesianProductGenerator10() {}
16365 
16366   virtual ParamIteratorInterface<ParamType>* Begin() const {
16367     return new Iterator(this, g1_, g1_.begin(), g2_, g2_.begin(), g3_,
16368         g3_.begin(), g4_, g4_.begin(), g5_, g5_.begin(), g6_, g6_.begin(), g7_,
16369         g7_.begin(), g8_, g8_.begin(), g9_, g9_.begin(), g10_, g10_.begin());
16370   }
16371   virtual ParamIteratorInterface<ParamType>* End() const {
16372     return new Iterator(this, g1_, g1_.end(), g2_, g2_.end(), g3_, g3_.end(),
16373         g4_, g4_.end(), g5_, g5_.end(), g6_, g6_.end(), g7_, g7_.end(), g8_,
16374         g8_.end(), g9_, g9_.end(), g10_, g10_.end());
16375   }
16376 
16377  private:
16378   class Iterator : public ParamIteratorInterface<ParamType> {
16379    public:
16380     Iterator(const ParamGeneratorInterface<ParamType>* base,
16381       const ParamGenerator<T1>& g1,
16382       const typename ParamGenerator<T1>::iterator& current1,
16383       const ParamGenerator<T2>& g2,
16384       const typename ParamGenerator<T2>::iterator& current2,
16385       const ParamGenerator<T3>& g3,
16386       const typename ParamGenerator<T3>::iterator& current3,
16387       const ParamGenerator<T4>& g4,
16388       const typename ParamGenerator<T4>::iterator& current4,
16389       const ParamGenerator<T5>& g5,
16390       const typename ParamGenerator<T5>::iterator& current5,
16391       const ParamGenerator<T6>& g6,
16392       const typename ParamGenerator<T6>::iterator& current6,
16393       const ParamGenerator<T7>& g7,
16394       const typename ParamGenerator<T7>::iterator& current7,
16395       const ParamGenerator<T8>& g8,
16396       const typename ParamGenerator<T8>::iterator& current8,
16397       const ParamGenerator<T9>& g9,
16398       const typename ParamGenerator<T9>::iterator& current9,
16399       const ParamGenerator<T10>& g10,
16400       const typename ParamGenerator<T10>::iterator& current10)
16401         : base_(base),
16402           begin1_(g1.begin()), end1_(g1.end()), current1_(current1),
16403           begin2_(g2.begin()), end2_(g2.end()), current2_(current2),
16404           begin3_(g3.begin()), end3_(g3.end()), current3_(current3),
16405           begin4_(g4.begin()), end4_(g4.end()), current4_(current4),
16406           begin5_(g5.begin()), end5_(g5.end()), current5_(current5),
16407           begin6_(g6.begin()), end6_(g6.end()), current6_(current6),
16408           begin7_(g7.begin()), end7_(g7.end()), current7_(current7),
16409           begin8_(g8.begin()), end8_(g8.end()), current8_(current8),
16410           begin9_(g9.begin()), end9_(g9.end()), current9_(current9),
16411           begin10_(g10.begin()), end10_(g10.end()), current10_(current10)    {
16412       ComputeCurrentValue();
16413     }
16414     virtual ~Iterator() {}
16415 
16416     virtual const ParamGeneratorInterface<ParamType>* BaseGenerator() const {
16417       return base_;
16418     }
16419     // Advance should not be called on beyond-of-range iterators
16420     // so no component iterators must be beyond end of range, either.
16421     virtual void Advance() {
16422       assert(!AtEnd());
16423       ++current10_;
16424       if (current10_ == end10_) {
16425         current10_ = begin10_;
16426         ++current9_;
16427       }
16428       if (current9_ == end9_) {
16429         current9_ = begin9_;
16430         ++current8_;
16431       }
16432       if (current8_ == end8_) {
16433         current8_ = begin8_;
16434         ++current7_;
16435       }
16436       if (current7_ == end7_) {
16437         current7_ = begin7_;
16438         ++current6_;
16439       }
16440       if (current6_ == end6_) {
16441         current6_ = begin6_;
16442         ++current5_;
16443       }
16444       if (current5_ == end5_) {
16445         current5_ = begin5_;
16446         ++current4_;
16447       }
16448       if (current4_ == end4_) {
16449         current4_ = begin4_;
16450         ++current3_;
16451       }
16452       if (current3_ == end3_) {
16453         current3_ = begin3_;
16454         ++current2_;
16455       }
16456       if (current2_ == end2_) {
16457         current2_ = begin2_;
16458         ++current1_;
16459       }
16460       ComputeCurrentValue();
16461     }
16462     virtual ParamIteratorInterface<ParamType>* Clone() const {
16463       return new Iterator(*this);
16464     }
16465     virtual const ParamType* Current() const { return &current_value_; }
16466     virtual bool Equals(const ParamIteratorInterface<ParamType>& other) const {
16467       // Having the same base generator guarantees that the other
16468       // iterator is of the same type and we can downcast.
16469       GTEST_CHECK_(BaseGenerator() == other.BaseGenerator())
16470           << "The program attempted to compare iterators "
16471           << "from different generators." << std::endl;
16472       const Iterator* typed_other =
16473           CheckedDowncastToActualType<const Iterator>(&other);
16474       // We must report iterators equal if they both point beyond their
16475       // respective ranges. That can happen in a variety of fashions,
16476       // so we have to consult AtEnd().
16477       return (AtEnd() && typed_other->AtEnd()) ||
16478          (
16479           current1_ == typed_other->current1_ &&
16480           current2_ == typed_other->current2_ &&
16481           current3_ == typed_other->current3_ &&
16482           current4_ == typed_other->current4_ &&
16483           current5_ == typed_other->current5_ &&
16484           current6_ == typed_other->current6_ &&
16485           current7_ == typed_other->current7_ &&
16486           current8_ == typed_other->current8_ &&
16487           current9_ == typed_other->current9_ &&
16488           current10_ == typed_other->current10_);
16489     }
16490 
16491    private:
16492     Iterator(const Iterator& other)
16493         : base_(other.base_),
16494         begin1_(other.begin1_),
16495         end1_(other.end1_),
16496         current1_(other.current1_),
16497         begin2_(other.begin2_),
16498         end2_(other.end2_),
16499         current2_(other.current2_),
16500         begin3_(other.begin3_),
16501         end3_(other.end3_),
16502         current3_(other.current3_),
16503         begin4_(other.begin4_),
16504         end4_(other.end4_),
16505         current4_(other.current4_),
16506         begin5_(other.begin5_),
16507         end5_(other.end5_),
16508         current5_(other.current5_),
16509         begin6_(other.begin6_),
16510         end6_(other.end6_),
16511         current6_(other.current6_),
16512         begin7_(other.begin7_),
16513         end7_(other.end7_),
16514         current7_(other.current7_),
16515         begin8_(other.begin8_),
16516         end8_(other.end8_),
16517         current8_(other.current8_),
16518         begin9_(other.begin9_),
16519         end9_(other.end9_),
16520         current9_(other.current9_),
16521         begin10_(other.begin10_),
16522         end10_(other.end10_),
16523         current10_(other.current10_) {
16524       ComputeCurrentValue();
16525     }
16526 
16527     void ComputeCurrentValue() {
16528       if (!AtEnd())
16529         current_value_ = ParamType(*current1_, *current2_, *current3_,
16530             *current4_, *current5_, *current6_, *current7_, *current8_,
16531             *current9_, *current10_);
16532     }
16533     bool AtEnd() const {
16534       // We must report iterator past the end of the range when either of the
16535       // component iterators has reached the end of its range.
16536       return
16537           current1_ == end1_ ||
16538           current2_ == end2_ ||
16539           current3_ == end3_ ||
16540           current4_ == end4_ ||
16541           current5_ == end5_ ||
16542           current6_ == end6_ ||
16543           current7_ == end7_ ||
16544           current8_ == end8_ ||
16545           current9_ == end9_ ||
16546           current10_ == end10_;
16547     }
16548 
16549     // No implementation - assignment is unsupported.
16550     void operator=(const Iterator& other);
16551 
16552     const ParamGeneratorInterface<ParamType>* const base_;
16553     // begin[i]_ and end[i]_ define the i-th range that Iterator traverses.
16554     // current[i]_ is the actual traversing iterator.
16555     const typename ParamGenerator<T1>::iterator begin1_;
16556     const typename ParamGenerator<T1>::iterator end1_;
16557     typename ParamGenerator<T1>::iterator current1_;
16558     const typename ParamGenerator<T2>::iterator begin2_;
16559     const typename ParamGenerator<T2>::iterator end2_;
16560     typename ParamGenerator<T2>::iterator current2_;
16561     const typename ParamGenerator<T3>::iterator begin3_;
16562     const typename ParamGenerator<T3>::iterator end3_;
16563     typename ParamGenerator<T3>::iterator current3_;
16564     const typename ParamGenerator<T4>::iterator begin4_;
16565     const typename ParamGenerator<T4>::iterator end4_;
16566     typename ParamGenerator<T4>::iterator current4_;
16567     const typename ParamGenerator<T5>::iterator begin5_;
16568     const typename ParamGenerator<T5>::iterator end5_;
16569     typename ParamGenerator<T5>::iterator current5_;
16570     const typename ParamGenerator<T6>::iterator begin6_;
16571     const typename ParamGenerator<T6>::iterator end6_;
16572     typename ParamGenerator<T6>::iterator current6_;
16573     const typename ParamGenerator<T7>::iterator begin7_;
16574     const typename ParamGenerator<T7>::iterator end7_;
16575     typename ParamGenerator<T7>::iterator current7_;
16576     const typename ParamGenerator<T8>::iterator begin8_;
16577     const typename ParamGenerator<T8>::iterator end8_;
16578     typename ParamGenerator<T8>::iterator current8_;
16579     const typename ParamGenerator<T9>::iterator begin9_;
16580     const typename ParamGenerator<T9>::iterator end9_;
16581     typename ParamGenerator<T9>::iterator current9_;
16582     const typename ParamGenerator<T10>::iterator begin10_;
16583     const typename ParamGenerator<T10>::iterator end10_;
16584     typename ParamGenerator<T10>::iterator current10_;
16585     ParamType current_value_;
16586   };  // class CartesianProductGenerator10::Iterator
16587 
16588   // No implementation - assignment is unsupported.
16589   void operator=(const CartesianProductGenerator10& other);
16590 
16591   const ParamGenerator<T1> g1_;
16592   const ParamGenerator<T2> g2_;
16593   const ParamGenerator<T3> g3_;
16594   const ParamGenerator<T4> g4_;
16595   const ParamGenerator<T5> g5_;
16596   const ParamGenerator<T6> g6_;
16597   const ParamGenerator<T7> g7_;
16598   const ParamGenerator<T8> g8_;
16599   const ParamGenerator<T9> g9_;
16600   const ParamGenerator<T10> g10_;
16601 };  // class CartesianProductGenerator10
16602 
16603 
16604 // INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.
16605 //
16606 // Helper classes providing Combine() with polymorphic features. They allow
16607 // casting CartesianProductGeneratorN<T> to ParamGenerator<U> if T is
16608 // convertible to U.
16609 //
16610 template <class Generator1, class Generator2>
16611 class CartesianProductHolder2 {
16612  public:
16613 CartesianProductHolder2(const Generator1& g1, const Generator2& g2)
16614       : g1_(g1), g2_(g2) {}
16615   template <typename T1, typename T2>
16616   operator ParamGenerator< ::testing::tuple<T1, T2> >() const {
16617     return ParamGenerator< ::testing::tuple<T1, T2> >(
16618         new CartesianProductGenerator2<T1, T2>(
16619         static_cast<ParamGenerator<T1> >(g1_),
16620         static_cast<ParamGenerator<T2> >(g2_)));
16621   }
16622 
16623  private:
16624   // No implementation - assignment is unsupported.
16625   void operator=(const CartesianProductHolder2& other);
16626 
16627   const Generator1 g1_;
16628   const Generator2 g2_;
16629 };  // class CartesianProductHolder2
16630 
16631 template <class Generator1, class Generator2, class Generator3>
16632 class CartesianProductHolder3 {
16633  public:
16634 CartesianProductHolder3(const Generator1& g1, const Generator2& g2,
16635     const Generator3& g3)
16636       : g1_(g1), g2_(g2), g3_(g3) {}
16637   template <typename T1, typename T2, typename T3>
16638   operator ParamGenerator< ::testing::tuple<T1, T2, T3> >() const {
16639     return ParamGenerator< ::testing::tuple<T1, T2, T3> >(
16640         new CartesianProductGenerator3<T1, T2, T3>(
16641         static_cast<ParamGenerator<T1> >(g1_),
16642         static_cast<ParamGenerator<T2> >(g2_),
16643         static_cast<ParamGenerator<T3> >(g3_)));
16644   }
16645 
16646  private:
16647   // No implementation - assignment is unsupported.
16648   void operator=(const CartesianProductHolder3& other);
16649 
16650   const Generator1 g1_;
16651   const Generator2 g2_;
16652   const Generator3 g3_;
16653 };  // class CartesianProductHolder3
16654 
16655 template <class Generator1, class Generator2, class Generator3,
16656     class Generator4>
16657 class CartesianProductHolder4 {
16658  public:
16659 CartesianProductHolder4(const Generator1& g1, const Generator2& g2,
16660     const Generator3& g3, const Generator4& g4)
16661       : g1_(g1), g2_(g2), g3_(g3), g4_(g4) {}
16662   template <typename T1, typename T2, typename T3, typename T4>
16663   operator ParamGenerator< ::testing::tuple<T1, T2, T3, T4> >() const {
16664     return ParamGenerator< ::testing::tuple<T1, T2, T3, T4> >(
16665         new CartesianProductGenerator4<T1, T2, T3, T4>(
16666         static_cast<ParamGenerator<T1> >(g1_),
16667         static_cast<ParamGenerator<T2> >(g2_),
16668         static_cast<ParamGenerator<T3> >(g3_),
16669         static_cast<ParamGenerator<T4> >(g4_)));
16670   }
16671 
16672  private:
16673   // No implementation - assignment is unsupported.
16674   void operator=(const CartesianProductHolder4& other);
16675 
16676   const Generator1 g1_;
16677   const Generator2 g2_;
16678   const Generator3 g3_;
16679   const Generator4 g4_;
16680 };  // class CartesianProductHolder4
16681 
16682 template <class Generator1, class Generator2, class Generator3,
16683     class Generator4, class Generator5>
16684 class CartesianProductHolder5 {
16685  public:
16686 CartesianProductHolder5(const Generator1& g1, const Generator2& g2,
16687     const Generator3& g3, const Generator4& g4, const Generator5& g5)
16688       : g1_(g1), g2_(g2), g3_(g3), g4_(g4), g5_(g5) {}
16689   template <typename T1, typename T2, typename T3, typename T4, typename T5>
16690   operator ParamGenerator< ::testing::tuple<T1, T2, T3, T4, T5> >() const {
16691     return ParamGenerator< ::testing::tuple<T1, T2, T3, T4, T5> >(
16692         new CartesianProductGenerator5<T1, T2, T3, T4, T5>(
16693         static_cast<ParamGenerator<T1> >(g1_),
16694         static_cast<ParamGenerator<T2> >(g2_),
16695         static_cast<ParamGenerator<T3> >(g3_),
16696         static_cast<ParamGenerator<T4> >(g4_),
16697         static_cast<ParamGenerator<T5> >(g5_)));
16698   }
16699 
16700  private:
16701   // No implementation - assignment is unsupported.
16702   void operator=(const CartesianProductHolder5& other);
16703 
16704   const Generator1 g1_;
16705   const Generator2 g2_;
16706   const Generator3 g3_;
16707   const Generator4 g4_;
16708   const Generator5 g5_;
16709 };  // class CartesianProductHolder5
16710 
16711 template <class Generator1, class Generator2, class Generator3,
16712     class Generator4, class Generator5, class Generator6>
16713 class CartesianProductHolder6 {
16714  public:
16715 CartesianProductHolder6(const Generator1& g1, const Generator2& g2,
16716     const Generator3& g3, const Generator4& g4, const Generator5& g5,
16717     const Generator6& g6)
16718       : g1_(g1), g2_(g2), g3_(g3), g4_(g4), g5_(g5), g6_(g6) {}
16719   template <typename T1, typename T2, typename T3, typename T4, typename T5,
16720       typename T6>
16721   operator ParamGenerator< ::testing::tuple<T1, T2, T3, T4, T5, T6> >() const {
16722     return ParamGenerator< ::testing::tuple<T1, T2, T3, T4, T5, T6> >(
16723         new CartesianProductGenerator6<T1, T2, T3, T4, T5, T6>(
16724         static_cast<ParamGenerator<T1> >(g1_),
16725         static_cast<ParamGenerator<T2> >(g2_),
16726         static_cast<ParamGenerator<T3> >(g3_),
16727         static_cast<ParamGenerator<T4> >(g4_),
16728         static_cast<ParamGenerator<T5> >(g5_),
16729         static_cast<ParamGenerator<T6> >(g6_)));
16730   }
16731 
16732  private:
16733   // No implementation - assignment is unsupported.
16734   void operator=(const CartesianProductHolder6& other);
16735 
16736   const Generator1 g1_;
16737   const Generator2 g2_;
16738   const Generator3 g3_;
16739   const Generator4 g4_;
16740   const Generator5 g5_;
16741   const Generator6 g6_;
16742 };  // class CartesianProductHolder6
16743 
16744 template <class Generator1, class Generator2, class Generator3,
16745     class Generator4, class Generator5, class Generator6, class Generator7>
16746 class CartesianProductHolder7 {
16747  public:
16748 CartesianProductHolder7(const Generator1& g1, const Generator2& g2,
16749     const Generator3& g3, const Generator4& g4, const Generator5& g5,
16750     const Generator6& g6, const Generator7& g7)
16751       : g1_(g1), g2_(g2), g3_(g3), g4_(g4), g5_(g5), g6_(g6), g7_(g7) {}
16752   template <typename T1, typename T2, typename T3, typename T4, typename T5,
16753       typename T6, typename T7>
16754   operator ParamGenerator< ::testing::tuple<T1, T2, T3, T4, T5, T6,
16755       T7> >() const {
16756     return ParamGenerator< ::testing::tuple<T1, T2, T3, T4, T5, T6, T7> >(
16757         new CartesianProductGenerator7<T1, T2, T3, T4, T5, T6, T7>(
16758         static_cast<ParamGenerator<T1> >(g1_),
16759         static_cast<ParamGenerator<T2> >(g2_),
16760         static_cast<ParamGenerator<T3> >(g3_),
16761         static_cast<ParamGenerator<T4> >(g4_),
16762         static_cast<ParamGenerator<T5> >(g5_),
16763         static_cast<ParamGenerator<T6> >(g6_),
16764         static_cast<ParamGenerator<T7> >(g7_)));
16765   }
16766 
16767  private:
16768   // No implementation - assignment is unsupported.
16769   void operator=(const CartesianProductHolder7& other);
16770 
16771   const Generator1 g1_;
16772   const Generator2 g2_;
16773   const Generator3 g3_;
16774   const Generator4 g4_;
16775   const Generator5 g5_;
16776   const Generator6 g6_;
16777   const Generator7 g7_;
16778 };  // class CartesianProductHolder7
16779 
16780 template <class Generator1, class Generator2, class Generator3,
16781     class Generator4, class Generator5, class Generator6, class Generator7,
16782     class Generator8>
16783 class CartesianProductHolder8 {
16784  public:
16785 CartesianProductHolder8(const Generator1& g1, const Generator2& g2,
16786     const Generator3& g3, const Generator4& g4, const Generator5& g5,
16787     const Generator6& g6, const Generator7& g7, const Generator8& g8)
16788       : g1_(g1), g2_(g2), g3_(g3), g4_(g4), g5_(g5), g6_(g6), g7_(g7),
16789           g8_(g8) {}
16790   template <typename T1, typename T2, typename T3, typename T4, typename T5,
16791       typename T6, typename T7, typename T8>
16792   operator ParamGenerator< ::testing::tuple<T1, T2, T3, T4, T5, T6, T7,
16793       T8> >() const {
16794     return ParamGenerator< ::testing::tuple<T1, T2, T3, T4, T5, T6, T7, T8> >(
16795         new CartesianProductGenerator8<T1, T2, T3, T4, T5, T6, T7, T8>(
16796         static_cast<ParamGenerator<T1> >(g1_),
16797         static_cast<ParamGenerator<T2> >(g2_),
16798         static_cast<ParamGenerator<T3> >(g3_),
16799         static_cast<ParamGenerator<T4> >(g4_),
16800         static_cast<ParamGenerator<T5> >(g5_),
16801         static_cast<ParamGenerator<T6> >(g6_),
16802         static_cast<ParamGenerator<T7> >(g7_),
16803         static_cast<ParamGenerator<T8> >(g8_)));
16804   }
16805 
16806  private:
16807   // No implementation - assignment is unsupported.
16808   void operator=(const CartesianProductHolder8& other);
16809 
16810   const Generator1 g1_;
16811   const Generator2 g2_;
16812   const Generator3 g3_;
16813   const Generator4 g4_;
16814   const Generator5 g5_;
16815   const Generator6 g6_;
16816   const Generator7 g7_;
16817   const Generator8 g8_;
16818 };  // class CartesianProductHolder8
16819 
16820 template <class Generator1, class Generator2, class Generator3,
16821     class Generator4, class Generator5, class Generator6, class Generator7,
16822     class Generator8, class Generator9>
16823 class CartesianProductHolder9 {
16824  public:
16825 CartesianProductHolder9(const Generator1& g1, const Generator2& g2,
16826     const Generator3& g3, const Generator4& g4, const Generator5& g5,
16827     const Generator6& g6, const Generator7& g7, const Generator8& g8,
16828     const Generator9& g9)
16829       : g1_(g1), g2_(g2), g3_(g3), g4_(g4), g5_(g5), g6_(g6), g7_(g7), g8_(g8),
16830           g9_(g9) {}
16831   template <typename T1, typename T2, typename T3, typename T4, typename T5,
16832       typename T6, typename T7, typename T8, typename T9>
16833   operator ParamGenerator< ::testing::tuple<T1, T2, T3, T4, T5, T6, T7, T8,
16834       T9> >() const {
16835     return ParamGenerator< ::testing::tuple<T1, T2, T3, T4, T5, T6, T7, T8,
16836         T9> >(
16837         new CartesianProductGenerator9<T1, T2, T3, T4, T5, T6, T7, T8, T9>(
16838         static_cast<ParamGenerator<T1> >(g1_),
16839         static_cast<ParamGenerator<T2> >(g2_),
16840         static_cast<ParamGenerator<T3> >(g3_),
16841         static_cast<ParamGenerator<T4> >(g4_),
16842         static_cast<ParamGenerator<T5> >(g5_),
16843         static_cast<ParamGenerator<T6> >(g6_),
16844         static_cast<ParamGenerator<T7> >(g7_),
16845         static_cast<ParamGenerator<T8> >(g8_),
16846         static_cast<ParamGenerator<T9> >(g9_)));
16847   }
16848 
16849  private:
16850   // No implementation - assignment is unsupported.
16851   void operator=(const CartesianProductHolder9& other);
16852 
16853   const Generator1 g1_;
16854   const Generator2 g2_;
16855   const Generator3 g3_;
16856   const Generator4 g4_;
16857   const Generator5 g5_;
16858   const Generator6 g6_;
16859   const Generator7 g7_;
16860   const Generator8 g8_;
16861   const Generator9 g9_;
16862 };  // class CartesianProductHolder9
16863 
16864 template <class Generator1, class Generator2, class Generator3,
16865     class Generator4, class Generator5, class Generator6, class Generator7,
16866     class Generator8, class Generator9, class Generator10>
16867 class CartesianProductHolder10 {
16868  public:
16869 CartesianProductHolder10(const Generator1& g1, const Generator2& g2,
16870     const Generator3& g3, const Generator4& g4, const Generator5& g5,
16871     const Generator6& g6, const Generator7& g7, const Generator8& g8,
16872     const Generator9& g9, const Generator10& g10)
16873       : g1_(g1), g2_(g2), g3_(g3), g4_(g4), g5_(g5), g6_(g6), g7_(g7), g8_(g8),
16874           g9_(g9), g10_(g10) {}
16875   template <typename T1, typename T2, typename T3, typename T4, typename T5,
16876       typename T6, typename T7, typename T8, typename T9, typename T10>
16877   operator ParamGenerator< ::testing::tuple<T1, T2, T3, T4, T5, T6, T7, T8, T9,
16878       T10> >() const {
16879     return ParamGenerator< ::testing::tuple<T1, T2, T3, T4, T5, T6, T7, T8, T9,
16880         T10> >(
16881         new CartesianProductGenerator10<T1, T2, T3, T4, T5, T6, T7, T8, T9,
16882             T10>(
16883         static_cast<ParamGenerator<T1> >(g1_),
16884         static_cast<ParamGenerator<T2> >(g2_),
16885         static_cast<ParamGenerator<T3> >(g3_),
16886         static_cast<ParamGenerator<T4> >(g4_),
16887         static_cast<ParamGenerator<T5> >(g5_),
16888         static_cast<ParamGenerator<T6> >(g6_),
16889         static_cast<ParamGenerator<T7> >(g7_),
16890         static_cast<ParamGenerator<T8> >(g8_),
16891         static_cast<ParamGenerator<T9> >(g9_),
16892         static_cast<ParamGenerator<T10> >(g10_)));
16893   }
16894 
16895  private:
16896   // No implementation - assignment is unsupported.
16897   void operator=(const CartesianProductHolder10& other);
16898 
16899   const Generator1 g1_;
16900   const Generator2 g2_;
16901   const Generator3 g3_;
16902   const Generator4 g4_;
16903   const Generator5 g5_;
16904   const Generator6 g6_;
16905   const Generator7 g7_;
16906   const Generator8 g8_;
16907   const Generator9 g9_;
16908   const Generator10 g10_;
16909 };  // class CartesianProductHolder10
16910 
16911 # endif  // GTEST_HAS_COMBINE
16912 
16913 }  // namespace internal
16914 }  // namespace testing
16915 
16916 #endif  //  GTEST_HAS_PARAM_TEST
16917 
16918 #endif  // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PARAM_UTIL_GENERATED_H_
16919 
16920 #if GTEST_HAS_PARAM_TEST
16921 
16922 namespace testing {
16923 
16924 // Functions producing parameter generators.
16925 //
16926 // Google Test uses these generators to produce parameters for value-
16927 // parameterized tests. When a parameterized test case is instantiated
16928 // with a particular generator, Google Test creates and runs tests
16929 // for each element in the sequence produced by the generator.
16930 //
16931 // In the following sample, tests from test case FooTest are instantiated
16932 // each three times with parameter values 3, 5, and 8:
16933 //
16934 // class FooTest : public TestWithParam<int> { ... };
16935 //
16936 // TEST_P(FooTest, TestThis) {
16937 // }
16938 // TEST_P(FooTest, TestThat) {
16939 // }
16940 // INSTANTIATE_TEST_CASE_P(TestSequence, FooTest, Values(3, 5, 8));
16941 //
16942 
16943 // Range() returns generators providing sequences of values in a range.
16944 //
16945 // Synopsis:
16946 // Range(start, end)
16947 //   - returns a generator producing a sequence of values {start, start+1,
16948 //     start+2, ..., }.
16949 // Range(start, end, step)
16950 //   - returns a generator producing a sequence of values {start, start+step,
16951 //     start+step+step, ..., }.
16952 // Notes:
16953 //   * The generated sequences never include end. For example, Range(1, 5)
16954 //     returns a generator producing a sequence {1, 2, 3, 4}. Range(1, 9, 2)
16955 //     returns a generator producing {1, 3, 5, 7}.
16956 //   * start and end must have the same type. That type may be any integral or
16957 //     floating-point type or a user defined type satisfying these conditions:
16958 //     * It must be assignable (have operator=() defined).
16959 //     * It must have operator+() (operator+(int-compatible type) for
16960 //       two-operand version).
16961 //     * It must have operator<() defined.
16962 //     Elements in the resulting sequences will also have that type.
16963 //   * Condition start < end must be satisfied in order for resulting sequences
16964 //     to contain any elements.
16965 //
16966 template <typename T, typename IncrementT>
16967 internal::ParamGenerator<T> Range(T start, T end, IncrementT step) {
16968   return internal::ParamGenerator<T>(
16969       new internal::RangeGenerator<T, IncrementT>(start, end, step));
16970 }
16971 
16972 template <typename T>
16973 internal::ParamGenerator<T> Range(T start, T end) {
16974   return Range(start, end, 1);
16975 }
16976 
16977 // ValuesIn() function allows generation of tests with parameters coming from
16978 // a container.
16979 //
16980 // Synopsis:
16981 // ValuesIn(const T (&array)[N])
16982 //   - returns a generator producing sequences with elements from
16983 //     a C-style array.
16984 // ValuesIn(const Container& container)
16985 //   - returns a generator producing sequences with elements from
16986 //     an STL-style container.
16987 // ValuesIn(Iterator begin, Iterator end)
16988 //   - returns a generator producing sequences with elements from
16989 //     a range [begin, end) defined by a pair of STL-style iterators. These
16990 //     iterators can also be plain C pointers.
16991 //
16992 // Please note that ValuesIn copies the values from the containers
16993 // passed in and keeps them to generate tests in RUN_ALL_TESTS().
16994 //
16995 // Examples:
16996 //
16997 // This instantiates tests from test case StringTest
16998 // each with C-string values of "foo", "bar", and "baz":
16999 //
17000 // const char* strings[] = {"foo", "bar", "baz"};
17001 // INSTANTIATE_TEST_CASE_P(StringSequence, SrtingTest, ValuesIn(strings));
17002 //
17003 // This instantiates tests from test case StlStringTest
17004 // each with STL strings with values "a" and "b":
17005 //
17006 // ::std::vector< ::std::string> GetParameterStrings() {
17007 //   ::std::vector< ::std::string> v;
17008 //   v.push_back("a");
17009 //   v.push_back("b");
17010 //   return v;
17011 // }
17012 //
17013 // INSTANTIATE_TEST_CASE_P(CharSequence,
17014 //                         StlStringTest,
17015 //                         ValuesIn(GetParameterStrings()));
17016 //
17017 //
17018 // This will also instantiate tests from CharTest
17019 // each with parameter values 'a' and 'b':
17020 //
17021 // ::std::list<char> GetParameterChars() {
17022 //   ::std::list<char> list;
17023 //   list.push_back('a');
17024 //   list.push_back('b');
17025 //   return list;
17026 // }
17027 // ::std::list<char> l = GetParameterChars();
17028 // INSTANTIATE_TEST_CASE_P(CharSequence2,
17029 //                         CharTest,
17030 //                         ValuesIn(l.begin(), l.end()));
17031 //
17032 template <typename ForwardIterator>
17033 internal::ParamGenerator<
17034   typename ::testing::internal::IteratorTraits<ForwardIterator>::value_type>
17035 ValuesIn(ForwardIterator begin, ForwardIterator end) {
17036   typedef typename ::testing::internal::IteratorTraits<ForwardIterator>
17037       ::value_type ParamType;
17038   return internal::ParamGenerator<ParamType>(
17039       new internal::ValuesInIteratorRangeGenerator<ParamType>(begin, end));
17040 }
17041 
17042 template <typename T, size_t N>
17043 internal::ParamGenerator<T> ValuesIn(const T (&array)[N]) {
17044   return ValuesIn(array, array + N);
17045 }
17046 
17047 template <class Container>
17048 internal::ParamGenerator<typename Container::value_type> ValuesIn(
17049     const Container& container) {
17050   return ValuesIn(container.begin(), container.end());
17051 }
17052 
17053 // Values() allows generating tests from explicitly specified list of
17054 // parameters.
17055 //
17056 // Synopsis:
17057 // Values(T v1, T v2, ..., T vN)
17058 //   - returns a generator producing sequences with elements v1, v2, ..., vN.
17059 //
17060 // For example, this instantiates tests from test case BarTest each
17061 // with values "one", "two", and "three":
17062 //
17063 // INSTANTIATE_TEST_CASE_P(NumSequence, BarTest, Values("one", "two", "three"));
17064 //
17065 // This instantiates tests from test case BazTest each with values 1, 2, 3.5.
17066 // The exact type of values will depend on the type of parameter in BazTest.
17067 //
17068 // INSTANTIATE_TEST_CASE_P(FloatingNumbers, BazTest, Values(1, 2, 3.5));
17069 //
17070 // Currently, Values() supports from 1 to 50 parameters.
17071 //
17072 template <typename T1>
17073 internal::ValueArray1<T1> Values(T1 v1) {
17074   return internal::ValueArray1<T1>(v1);
17075 }
17076 
17077 template <typename T1, typename T2>
17078 internal::ValueArray2<T1, T2> Values(T1 v1, T2 v2) {
17079   return internal::ValueArray2<T1, T2>(v1, v2);
17080 }
17081 
17082 template <typename T1, typename T2, typename T3>
17083 internal::ValueArray3<T1, T2, T3> Values(T1 v1, T2 v2, T3 v3) {
17084   return internal::ValueArray3<T1, T2, T3>(v1, v2, v3);
17085 }
17086 
17087 template <typename T1, typename T2, typename T3, typename T4>
17088 internal::ValueArray4<T1, T2, T3, T4> Values(T1 v1, T2 v2, T3 v3, T4 v4) {
17089   return internal::ValueArray4<T1, T2, T3, T4>(v1, v2, v3, v4);
17090 }
17091 
17092 template <typename T1, typename T2, typename T3, typename T4, typename T5>
17093 internal::ValueArray5<T1, T2, T3, T4, T5> Values(T1 v1, T2 v2, T3 v3, T4 v4,
17094     T5 v5) {
17095   return internal::ValueArray5<T1, T2, T3, T4, T5>(v1, v2, v3, v4, v5);
17096 }
17097 
17098 template <typename T1, typename T2, typename T3, typename T4, typename T5,
17099     typename T6>
17100 internal::ValueArray6<T1, T2, T3, T4, T5, T6> Values(T1 v1, T2 v2, T3 v3,
17101     T4 v4, T5 v5, T6 v6) {
17102   return internal::ValueArray6<T1, T2, T3, T4, T5, T6>(v1, v2, v3, v4, v5, v6);
17103 }
17104 
17105 template <typename T1, typename T2, typename T3, typename T4, typename T5,
17106     typename T6, typename T7>
17107 internal::ValueArray7<T1, T2, T3, T4, T5, T6, T7> Values(T1 v1, T2 v2, T3 v3,
17108     T4 v4, T5 v5, T6 v6, T7 v7) {
17109   return internal::ValueArray7<T1, T2, T3, T4, T5, T6, T7>(v1, v2, v3, v4, v5,
17110       v6, v7);
17111 }
17112 
17113 template <typename T1, typename T2, typename T3, typename T4, typename T5,
17114     typename T6, typename T7, typename T8>
17115 internal::ValueArray8<T1, T2, T3, T4, T5, T6, T7, T8> Values(T1 v1, T2 v2,
17116     T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8) {
17117   return internal::ValueArray8<T1, T2, T3, T4, T5, T6, T7, T8>(v1, v2, v3, v4,
17118       v5, v6, v7, v8);
17119 }
17120 
17121 template <typename T1, typename T2, typename T3, typename T4, typename T5,
17122     typename T6, typename T7, typename T8, typename T9>
17123 internal::ValueArray9<T1, T2, T3, T4, T5, T6, T7, T8, T9> Values(T1 v1, T2 v2,
17124     T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9) {
17125   return internal::ValueArray9<T1, T2, T3, T4, T5, T6, T7, T8, T9>(v1, v2, v3,
17126       v4, v5, v6, v7, v8, v9);
17127 }
17128 
17129 template <typename T1, typename T2, typename T3, typename T4, typename T5,
17130     typename T6, typename T7, typename T8, typename T9, typename T10>
17131 internal::ValueArray10<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> Values(T1 v1,
17132     T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10) {
17133   return internal::ValueArray10<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>(v1,
17134       v2, v3, v4, v5, v6, v7, v8, v9, v10);
17135 }
17136 
17137 template <typename T1, typename T2, typename T3, typename T4, typename T5,
17138     typename T6, typename T7, typename T8, typename T9, typename T10,
17139     typename T11>
17140 internal::ValueArray11<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10,
17141     T11> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
17142     T10 v10, T11 v11) {
17143   return internal::ValueArray11<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10,
17144       T11>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11);
17145 }
17146 
17147 template <typename T1, typename T2, typename T3, typename T4, typename T5,
17148     typename T6, typename T7, typename T8, typename T9, typename T10,
17149     typename T11, typename T12>
17150 internal::ValueArray12<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
17151     T12> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
17152     T10 v10, T11 v11, T12 v12) {
17153   return internal::ValueArray12<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
17154       T12>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12);
17155 }
17156 
17157 template <typename T1, typename T2, typename T3, typename T4, typename T5,
17158     typename T6, typename T7, typename T8, typename T9, typename T10,
17159     typename T11, typename T12, typename T13>
17160 internal::ValueArray13<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
17161     T13> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
17162     T10 v10, T11 v11, T12 v12, T13 v13) {
17163   return internal::ValueArray13<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
17164       T12, T13>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13);
17165 }
17166 
17167 template <typename T1, typename T2, typename T3, typename T4, typename T5,
17168     typename T6, typename T7, typename T8, typename T9, typename T10,
17169     typename T11, typename T12, typename T13, typename T14>
17170 internal::ValueArray14<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
17171     T14> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
17172     T10 v10, T11 v11, T12 v12, T13 v13, T14 v14) {
17173   return internal::ValueArray14<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
17174       T12, T13, T14>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13,
17175       v14);
17176 }
17177 
17178 template <typename T1, typename T2, typename T3, typename T4, typename T5,
17179     typename T6, typename T7, typename T8, typename T9, typename T10,
17180     typename T11, typename T12, typename T13, typename T14, typename T15>
17181 internal::ValueArray15<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
17182     T14, T15> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8,
17183     T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15) {
17184   return internal::ValueArray15<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
17185       T12, T13, T14, T15>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12,
17186       v13, v14, v15);
17187 }
17188 
17189 template <typename T1, typename T2, typename T3, typename T4, typename T5,
17190     typename T6, typename T7, typename T8, typename T9, typename T10,
17191     typename T11, typename T12, typename T13, typename T14, typename T15,
17192     typename T16>
17193 internal::ValueArray16<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
17194     T14, T15, T16> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7,
17195     T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15,
17196     T16 v16) {
17197   return internal::ValueArray16<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
17198       T12, T13, T14, T15, T16>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11,
17199       v12, v13, v14, v15, v16);
17200 }
17201 
17202 template <typename T1, typename T2, typename T3, typename T4, typename T5,
17203     typename T6, typename T7, typename T8, typename T9, typename T10,
17204     typename T11, typename T12, typename T13, typename T14, typename T15,
17205     typename T16, typename T17>
17206 internal::ValueArray17<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
17207     T14, T15, T16, T17> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7,
17208     T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15,
17209     T16 v16, T17 v17) {
17210   return internal::ValueArray17<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
17211       T12, T13, T14, T15, T16, T17>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10,
17212       v11, v12, v13, v14, v15, v16, v17);
17213 }
17214 
17215 template <typename T1, typename T2, typename T3, typename T4, typename T5,
17216     typename T6, typename T7, typename T8, typename T9, typename T10,
17217     typename T11, typename T12, typename T13, typename T14, typename T15,
17218     typename T16, typename T17, typename T18>
17219 internal::ValueArray18<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
17220     T14, T15, T16, T17, T18> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6,
17221     T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15,
17222     T16 v16, T17 v17, T18 v18) {
17223   return internal::ValueArray18<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
17224       T12, T13, T14, T15, T16, T17, T18>(v1, v2, v3, v4, v5, v6, v7, v8, v9,
17225       v10, v11, v12, v13, v14, v15, v16, v17, v18);
17226 }
17227 
17228 template <typename T1, typename T2, typename T3, typename T4, typename T5,
17229     typename T6, typename T7, typename T8, typename T9, typename T10,
17230     typename T11, typename T12, typename T13, typename T14, typename T15,
17231     typename T16, typename T17, typename T18, typename T19>
17232 internal::ValueArray19<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
17233     T14, T15, T16, T17, T18, T19> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5,
17234     T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14,
17235     T15 v15, T16 v16, T17 v17, T18 v18, T19 v19) {
17236   return internal::ValueArray19<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
17237       T12, T13, T14, T15, T16, T17, T18, T19>(v1, v2, v3, v4, v5, v6, v7, v8,
17238       v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19);
17239 }
17240 
17241 template <typename T1, typename T2, typename T3, typename T4, typename T5,
17242     typename T6, typename T7, typename T8, typename T9, typename T10,
17243     typename T11, typename T12, typename T13, typename T14, typename T15,
17244     typename T16, typename T17, typename T18, typename T19, typename T20>
17245 internal::ValueArray20<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
17246     T14, T15, T16, T17, T18, T19, T20> Values(T1 v1, T2 v2, T3 v3, T4 v4,
17247     T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13,
17248     T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20) {
17249   return internal::ValueArray20<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
17250       T12, T13, T14, T15, T16, T17, T18, T19, T20>(v1, v2, v3, v4, v5, v6, v7,
17251       v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20);
17252 }
17253 
17254 template <typename T1, typename T2, typename T3, typename T4, typename T5,
17255     typename T6, typename T7, typename T8, typename T9, typename T10,
17256     typename T11, typename T12, typename T13, typename T14, typename T15,
17257     typename T16, typename T17, typename T18, typename T19, typename T20,
17258     typename T21>
17259 internal::ValueArray21<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
17260     T14, T15, T16, T17, T18, T19, T20, T21> Values(T1 v1, T2 v2, T3 v3, T4 v4,
17261     T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13,
17262     T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21) {
17263   return internal::ValueArray21<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
17264       T12, T13, T14, T15, T16, T17, T18, T19, T20, T21>(v1, v2, v3, v4, v5, v6,
17265       v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21);
17266 }
17267 
17268 template <typename T1, typename T2, typename T3, typename T4, typename T5,
17269     typename T6, typename T7, typename T8, typename T9, typename T10,
17270     typename T11, typename T12, typename T13, typename T14, typename T15,
17271     typename T16, typename T17, typename T18, typename T19, typename T20,
17272     typename T21, typename T22>
17273 internal::ValueArray22<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
17274     T14, T15, T16, T17, T18, T19, T20, T21, T22> Values(T1 v1, T2 v2, T3 v3,
17275     T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12,
17276     T13 v13, T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20,
17277     T21 v21, T22 v22) {
17278   return internal::ValueArray22<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
17279       T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22>(v1, v2, v3, v4,
17280       v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19,
17281       v20, v21, v22);
17282 }
17283 
17284 template <typename T1, typename T2, typename T3, typename T4, typename T5,
17285     typename T6, typename T7, typename T8, typename T9, typename T10,
17286     typename T11, typename T12, typename T13, typename T14, typename T15,
17287     typename T16, typename T17, typename T18, typename T19, typename T20,
17288     typename T21, typename T22, typename T23>
17289 internal::ValueArray23<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
17290     T14, T15, T16, T17, T18, T19, T20, T21, T22, T23> Values(T1 v1, T2 v2,
17291     T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12,
17292     T13 v13, T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20,
17293     T21 v21, T22 v22, T23 v23) {
17294   return internal::ValueArray23<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
17295       T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23>(v1, v2, v3,
17296       v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19,
17297       v20, v21, v22, v23);
17298 }
17299 
17300 template <typename T1, typename T2, typename T3, typename T4, typename T5,
17301     typename T6, typename T7, typename T8, typename T9, typename T10,
17302     typename T11, typename T12, typename T13, typename T14, typename T15,
17303     typename T16, typename T17, typename T18, typename T19, typename T20,
17304     typename T21, typename T22, typename T23, typename T24>
17305 internal::ValueArray24<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
17306     T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24> Values(T1 v1, T2 v2,
17307     T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12,
17308     T13 v13, T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20,
17309     T21 v21, T22 v22, T23 v23, T24 v24) {
17310   return internal::ValueArray24<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
17311       T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24>(v1, v2,
17312       v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18,
17313       v19, v20, v21, v22, v23, v24);
17314 }
17315 
17316 template <typename T1, typename T2, typename T3, typename T4, typename T5,
17317     typename T6, typename T7, typename T8, typename T9, typename T10,
17318     typename T11, typename T12, typename T13, typename T14, typename T15,
17319     typename T16, typename T17, typename T18, typename T19, typename T20,
17320     typename T21, typename T22, typename T23, typename T24, typename T25>
17321 internal::ValueArray25<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
17322     T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25> Values(T1 v1,
17323     T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11,
17324     T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19,
17325     T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25) {
17326   return internal::ValueArray25<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
17327       T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25>(v1,
17328       v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17,
17329       v18, v19, v20, v21, v22, v23, v24, v25);
17330 }
17331 
17332 template <typename T1, typename T2, typename T3, typename T4, typename T5,
17333     typename T6, typename T7, typename T8, typename T9, typename T10,
17334     typename T11, typename T12, typename T13, typename T14, typename T15,
17335     typename T16, typename T17, typename T18, typename T19, typename T20,
17336     typename T21, typename T22, typename T23, typename T24, typename T25,
17337     typename T26>
17338 internal::ValueArray26<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
17339     T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
17340     T26> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
17341     T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
17342     T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
17343     T26 v26) {
17344   return internal::ValueArray26<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
17345       T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
17346       T26>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15,
17347       v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26);
17348 }
17349 
17350 template <typename T1, typename T2, typename T3, typename T4, typename T5,
17351     typename T6, typename T7, typename T8, typename T9, typename T10,
17352     typename T11, typename T12, typename T13, typename T14, typename T15,
17353     typename T16, typename T17, typename T18, typename T19, typename T20,
17354     typename T21, typename T22, typename T23, typename T24, typename T25,
17355     typename T26, typename T27>
17356 internal::ValueArray27<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
17357     T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
17358     T27> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
17359     T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
17360     T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
17361     T26 v26, T27 v27) {
17362   return internal::ValueArray27<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
17363       T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
17364       T26, T27>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14,
17365       v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27);
17366 }
17367 
17368 template <typename T1, typename T2, typename T3, typename T4, typename T5,
17369     typename T6, typename T7, typename T8, typename T9, typename T10,
17370     typename T11, typename T12, typename T13, typename T14, typename T15,
17371     typename T16, typename T17, typename T18, typename T19, typename T20,
17372     typename T21, typename T22, typename T23, typename T24, typename T25,
17373     typename T26, typename T27, typename T28>
17374 internal::ValueArray28<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
17375     T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
17376     T28> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
17377     T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
17378     T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
17379     T26 v26, T27 v27, T28 v28) {
17380   return internal::ValueArray28<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
17381       T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
17382       T26, T27, T28>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13,
17383       v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27,
17384       v28);
17385 }
17386 
17387 template <typename T1, typename T2, typename T3, typename T4, typename T5,
17388     typename T6, typename T7, typename T8, typename T9, typename T10,
17389     typename T11, typename T12, typename T13, typename T14, typename T15,
17390     typename T16, typename T17, typename T18, typename T19, typename T20,
17391     typename T21, typename T22, typename T23, typename T24, typename T25,
17392     typename T26, typename T27, typename T28, typename T29>
17393 internal::ValueArray29<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
17394     T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
17395     T29> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
17396     T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
17397     T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
17398     T26 v26, T27 v27, T28 v28, T29 v29) {
17399   return internal::ValueArray29<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
17400       T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
17401       T26, T27, T28, T29>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12,
17402       v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26,
17403       v27, v28, v29);
17404 }
17405 
17406 template <typename T1, typename T2, typename T3, typename T4, typename T5,
17407     typename T6, typename T7, typename T8, typename T9, typename T10,
17408     typename T11, typename T12, typename T13, typename T14, typename T15,
17409     typename T16, typename T17, typename T18, typename T19, typename T20,
17410     typename T21, typename T22, typename T23, typename T24, typename T25,
17411     typename T26, typename T27, typename T28, typename T29, typename T30>
17412 internal::ValueArray30<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
17413     T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
17414     T29, T30> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8,
17415     T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16,
17416     T17 v17, T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24,
17417     T25 v25, T26 v26, T27 v27, T28 v28, T29 v29, T30 v30) {
17418   return internal::ValueArray30<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
17419       T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
17420       T26, T27, T28, T29, T30>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11,
17421       v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25,
17422       v26, v27, v28, v29, v30);
17423 }
17424 
17425 template <typename T1, typename T2, typename T3, typename T4, typename T5,
17426     typename T6, typename T7, typename T8, typename T9, typename T10,
17427     typename T11, typename T12, typename T13, typename T14, typename T15,
17428     typename T16, typename T17, typename T18, typename T19, typename T20,
17429     typename T21, typename T22, typename T23, typename T24, typename T25,
17430     typename T26, typename T27, typename T28, typename T29, typename T30,
17431     typename T31>
17432 internal::ValueArray31<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
17433     T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
17434     T29, T30, T31> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7,
17435     T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15,
17436     T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23,
17437     T24 v24, T25 v25, T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31) {
17438   return internal::ValueArray31<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
17439       T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
17440       T26, T27, T28, T29, T30, T31>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10,
17441       v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24,
17442       v25, v26, v27, v28, v29, v30, v31);
17443 }
17444 
17445 template <typename T1, typename T2, typename T3, typename T4, typename T5,
17446     typename T6, typename T7, typename T8, typename T9, typename T10,
17447     typename T11, typename T12, typename T13, typename T14, typename T15,
17448     typename T16, typename T17, typename T18, typename T19, typename T20,
17449     typename T21, typename T22, typename T23, typename T24, typename T25,
17450     typename T26, typename T27, typename T28, typename T29, typename T30,
17451     typename T31, typename T32>
17452 internal::ValueArray32<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
17453     T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
17454     T29, T30, T31, T32> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7,
17455     T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15,
17456     T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23,
17457     T24 v24, T25 v25, T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31,
17458     T32 v32) {
17459   return internal::ValueArray32<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
17460       T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
17461       T26, T27, T28, T29, T30, T31, T32>(v1, v2, v3, v4, v5, v6, v7, v8, v9,
17462       v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23,
17463       v24, v25, v26, v27, v28, v29, v30, v31, v32);
17464 }
17465 
17466 template <typename T1, typename T2, typename T3, typename T4, typename T5,
17467     typename T6, typename T7, typename T8, typename T9, typename T10,
17468     typename T11, typename T12, typename T13, typename T14, typename T15,
17469     typename T16, typename T17, typename T18, typename T19, typename T20,
17470     typename T21, typename T22, typename T23, typename T24, typename T25,
17471     typename T26, typename T27, typename T28, typename T29, typename T30,
17472     typename T31, typename T32, typename T33>
17473 internal::ValueArray33<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
17474     T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
17475     T29, T30, T31, T32, T33> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6,
17476     T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15,
17477     T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23,
17478     T24 v24, T25 v25, T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31,
17479     T32 v32, T33 v33) {
17480   return internal::ValueArray33<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
17481       T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
17482       T26, T27, T28, T29, T30, T31, T32, T33>(v1, v2, v3, v4, v5, v6, v7, v8,
17483       v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23,
17484       v24, v25, v26, v27, v28, v29, v30, v31, v32, v33);
17485 }
17486 
17487 template <typename T1, typename T2, typename T3, typename T4, typename T5,
17488     typename T6, typename T7, typename T8, typename T9, typename T10,
17489     typename T11, typename T12, typename T13, typename T14, typename T15,
17490     typename T16, typename T17, typename T18, typename T19, typename T20,
17491     typename T21, typename T22, typename T23, typename T24, typename T25,
17492     typename T26, typename T27, typename T28, typename T29, typename T30,
17493     typename T31, typename T32, typename T33, typename T34>
17494 internal::ValueArray34<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
17495     T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
17496     T29, T30, T31, T32, T33, T34> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5,
17497     T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14,
17498     T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21, T22 v22,
17499     T23 v23, T24 v24, T25 v25, T26 v26, T27 v27, T28 v28, T29 v29, T30 v30,
17500     T31 v31, T32 v32, T33 v33, T34 v34) {
17501   return internal::ValueArray34<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
17502       T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
17503       T26, T27, T28, T29, T30, T31, T32, T33, T34>(v1, v2, v3, v4, v5, v6, v7,
17504       v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22,
17505       v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34);
17506 }
17507 
17508 template <typename T1, typename T2, typename T3, typename T4, typename T5,
17509     typename T6, typename T7, typename T8, typename T9, typename T10,
17510     typename T11, typename T12, typename T13, typename T14, typename T15,
17511     typename T16, typename T17, typename T18, typename T19, typename T20,
17512     typename T21, typename T22, typename T23, typename T24, typename T25,
17513     typename T26, typename T27, typename T28, typename T29, typename T30,
17514     typename T31, typename T32, typename T33, typename T34, typename T35>
17515 internal::ValueArray35<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
17516     T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
17517     T29, T30, T31, T32, T33, T34, T35> Values(T1 v1, T2 v2, T3 v3, T4 v4,
17518     T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13,
17519     T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21,
17520     T22 v22, T23 v23, T24 v24, T25 v25, T26 v26, T27 v27, T28 v28, T29 v29,
17521     T30 v30, T31 v31, T32 v32, T33 v33, T34 v34, T35 v35) {
17522   return internal::ValueArray35<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
17523       T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
17524       T26, T27, T28, T29, T30, T31, T32, T33, T34, T35>(v1, v2, v3, v4, v5, v6,
17525       v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21,
17526       v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35);
17527 }
17528 
17529 template <typename T1, typename T2, typename T3, typename T4, typename T5,
17530     typename T6, typename T7, typename T8, typename T9, typename T10,
17531     typename T11, typename T12, typename T13, typename T14, typename T15,
17532     typename T16, typename T17, typename T18, typename T19, typename T20,
17533     typename T21, typename T22, typename T23, typename T24, typename T25,
17534     typename T26, typename T27, typename T28, typename T29, typename T30,
17535     typename T31, typename T32, typename T33, typename T34, typename T35,
17536     typename T36>
17537 internal::ValueArray36<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
17538     T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
17539     T29, T30, T31, T32, T33, T34, T35, T36> Values(T1 v1, T2 v2, T3 v3, T4 v4,
17540     T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13,
17541     T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21,
17542     T22 v22, T23 v23, T24 v24, T25 v25, T26 v26, T27 v27, T28 v28, T29 v29,
17543     T30 v30, T31 v31, T32 v32, T33 v33, T34 v34, T35 v35, T36 v36) {
17544   return internal::ValueArray36<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
17545       T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
17546       T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36>(v1, v2, v3, v4,
17547       v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19,
17548       v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33,
17549       v34, v35, v36);
17550 }
17551 
17552 template <typename T1, typename T2, typename T3, typename T4, typename T5,
17553     typename T6, typename T7, typename T8, typename T9, typename T10,
17554     typename T11, typename T12, typename T13, typename T14, typename T15,
17555     typename T16, typename T17, typename T18, typename T19, typename T20,
17556     typename T21, typename T22, typename T23, typename T24, typename T25,
17557     typename T26, typename T27, typename T28, typename T29, typename T30,
17558     typename T31, typename T32, typename T33, typename T34, typename T35,
17559     typename T36, typename T37>
17560 internal::ValueArray37<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
17561     T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
17562     T29, T30, T31, T32, T33, T34, T35, T36, T37> Values(T1 v1, T2 v2, T3 v3,
17563     T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12,
17564     T13 v13, T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20,
17565     T21 v21, T22 v22, T23 v23, T24 v24, T25 v25, T26 v26, T27 v27, T28 v28,
17566     T29 v29, T30 v30, T31 v31, T32 v32, T33 v33, T34 v34, T35 v35, T36 v36,
17567     T37 v37) {
17568   return internal::ValueArray37<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
17569       T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
17570       T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37>(v1, v2, v3,
17571       v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19,
17572       v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33,
17573       v34, v35, v36, v37);
17574 }
17575 
17576 template <typename T1, typename T2, typename T3, typename T4, typename T5,
17577     typename T6, typename T7, typename T8, typename T9, typename T10,
17578     typename T11, typename T12, typename T13, typename T14, typename T15,
17579     typename T16, typename T17, typename T18, typename T19, typename T20,
17580     typename T21, typename T22, typename T23, typename T24, typename T25,
17581     typename T26, typename T27, typename T28, typename T29, typename T30,
17582     typename T31, typename T32, typename T33, typename T34, typename T35,
17583     typename T36, typename T37, typename T38>
17584 internal::ValueArray38<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
17585     T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
17586     T29, T30, T31, T32, T33, T34, T35, T36, T37, T38> Values(T1 v1, T2 v2,
17587     T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12,
17588     T13 v13, T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20,
17589     T21 v21, T22 v22, T23 v23, T24 v24, T25 v25, T26 v26, T27 v27, T28 v28,
17590     T29 v29, T30 v30, T31 v31, T32 v32, T33 v33, T34 v34, T35 v35, T36 v36,
17591     T37 v37, T38 v38) {
17592   return internal::ValueArray38<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
17593       T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
17594       T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38>(v1, v2,
17595       v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18,
17596       v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32,
17597       v33, v34, v35, v36, v37, v38);
17598 }
17599 
17600 template <typename T1, typename T2, typename T3, typename T4, typename T5,
17601     typename T6, typename T7, typename T8, typename T9, typename T10,
17602     typename T11, typename T12, typename T13, typename T14, typename T15,
17603     typename T16, typename T17, typename T18, typename T19, typename T20,
17604     typename T21, typename T22, typename T23, typename T24, typename T25,
17605     typename T26, typename T27, typename T28, typename T29, typename T30,
17606     typename T31, typename T32, typename T33, typename T34, typename T35,
17607     typename T36, typename T37, typename T38, typename T39>
17608 internal::ValueArray39<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
17609     T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
17610     T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39> Values(T1 v1, T2 v2,
17611     T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12,
17612     T13 v13, T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20,
17613     T21 v21, T22 v22, T23 v23, T24 v24, T25 v25, T26 v26, T27 v27, T28 v28,
17614     T29 v29, T30 v30, T31 v31, T32 v32, T33 v33, T34 v34, T35 v35, T36 v36,
17615     T37 v37, T38 v38, T39 v39) {
17616   return internal::ValueArray39<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
17617       T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
17618       T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39>(v1,
17619       v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17,
17620       v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31,
17621       v32, v33, v34, v35, v36, v37, v38, v39);
17622 }
17623 
17624 template <typename T1, typename T2, typename T3, typename T4, typename T5,
17625     typename T6, typename T7, typename T8, typename T9, typename T10,
17626     typename T11, typename T12, typename T13, typename T14, typename T15,
17627     typename T16, typename T17, typename T18, typename T19, typename T20,
17628     typename T21, typename T22, typename T23, typename T24, typename T25,
17629     typename T26, typename T27, typename T28, typename T29, typename T30,
17630     typename T31, typename T32, typename T33, typename T34, typename T35,
17631     typename T36, typename T37, typename T38, typename T39, typename T40>
17632 internal::ValueArray40<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
17633     T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
17634     T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40> Values(T1 v1,
17635     T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11,
17636     T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19,
17637     T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25, T26 v26, T27 v27,
17638     T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33, T34 v34, T35 v35,
17639     T36 v36, T37 v37, T38 v38, T39 v39, T40 v40) {
17640   return internal::ValueArray40<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
17641       T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
17642       T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39,
17643       T40>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15,
17644       v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29,
17645       v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40);
17646 }
17647 
17648 template <typename T1, typename T2, typename T3, typename T4, typename T5,
17649     typename T6, typename T7, typename T8, typename T9, typename T10,
17650     typename T11, typename T12, typename T13, typename T14, typename T15,
17651     typename T16, typename T17, typename T18, typename T19, typename T20,
17652     typename T21, typename T22, typename T23, typename T24, typename T25,
17653     typename T26, typename T27, typename T28, typename T29, typename T30,
17654     typename T31, typename T32, typename T33, typename T34, typename T35,
17655     typename T36, typename T37, typename T38, typename T39, typename T40,
17656     typename T41>
17657 internal::ValueArray41<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
17658     T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
17659     T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40,
17660     T41> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
17661     T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
17662     T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
17663     T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33,
17664     T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39, T40 v40, T41 v41) {
17665   return internal::ValueArray41<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
17666       T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
17667       T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39,
17668       T40, T41>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14,
17669       v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28,
17670       v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41);
17671 }
17672 
17673 template <typename T1, typename T2, typename T3, typename T4, typename T5,
17674     typename T6, typename T7, typename T8, typename T9, typename T10,
17675     typename T11, typename T12, typename T13, typename T14, typename T15,
17676     typename T16, typename T17, typename T18, typename T19, typename T20,
17677     typename T21, typename T22, typename T23, typename T24, typename T25,
17678     typename T26, typename T27, typename T28, typename T29, typename T30,
17679     typename T31, typename T32, typename T33, typename T34, typename T35,
17680     typename T36, typename T37, typename T38, typename T39, typename T40,
17681     typename T41, typename T42>
17682 internal::ValueArray42<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
17683     T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
17684     T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41,
17685     T42> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
17686     T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
17687     T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
17688     T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33,
17689     T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39, T40 v40, T41 v41,
17690     T42 v42) {
17691   return internal::ValueArray42<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
17692       T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
17693       T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39,
17694       T40, T41, T42>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13,
17695       v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27,
17696       v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41,
17697       v42);
17698 }
17699 
17700 template <typename T1, typename T2, typename T3, typename T4, typename T5,
17701     typename T6, typename T7, typename T8, typename T9, typename T10,
17702     typename T11, typename T12, typename T13, typename T14, typename T15,
17703     typename T16, typename T17, typename T18, typename T19, typename T20,
17704     typename T21, typename T22, typename T23, typename T24, typename T25,
17705     typename T26, typename T27, typename T28, typename T29, typename T30,
17706     typename T31, typename T32, typename T33, typename T34, typename T35,
17707     typename T36, typename T37, typename T38, typename T39, typename T40,
17708     typename T41, typename T42, typename T43>
17709 internal::ValueArray43<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
17710     T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
17711     T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42,
17712     T43> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
17713     T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
17714     T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
17715     T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33,
17716     T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39, T40 v40, T41 v41,
17717     T42 v42, T43 v43) {
17718   return internal::ValueArray43<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
17719       T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
17720       T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39,
17721       T40, T41, T42, T43>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12,
17722       v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26,
17723       v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40,
17724       v41, v42, v43);
17725 }
17726 
17727 template <typename T1, typename T2, typename T3, typename T4, typename T5,
17728     typename T6, typename T7, typename T8, typename T9, typename T10,
17729     typename T11, typename T12, typename T13, typename T14, typename T15,
17730     typename T16, typename T17, typename T18, typename T19, typename T20,
17731     typename T21, typename T22, typename T23, typename T24, typename T25,
17732     typename T26, typename T27, typename T28, typename T29, typename T30,
17733     typename T31, typename T32, typename T33, typename T34, typename T35,
17734     typename T36, typename T37, typename T38, typename T39, typename T40,
17735     typename T41, typename T42, typename T43, typename T44>
17736 internal::ValueArray44<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
17737     T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
17738     T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43,
17739     T44> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
17740     T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
17741     T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
17742     T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33,
17743     T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39, T40 v40, T41 v41,
17744     T42 v42, T43 v43, T44 v44) {
17745   return internal::ValueArray44<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
17746       T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
17747       T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39,
17748       T40, T41, T42, T43, T44>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11,
17749       v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25,
17750       v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39,
17751       v40, v41, v42, v43, v44);
17752 }
17753 
17754 template <typename T1, typename T2, typename T3, typename T4, typename T5,
17755     typename T6, typename T7, typename T8, typename T9, typename T10,
17756     typename T11, typename T12, typename T13, typename T14, typename T15,
17757     typename T16, typename T17, typename T18, typename T19, typename T20,
17758     typename T21, typename T22, typename T23, typename T24, typename T25,
17759     typename T26, typename T27, typename T28, typename T29, typename T30,
17760     typename T31, typename T32, typename T33, typename T34, typename T35,
17761     typename T36, typename T37, typename T38, typename T39, typename T40,
17762     typename T41, typename T42, typename T43, typename T44, typename T45>
17763 internal::ValueArray45<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
17764     T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
17765     T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43,
17766     T44, T45> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8,
17767     T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16,
17768     T17 v17, T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24,
17769     T25 v25, T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32,
17770     T33 v33, T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39, T40 v40,
17771     T41 v41, T42 v42, T43 v43, T44 v44, T45 v45) {
17772   return internal::ValueArray45<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
17773       T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
17774       T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39,
17775       T40, T41, T42, T43, T44, T45>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10,
17776       v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24,
17777       v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38,
17778       v39, v40, v41, v42, v43, v44, v45);
17779 }
17780 
17781 template <typename T1, typename T2, typename T3, typename T4, typename T5,
17782     typename T6, typename T7, typename T8, typename T9, typename T10,
17783     typename T11, typename T12, typename T13, typename T14, typename T15,
17784     typename T16, typename T17, typename T18, typename T19, typename T20,
17785     typename T21, typename T22, typename T23, typename T24, typename T25,
17786     typename T26, typename T27, typename T28, typename T29, typename T30,
17787     typename T31, typename T32, typename T33, typename T34, typename T35,
17788     typename T36, typename T37, typename T38, typename T39, typename T40,
17789     typename T41, typename T42, typename T43, typename T44, typename T45,
17790     typename T46>
17791 internal::ValueArray46<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
17792     T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
17793     T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43,
17794     T44, T45, T46> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7,
17795     T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15,
17796     T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23,
17797     T24 v24, T25 v25, T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31,
17798     T32 v32, T33 v33, T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39,
17799     T40 v40, T41 v41, T42 v42, T43 v43, T44 v44, T45 v45, T46 v46) {
17800   return internal::ValueArray46<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
17801       T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
17802       T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39,
17803       T40, T41, T42, T43, T44, T45, T46>(v1, v2, v3, v4, v5, v6, v7, v8, v9,
17804       v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23,
17805       v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37,
17806       v38, v39, v40, v41, v42, v43, v44, v45, v46);
17807 }
17808 
17809 template <typename T1, typename T2, typename T3, typename T4, typename T5,
17810     typename T6, typename T7, typename T8, typename T9, typename T10,
17811     typename T11, typename T12, typename T13, typename T14, typename T15,
17812     typename T16, typename T17, typename T18, typename T19, typename T20,
17813     typename T21, typename T22, typename T23, typename T24, typename T25,
17814     typename T26, typename T27, typename T28, typename T29, typename T30,
17815     typename T31, typename T32, typename T33, typename T34, typename T35,
17816     typename T36, typename T37, typename T38, typename T39, typename T40,
17817     typename T41, typename T42, typename T43, typename T44, typename T45,
17818     typename T46, typename T47>
17819 internal::ValueArray47<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
17820     T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
17821     T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43,
17822     T44, T45, T46, T47> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7,
17823     T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15,
17824     T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23,
17825     T24 v24, T25 v25, T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31,
17826     T32 v32, T33 v33, T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39,
17827     T40 v40, T41 v41, T42 v42, T43 v43, T44 v44, T45 v45, T46 v46, T47 v47) {
17828   return internal::ValueArray47<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
17829       T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
17830       T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39,
17831       T40, T41, T42, T43, T44, T45, T46, T47>(v1, v2, v3, v4, v5, v6, v7, v8,
17832       v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23,
17833       v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37,
17834       v38, v39, v40, v41, v42, v43, v44, v45, v46, v47);
17835 }
17836 
17837 template <typename T1, typename T2, typename T3, typename T4, typename T5,
17838     typename T6, typename T7, typename T8, typename T9, typename T10,
17839     typename T11, typename T12, typename T13, typename T14, typename T15,
17840     typename T16, typename T17, typename T18, typename T19, typename T20,
17841     typename T21, typename T22, typename T23, typename T24, typename T25,
17842     typename T26, typename T27, typename T28, typename T29, typename T30,
17843     typename T31, typename T32, typename T33, typename T34, typename T35,
17844     typename T36, typename T37, typename T38, typename T39, typename T40,
17845     typename T41, typename T42, typename T43, typename T44, typename T45,
17846     typename T46, typename T47, typename T48>
17847 internal::ValueArray48<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
17848     T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
17849     T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43,
17850     T44, T45, T46, T47, T48> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6,
17851     T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15,
17852     T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23,
17853     T24 v24, T25 v25, T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31,
17854     T32 v32, T33 v33, T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39,
17855     T40 v40, T41 v41, T42 v42, T43 v43, T44 v44, T45 v45, T46 v46, T47 v47,
17856     T48 v48) {
17857   return internal::ValueArray48<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
17858       T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
17859       T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39,
17860       T40, T41, T42, T43, T44, T45, T46, T47, T48>(v1, v2, v3, v4, v5, v6, v7,
17861       v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22,
17862       v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36,
17863       v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48);
17864 }
17865 
17866 template <typename T1, typename T2, typename T3, typename T4, typename T5,
17867     typename T6, typename T7, typename T8, typename T9, typename T10,
17868     typename T11, typename T12, typename T13, typename T14, typename T15,
17869     typename T16, typename T17, typename T18, typename T19, typename T20,
17870     typename T21, typename T22, typename T23, typename T24, typename T25,
17871     typename T26, typename T27, typename T28, typename T29, typename T30,
17872     typename T31, typename T32, typename T33, typename T34, typename T35,
17873     typename T36, typename T37, typename T38, typename T39, typename T40,
17874     typename T41, typename T42, typename T43, typename T44, typename T45,
17875     typename T46, typename T47, typename T48, typename T49>
17876 internal::ValueArray49<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
17877     T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
17878     T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43,
17879     T44, T45, T46, T47, T48, T49> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5,
17880     T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14,
17881     T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21, T22 v22,
17882     T23 v23, T24 v24, T25 v25, T26 v26, T27 v27, T28 v28, T29 v29, T30 v30,
17883     T31 v31, T32 v32, T33 v33, T34 v34, T35 v35, T36 v36, T37 v37, T38 v38,
17884     T39 v39, T40 v40, T41 v41, T42 v42, T43 v43, T44 v44, T45 v45, T46 v46,
17885     T47 v47, T48 v48, T49 v49) {
17886   return internal::ValueArray49<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
17887       T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
17888       T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39,
17889       T40, T41, T42, T43, T44, T45, T46, T47, T48, T49>(v1, v2, v3, v4, v5, v6,
17890       v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21,
17891       v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35,
17892       v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49);
17893 }
17894 
17895 template <typename T1, typename T2, typename T3, typename T4, typename T5,
17896     typename T6, typename T7, typename T8, typename T9, typename T10,
17897     typename T11, typename T12, typename T13, typename T14, typename T15,
17898     typename T16, typename T17, typename T18, typename T19, typename T20,
17899     typename T21, typename T22, typename T23, typename T24, typename T25,
17900     typename T26, typename T27, typename T28, typename T29, typename T30,
17901     typename T31, typename T32, typename T33, typename T34, typename T35,
17902     typename T36, typename T37, typename T38, typename T39, typename T40,
17903     typename T41, typename T42, typename T43, typename T44, typename T45,
17904     typename T46, typename T47, typename T48, typename T49, typename T50>
17905 internal::ValueArray50<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
17906     T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
17907     T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43,
17908     T44, T45, T46, T47, T48, T49, T50> Values(T1 v1, T2 v2, T3 v3, T4 v4,
17909     T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13,
17910     T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21,
17911     T22 v22, T23 v23, T24 v24, T25 v25, T26 v26, T27 v27, T28 v28, T29 v29,
17912     T30 v30, T31 v31, T32 v32, T33 v33, T34 v34, T35 v35, T36 v36, T37 v37,
17913     T38 v38, T39 v39, T40 v40, T41 v41, T42 v42, T43 v43, T44 v44, T45 v45,
17914     T46 v46, T47 v47, T48 v48, T49 v49, T50 v50) {
17915   return internal::ValueArray50<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
17916       T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
17917       T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39,
17918       T40, T41, T42, T43, T44, T45, T46, T47, T48, T49, T50>(v1, v2, v3, v4,
17919       v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19,
17920       v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33,
17921       v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47,
17922       v48, v49, v50);
17923 }
17924 
17925 // Bool() allows generating tests with parameters in a set of (false, true).
17926 //
17927 // Synopsis:
17928 // Bool()
17929 //   - returns a generator producing sequences with elements {false, true}.
17930 //
17931 // It is useful when testing code that depends on Boolean flags. Combinations
17932 // of multiple flags can be tested when several Bool()'s are combined using
17933 // Combine() function.
17934 //
17935 // In the following example all tests in the test case FlagDependentTest
17936 // will be instantiated twice with parameters false and true.
17937 //
17938 // class FlagDependentTest : public testing::TestWithParam<bool> {
17939 //   virtual void SetUp() {
17940 //     external_flag = GetParam();
17941 //   }
17942 // }
17943 // INSTANTIATE_TEST_CASE_P(BoolSequence, FlagDependentTest, Bool());
17944 //
17945 inline internal::ParamGenerator<bool> Bool() {
17946   return Values(false, true);
17947 }
17948 
17949 # if GTEST_HAS_COMBINE
17950 // Combine() allows the user to combine two or more sequences to produce
17951 // values of a Cartesian product of those sequences' elements.
17952 //
17953 // Synopsis:
17954 // Combine(gen1, gen2, ..., genN)
17955 //   - returns a generator producing sequences with elements coming from
17956 //     the Cartesian product of elements from the sequences generated by
17957 //     gen1, gen2, ..., genN. The sequence elements will have a type of
17958 //     tuple<T1, T2, ..., TN> where T1, T2, ..., TN are the types
17959 //     of elements from sequences produces by gen1, gen2, ..., genN.
17960 //
17961 // Combine can have up to 10 arguments. This number is currently limited
17962 // by the maximum number of elements in the tuple implementation used by Google
17963 // Test.
17964 //
17965 // Example:
17966 //
17967 // This will instantiate tests in test case AnimalTest each one with
17968 // the parameter values tuple("cat", BLACK), tuple("cat", WHITE),
17969 // tuple("dog", BLACK), and tuple("dog", WHITE):
17970 //
17971 // enum Color { BLACK, GRAY, WHITE };
17972 // class AnimalTest
17973 //     : public testing::TestWithParam<tuple<const char*, Color> > {...};
17974 //
17975 // TEST_P(AnimalTest, AnimalLooksNice) {...}
17976 //
17977 // INSTANTIATE_TEST_CASE_P(AnimalVariations, AnimalTest,
17978 //                         Combine(Values("cat", "dog"),
17979 //                                 Values(BLACK, WHITE)));
17980 //
17981 // This will instantiate tests in FlagDependentTest with all variations of two
17982 // Boolean flags:
17983 //
17984 // class FlagDependentTest
17985 //     : public testing::TestWithParam<tuple<bool, bool> > {
17986 //   virtual void SetUp() {
17987 //     // Assigns external_flag_1 and external_flag_2 values from the tuple.
17988 //     tie(external_flag_1, external_flag_2) = GetParam();
17989 //   }
17990 // };
17991 //
17992 // TEST_P(FlagDependentTest, TestFeature1) {
17993 //   // Test your code using external_flag_1 and external_flag_2 here.
17994 // }
17995 // INSTANTIATE_TEST_CASE_P(TwoBoolSequence, FlagDependentTest,
17996 //                         Combine(Bool(), Bool()));
17997 //
17998 template <typename Generator1, typename Generator2>
17999 internal::CartesianProductHolder2<Generator1, Generator2> Combine(
18000     const Generator1& g1, const Generator2& g2) {
18001   return internal::CartesianProductHolder2<Generator1, Generator2>(
18002       g1, g2);
18003 }
18004 
18005 template <typename Generator1, typename Generator2, typename Generator3>
18006 internal::CartesianProductHolder3<Generator1, Generator2, Generator3> Combine(
18007     const Generator1& g1, const Generator2& g2, const Generator3& g3) {
18008   return internal::CartesianProductHolder3<Generator1, Generator2, Generator3>(
18009       g1, g2, g3);
18010 }
18011 
18012 template <typename Generator1, typename Generator2, typename Generator3,
18013     typename Generator4>
18014 internal::CartesianProductHolder4<Generator1, Generator2, Generator3,
18015     Generator4> Combine(
18016     const Generator1& g1, const Generator2& g2, const Generator3& g3,
18017         const Generator4& g4) {
18018   return internal::CartesianProductHolder4<Generator1, Generator2, Generator3,
18019       Generator4>(
18020       g1, g2, g3, g4);
18021 }
18022 
18023 template <typename Generator1, typename Generator2, typename Generator3,
18024     typename Generator4, typename Generator5>
18025 internal::CartesianProductHolder5<Generator1, Generator2, Generator3,
18026     Generator4, Generator5> Combine(
18027     const Generator1& g1, const Generator2& g2, const Generator3& g3,
18028         const Generator4& g4, const Generator5& g5) {
18029   return internal::CartesianProductHolder5<Generator1, Generator2, Generator3,
18030       Generator4, Generator5>(
18031       g1, g2, g3, g4, g5);
18032 }
18033 
18034 template <typename Generator1, typename Generator2, typename Generator3,
18035     typename Generator4, typename Generator5, typename Generator6>
18036 internal::CartesianProductHolder6<Generator1, Generator2, Generator3,
18037     Generator4, Generator5, Generator6> Combine(
18038     const Generator1& g1, const Generator2& g2, const Generator3& g3,
18039         const Generator4& g4, const Generator5& g5, const Generator6& g6) {
18040   return internal::CartesianProductHolder6<Generator1, Generator2, Generator3,
18041       Generator4, Generator5, Generator6>(
18042       g1, g2, g3, g4, g5, g6);
18043 }
18044 
18045 template <typename Generator1, typename Generator2, typename Generator3,
18046     typename Generator4, typename Generator5, typename Generator6,
18047     typename Generator7>
18048 internal::CartesianProductHolder7<Generator1, Generator2, Generator3,
18049     Generator4, Generator5, Generator6, Generator7> Combine(
18050     const Generator1& g1, const Generator2& g2, const Generator3& g3,
18051         const Generator4& g4, const Generator5& g5, const Generator6& g6,
18052         const Generator7& g7) {
18053   return internal::CartesianProductHolder7<Generator1, Generator2, Generator3,
18054       Generator4, Generator5, Generator6, Generator7>(
18055       g1, g2, g3, g4, g5, g6, g7);
18056 }
18057 
18058 template <typename Generator1, typename Generator2, typename Generator3,
18059     typename Generator4, typename Generator5, typename Generator6,
18060     typename Generator7, typename Generator8>
18061 internal::CartesianProductHolder8<Generator1, Generator2, Generator3,
18062     Generator4, Generator5, Generator6, Generator7, Generator8> Combine(
18063     const Generator1& g1, const Generator2& g2, const Generator3& g3,
18064         const Generator4& g4, const Generator5& g5, const Generator6& g6,
18065         const Generator7& g7, const Generator8& g8) {
18066   return internal::CartesianProductHolder8<Generator1, Generator2, Generator3,
18067       Generator4, Generator5, Generator6, Generator7, Generator8>(
18068       g1, g2, g3, g4, g5, g6, g7, g8);
18069 }
18070 
18071 template <typename Generator1, typename Generator2, typename Generator3,
18072     typename Generator4, typename Generator5, typename Generator6,
18073     typename Generator7, typename Generator8, typename Generator9>
18074 internal::CartesianProductHolder9<Generator1, Generator2, Generator3,
18075     Generator4, Generator5, Generator6, Generator7, Generator8,
18076     Generator9> Combine(
18077     const Generator1& g1, const Generator2& g2, const Generator3& g3,
18078         const Generator4& g4, const Generator5& g5, const Generator6& g6,
18079         const Generator7& g7, const Generator8& g8, const Generator9& g9) {
18080   return internal::CartesianProductHolder9<Generator1, Generator2, Generator3,
18081       Generator4, Generator5, Generator6, Generator7, Generator8, Generator9>(
18082       g1, g2, g3, g4, g5, g6, g7, g8, g9);
18083 }
18084 
18085 template <typename Generator1, typename Generator2, typename Generator3,
18086     typename Generator4, typename Generator5, typename Generator6,
18087     typename Generator7, typename Generator8, typename Generator9,
18088     typename Generator10>
18089 internal::CartesianProductHolder10<Generator1, Generator2, Generator3,
18090     Generator4, Generator5, Generator6, Generator7, Generator8, Generator9,
18091     Generator10> Combine(
18092     const Generator1& g1, const Generator2& g2, const Generator3& g3,
18093         const Generator4& g4, const Generator5& g5, const Generator6& g6,
18094         const Generator7& g7, const Generator8& g8, const Generator9& g9,
18095         const Generator10& g10) {
18096   return internal::CartesianProductHolder10<Generator1, Generator2, Generator3,
18097       Generator4, Generator5, Generator6, Generator7, Generator8, Generator9,
18098       Generator10>(
18099       g1, g2, g3, g4, g5, g6, g7, g8, g9, g10);
18100 }
18101 # endif  // GTEST_HAS_COMBINE
18102 
18103 
18104 
18105 # define TEST_P(test_case_name, test_name) \
18106   class GTEST_TEST_CLASS_NAME_(test_case_name, test_name) \
18107       : public test_case_name { \
18108    public: \
18109     GTEST_TEST_CLASS_NAME_(test_case_name, test_name)() {} \
18110     virtual void TestBody(); \
18111    private: \
18112     static int AddToRegistry() { \
18113       ::testing::UnitTest::GetInstance()->parameterized_test_registry(). \
18114           GetTestCasePatternHolder<test_case_name>(\
18115               #test_case_name, \
18116               ::testing::internal::CodeLocation(\
18117                   __FILE__, __LINE__))->AddTestPattern(\
18118                       #test_case_name, \
18119                       #test_name, \
18120                       new ::testing::internal::TestMetaFactory< \
18121                           GTEST_TEST_CLASS_NAME_(\
18122                               test_case_name, test_name)>()); \
18123       return 0; \
18124     } \
18125     static int gtest_registering_dummy_ GTEST_ATTRIBUTE_UNUSED_; \
18126     GTEST_DISALLOW_COPY_AND_ASSIGN_(\
18127         GTEST_TEST_CLASS_NAME_(test_case_name, test_name)); \
18128   }; \
18129   int GTEST_TEST_CLASS_NAME_(test_case_name, \
18130                              test_name)::gtest_registering_dummy_ = \
18131       GTEST_TEST_CLASS_NAME_(test_case_name, test_name)::AddToRegistry(); \
18132   void GTEST_TEST_CLASS_NAME_(test_case_name, test_name)::TestBody()
18133 
18134 // The optional last argument to INSTANTIATE_TEST_CASE_P allows the user
18135 // to specify a function or functor that generates custom test name suffixes
18136 // based on the test parameters. The function should accept one argument of
18137 // type testing::TestParamInfo<class ParamType>, and return std::string.
18138 //
18139 // testing::PrintToStringParamName is a builtin test suffix generator that
18140 // returns the value of testing::PrintToString(GetParam()). It does not work
18141 // for std::string or C strings.
18142 //
18143 // Note: test names must be non-empty, unique, and may only contain ASCII
18144 // alphanumeric characters or underscore.
18145 
18146 # define INSTANTIATE_TEST_CASE_P(prefix, test_case_name, generator, ...) \
18147   ::testing::internal::ParamGenerator<test_case_name::ParamType> \
18148       gtest_##prefix##test_case_name##_EvalGenerator_() { return generator; } \
18149   ::std::string gtest_##prefix##test_case_name##_EvalGenerateName_( \
18150       const ::testing::TestParamInfo<test_case_name::ParamType>& info) { \
18151     return ::testing::internal::GetParamNameGen<test_case_name::ParamType> \
18152         (__VA_ARGS__)(info); \
18153   } \
18154   int gtest_##prefix##test_case_name##_dummy_ GTEST_ATTRIBUTE_UNUSED_ = \
18155       ::testing::UnitTest::GetInstance()->parameterized_test_registry(). \
18156           GetTestCasePatternHolder<test_case_name>(\
18157               #test_case_name, \
18158               ::testing::internal::CodeLocation(\
18159                   __FILE__, __LINE__))->AddTestCaseInstantiation(\
18160                       #prefix, \
18161                       &gtest_##prefix##test_case_name##_EvalGenerator_, \
18162                       &gtest_##prefix##test_case_name##_EvalGenerateName_, \
18163                       __FILE__, __LINE__)
18164 
18165 }  // namespace testing
18166 
18167 #endif  // GTEST_HAS_PARAM_TEST
18168 
18169 #endif  // GTEST_INCLUDE_GTEST_GTEST_PARAM_TEST_H_
18170 // Copyright 2006, Google Inc.
18171 // All rights reserved.
18172 //
18173 // Redistribution and use in source and binary forms, with or without
18174 // modification, are permitted provided that the following conditions are
18175 // met:
18176 //
18177 //     * Redistributions of source code must retain the above copyright
18178 // notice, this list of conditions and the following disclaimer.
18179 //     * Redistributions in binary form must reproduce the above
18180 // copyright notice, this list of conditions and the following disclaimer
18181 // in the documentation and/or other materials provided with the
18182 // distribution.
18183 //     * Neither the name of Google Inc. nor the names of its
18184 // contributors may be used to endorse or promote products derived from
18185 // this software without specific prior written permission.
18186 //
18187 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18188 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18189 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
18190 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
18191 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
18192 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
18193 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
18194 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
18195 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
18196 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
18197 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
18198 //
18199 // Author: wan@google.com (Zhanyong Wan)
18200 //
18201 // Google C++ Testing Framework definitions useful in production code.
18202 
18203 #ifndef GTEST_INCLUDE_GTEST_GTEST_PROD_H_
18204 #define GTEST_INCLUDE_GTEST_GTEST_PROD_H_
18205 
18206 // When you need to test the private or protected members of a class,
18207 // use the FRIEND_TEST macro to declare your tests as friends of the
18208 // class.  For example:
18209 //
18210 // class MyClass {
18211 //  private:
18212 //   void MyMethod();
18213 //   FRIEND_TEST(MyClassTest, MyMethod);
18214 // };
18215 //
18216 // class MyClassTest : public testing::Test {
18217 //   // ...
18218 // };
18219 //
18220 // TEST_F(MyClassTest, MyMethod) {
18221 //   // Can call MyClass::MyMethod() here.
18222 // }
18223 
18224 #define FRIEND_TEST(test_case_name, test_name)\
18225 friend class test_case_name##_##test_name##_Test
18226 
18227 #endif  // GTEST_INCLUDE_GTEST_GTEST_PROD_H_
18228 // Copyright 2008, Google Inc.
18229 // All rights reserved.
18230 //
18231 // Redistribution and use in source and binary forms, with or without
18232 // modification, are permitted provided that the following conditions are
18233 // met:
18234 //
18235 //     * Redistributions of source code must retain the above copyright
18236 // notice, this list of conditions and the following disclaimer.
18237 //     * Redistributions in binary form must reproduce the above
18238 // copyright notice, this list of conditions and the following disclaimer
18239 // in the documentation and/or other materials provided with the
18240 // distribution.
18241 //     * Neither the name of Google Inc. nor the names of its
18242 // contributors may be used to endorse or promote products derived from
18243 // this software without specific prior written permission.
18244 //
18245 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18246 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18247 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
18248 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
18249 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
18250 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
18251 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
18252 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
18253 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
18254 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
18255 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
18256 //
18257 // Author: mheule@google.com (Markus Heule)
18258 //
18259 
18260 #ifndef GTEST_INCLUDE_GTEST_GTEST_TEST_PART_H_
18261 #define GTEST_INCLUDE_GTEST_GTEST_TEST_PART_H_
18262 
18263 #include <iosfwd>
18264 #include <vector>
18265 
18266 namespace testing {
18267 
18268 // A copyable object representing the result of a test part (i.e. an
18269 // assertion or an explicit FAIL(), ADD_FAILURE(), or SUCCESS()).
18270 //
18271 // Don't inherit from TestPartResult as its destructor is not virtual.
18272 class GTEST_API_ TestPartResult {
18273  public:
18274   // The possible outcomes of a test part (i.e. an assertion or an
18275   // explicit SUCCEED(), FAIL(), or ADD_FAILURE()).
18276   enum Type {
18277     kSuccess,          // Succeeded.
18278     kNonFatalFailure,  // Failed but the test can continue.
18279     kFatalFailure      // Failed and the test should be terminated.
18280   };
18281 
18282   // C'tor.  TestPartResult does NOT have a default constructor.
18283   // Always use this constructor (with parameters) to create a
18284   // TestPartResult object.
18285   TestPartResult(Type a_type,
18286                  const char* a_file_name,
18287                  int a_line_number,
18288                  const char* a_message)
18289       : type_(a_type),
18290         file_name_(a_file_name == NULL ? "" : a_file_name),
18291         line_number_(a_line_number),
18292         summary_(ExtractSummary(a_message)),
18293         message_(a_message) {
18294   }
18295 
18296   // Gets the outcome of the test part.
18297   Type type() const { return type_; }
18298 
18299   // Gets the name of the source file where the test part took place, or
18300   // NULL if it's unknown.
18301   const char* file_name() const {
18302     return file_name_.empty() ? NULL : file_name_.c_str();
18303   }
18304 
18305   // Gets the line in the source file where the test part took place,
18306   // or -1 if it's unknown.
18307   int line_number() const { return line_number_; }
18308 
18309   // Gets the summary of the failure message.
18310   const char* summary() const { return summary_.c_str(); }
18311 
18312   // Gets the message associated with the test part.
18313   const char* message() const { return message_.c_str(); }
18314 
18315   // Returns true iff the test part passed.
18316   bool passed() const { return type_ == kSuccess; }
18317 
18318   // Returns true iff the test part failed.
18319   bool failed() const { return type_ != kSuccess; }
18320 
18321   // Returns true iff the test part non-fatally failed.
18322   bool nonfatally_failed() const { return type_ == kNonFatalFailure; }
18323 
18324   // Returns true iff the test part fatally failed.
18325   bool fatally_failed() const { return type_ == kFatalFailure; }
18326 
18327  private:
18328   Type type_;
18329 
18330   // Gets the summary of the failure message by omitting the stack
18331   // trace in it.
18332   static std::string ExtractSummary(const char* message);
18333 
18334   // The name of the source file where the test part took place, or
18335   // "" if the source file is unknown.
18336   std::string file_name_;
18337   // The line in the source file where the test part took place, or -1
18338   // if the line number is unknown.
18339   int line_number_;
18340   std::string summary_;  // The test failure summary.
18341   std::string message_;  // The test failure message.
18342 };
18343 
18344 // Prints a TestPartResult object.
18345 std::ostream& operator<<(std::ostream& os, const TestPartResult& result);
18346 
18347 // An array of TestPartResult objects.
18348 //
18349 // Don't inherit from TestPartResultArray as its destructor is not
18350 // virtual.
18351 class GTEST_API_ TestPartResultArray {
18352  public:
18353   TestPartResultArray() {}
18354 
18355   // Appends the given TestPartResult to the array.
18356   void Append(const TestPartResult& result);
18357 
18358   // Returns the TestPartResult at the given index (0-based).
18359   const TestPartResult& GetTestPartResult(int index) const;
18360 
18361   // Returns the number of TestPartResult objects in the array.
18362   int size() const;
18363 
18364  private:
18365   std::vector<TestPartResult> array_;
18366 
18367   GTEST_DISALLOW_COPY_AND_ASSIGN_(TestPartResultArray);
18368 };
18369 
18370 // This interface knows how to report a test part result.
18371 class TestPartResultReporterInterface {
18372  public:
18373   virtual ~TestPartResultReporterInterface() {}
18374 
18375   virtual void ReportTestPartResult(const TestPartResult& result) = 0;
18376 };
18377 
18378 namespace internal {
18379 
18380 // This helper class is used by {ASSERT|EXPECT}_NO_FATAL_FAILURE to check if a
18381 // statement generates new fatal failures. To do so it registers itself as the
18382 // current test part result reporter. Besides checking if fatal failures were
18383 // reported, it only delegates the reporting to the former result reporter.
18384 // The original result reporter is restored in the destructor.
18385 // INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
18386 class GTEST_API_ HasNewFatalFailureHelper
18387     : public TestPartResultReporterInterface {
18388  public:
18389   HasNewFatalFailureHelper();
18390   virtual ~HasNewFatalFailureHelper();
18391   virtual void ReportTestPartResult(const TestPartResult& result);
18392   bool has_new_fatal_failure() const { return has_new_fatal_failure_; }
18393  private:
18394   bool has_new_fatal_failure_;
18395   TestPartResultReporterInterface* original_reporter_;
18396 
18397   GTEST_DISALLOW_COPY_AND_ASSIGN_(HasNewFatalFailureHelper);
18398 };
18399 
18400 }  // namespace internal
18401 
18402 }  // namespace testing
18403 
18404 #endif  // GTEST_INCLUDE_GTEST_GTEST_TEST_PART_H_
18405 // Copyright 2008 Google Inc.
18406 // All Rights Reserved.
18407 //
18408 // Redistribution and use in source and binary forms, with or without
18409 // modification, are permitted provided that the following conditions are
18410 // met:
18411 //
18412 //     * Redistributions of source code must retain the above copyright
18413 // notice, this list of conditions and the following disclaimer.
18414 //     * Redistributions in binary form must reproduce the above
18415 // copyright notice, this list of conditions and the following disclaimer
18416 // in the documentation and/or other materials provided with the
18417 // distribution.
18418 //     * Neither the name of Google Inc. nor the names of its
18419 // contributors may be used to endorse or promote products derived from
18420 // this software without specific prior written permission.
18421 //
18422 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18423 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18424 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
18425 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
18426 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
18427 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
18428 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
18429 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
18430 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
18431 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
18432 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
18433 //
18434 // Author: wan@google.com (Zhanyong Wan)
18435 
18436 #ifndef GTEST_INCLUDE_GTEST_GTEST_TYPED_TEST_H_
18437 #define GTEST_INCLUDE_GTEST_GTEST_TYPED_TEST_H_
18438 
18439 // This header implements typed tests and type-parameterized tests.
18440 
18441 // Typed (aka type-driven) tests repeat the same test for types in a
18442 // list.  You must know which types you want to test with when writing
18443 // typed tests. Here's how you do it:
18444 
18445 #if 0
18446 
18447 // First, define a fixture class template.  It should be parameterized
18448 // by a type.  Remember to derive it from testing::Test.
18449 template <typename T>
18450 class FooTest : public testing::Test {
18451  public:
18452   ...
18453   typedef std::list<T> List;
18454   static T shared_;
18455   T value_;
18456 };
18457 
18458 // Next, associate a list of types with the test case, which will be
18459 // repeated for each type in the list.  The typedef is necessary for
18460 // the macro to parse correctly.
18461 typedef testing::Types<char, int, unsigned int> MyTypes;
18462 TYPED_TEST_CASE(FooTest, MyTypes);
18463 
18464 // If the type list contains only one type, you can write that type
18465 // directly without Types<...>:
18466 //   TYPED_TEST_CASE(FooTest, int);
18467 
18468 // Then, use TYPED_TEST() instead of TEST_F() to define as many typed
18469 // tests for this test case as you want.
18470 TYPED_TEST(FooTest, DoesBlah) {
18471   // Inside a test, refer to TypeParam to get the type parameter.
18472   // Since we are inside a derived class template, C++ requires use to
18473   // visit the members of FooTest via 'this'.
18474   TypeParam n = this->value_;
18475 
18476   // To visit static members of the fixture, add the TestFixture::
18477   // prefix.
18478   n += TestFixture::shared_;
18479 
18480   // To refer to typedefs in the fixture, add the "typename
18481   // TestFixture::" prefix.
18482   typename TestFixture::List values;
18483   values.push_back(n);
18484   ...
18485 }
18486 
18487 TYPED_TEST(FooTest, HasPropertyA) { ... }
18488 
18489 #endif  // 0
18490 
18491 // Type-parameterized tests are abstract test patterns parameterized
18492 // by a type.  Compared with typed tests, type-parameterized tests
18493 // allow you to define the test pattern without knowing what the type
18494 // parameters are.  The defined pattern can be instantiated with
18495 // different types any number of times, in any number of translation
18496 // units.
18497 //
18498 // If you are designing an interface or concept, you can define a
18499 // suite of type-parameterized tests to verify properties that any
18500 // valid implementation of the interface/concept should have.  Then,
18501 // each implementation can easily instantiate the test suite to verify
18502 // that it conforms to the requirements, without having to write
18503 // similar tests repeatedly.  Here's an example:
18504 
18505 #if 0
18506 
18507 // First, define a fixture class template.  It should be parameterized
18508 // by a type.  Remember to derive it from testing::Test.
18509 template <typename T>
18510 class FooTest : public testing::Test {
18511   ...
18512 };
18513 
18514 // Next, declare that you will define a type-parameterized test case
18515 // (the _P suffix is for "parameterized" or "pattern", whichever you
18516 // prefer):
18517 TYPED_TEST_CASE_P(FooTest);
18518 
18519 // Then, use TYPED_TEST_P() to define as many type-parameterized tests
18520 // for this type-parameterized test case as you want.
18521 TYPED_TEST_P(FooTest, DoesBlah) {
18522   // Inside a test, refer to TypeParam to get the type parameter.
18523   TypeParam n = 0;
18524   ...
18525 }
18526 
18527 TYPED_TEST_P(FooTest, HasPropertyA) { ... }
18528 
18529 // Now the tricky part: you need to register all test patterns before
18530 // you can instantiate them.  The first argument of the macro is the
18531 // test case name; the rest are the names of the tests in this test
18532 // case.
18533 REGISTER_TYPED_TEST_CASE_P(FooTest,
18534                            DoesBlah, HasPropertyA);
18535 
18536 // Finally, you are free to instantiate the pattern with the types you
18537 // want.  If you put the above code in a header file, you can #include
18538 // it in multiple C++ source files and instantiate it multiple times.
18539 //
18540 // To distinguish different instances of the pattern, the first
18541 // argument to the INSTANTIATE_* macro is a prefix that will be added
18542 // to the actual test case name.  Remember to pick unique prefixes for
18543 // different instances.
18544 typedef testing::Types<char, int, unsigned int> MyTypes;
18545 INSTANTIATE_TYPED_TEST_CASE_P(My, FooTest, MyTypes);
18546 
18547 // If the type list contains only one type, you can write that type
18548 // directly without Types<...>:
18549 //   INSTANTIATE_TYPED_TEST_CASE_P(My, FooTest, int);
18550 
18551 #endif  // 0
18552 
18553 
18554 // Implements typed tests.
18555 
18556 #if GTEST_HAS_TYPED_TEST
18557 
18558 // INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.
18559 //
18560 // Expands to the name of the typedef for the type parameters of the
18561 // given test case.
18562 # define GTEST_TYPE_PARAMS_(TestCaseName) gtest_type_params_##TestCaseName##_
18563 
18564 // The 'Types' template argument below must have spaces around it
18565 // since some compilers may choke on '>>' when passing a template
18566 // instance (e.g. Types<int>)
18567 # define TYPED_TEST_CASE(CaseName, Types) \
18568   typedef ::testing::internal::TypeList< Types >::type \
18569       GTEST_TYPE_PARAMS_(CaseName)
18570 
18571 # define TYPED_TEST(CaseName, TestName) \
18572   template <typename gtest_TypeParam_> \
18573   class GTEST_TEST_CLASS_NAME_(CaseName, TestName) \
18574       : public CaseName<gtest_TypeParam_> { \
18575    private: \
18576     typedef CaseName<gtest_TypeParam_> TestFixture; \
18577     typedef gtest_TypeParam_ TypeParam; \
18578     virtual void TestBody(); \
18579   }; \
18580   bool gtest_##CaseName##_##TestName##_registered_ GTEST_ATTRIBUTE_UNUSED_ = \
18581       ::testing::internal::TypeParameterizedTest< \
18582           CaseName, \
18583           ::testing::internal::TemplateSel< \
18584               GTEST_TEST_CLASS_NAME_(CaseName, TestName)>, \
18585           GTEST_TYPE_PARAMS_(CaseName)>::Register(\
18586               "", ::testing::internal::CodeLocation(__FILE__, __LINE__), \
18587               #CaseName, #TestName, 0); \
18588   template <typename gtest_TypeParam_> \
18589   void GTEST_TEST_CLASS_NAME_(CaseName, TestName)<gtest_TypeParam_>::TestBody()
18590 
18591 #endif  // GTEST_HAS_TYPED_TEST
18592 
18593 // Implements type-parameterized tests.
18594 
18595 #if GTEST_HAS_TYPED_TEST_P
18596 
18597 // INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.
18598 //
18599 // Expands to the namespace name that the type-parameterized tests for
18600 // the given type-parameterized test case are defined in.  The exact
18601 // name of the namespace is subject to change without notice.
18602 # define GTEST_CASE_NAMESPACE_(TestCaseName) \
18603   gtest_case_##TestCaseName##_
18604 
18605 // INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.
18606 //
18607 // Expands to the name of the variable used to remember the names of
18608 // the defined tests in the given test case.
18609 # define GTEST_TYPED_TEST_CASE_P_STATE_(TestCaseName) \
18610   gtest_typed_test_case_p_state_##TestCaseName##_
18611 
18612 // INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE DIRECTLY.
18613 //
18614 // Expands to the name of the variable used to remember the names of
18615 // the registered tests in the given test case.
18616 # define GTEST_REGISTERED_TEST_NAMES_(TestCaseName) \
18617   gtest_registered_test_names_##TestCaseName##_
18618 
18619 // The variables defined in the type-parameterized test macros are
18620 // static as typically these macros are used in a .h file that can be
18621 // #included in multiple translation units linked together.
18622 # define TYPED_TEST_CASE_P(CaseName) \
18623   static ::testing::internal::TypedTestCasePState \
18624       GTEST_TYPED_TEST_CASE_P_STATE_(CaseName)
18625 
18626 # define TYPED_TEST_P(CaseName, TestName) \
18627   namespace GTEST_CASE_NAMESPACE_(CaseName) { \
18628   template <typename gtest_TypeParam_> \
18629   class TestName : public CaseName<gtest_TypeParam_> { \
18630    private: \
18631     typedef CaseName<gtest_TypeParam_> TestFixture; \
18632     typedef gtest_TypeParam_ TypeParam; \
18633     virtual void TestBody(); \
18634   }; \
18635   static bool gtest_##TestName##_defined_ GTEST_ATTRIBUTE_UNUSED_ = \
18636       GTEST_TYPED_TEST_CASE_P_STATE_(CaseName).AddTestName(\
18637           __FILE__, __LINE__, #CaseName, #TestName); \
18638   } \
18639   template <typename gtest_TypeParam_> \
18640   void GTEST_CASE_NAMESPACE_(CaseName)::TestName<gtest_TypeParam_>::TestBody()
18641 
18642 # define REGISTER_TYPED_TEST_CASE_P(CaseName, ...) \
18643   namespace GTEST_CASE_NAMESPACE_(CaseName) { \
18644   typedef ::testing::internal::Templates<__VA_ARGS__>::type gtest_AllTests_; \
18645   } \
18646   static const char* const GTEST_REGISTERED_TEST_NAMES_(CaseName) = \
18647       GTEST_TYPED_TEST_CASE_P_STATE_(CaseName).VerifyRegisteredTestNames(\
18648           __FILE__, __LINE__, #__VA_ARGS__)
18649 
18650 // The 'Types' template argument below must have spaces around it
18651 // since some compilers may choke on '>>' when passing a template
18652 // instance (e.g. Types<int>)
18653 # define INSTANTIATE_TYPED_TEST_CASE_P(Prefix, CaseName, Types) \
18654   bool gtest_##Prefix##_##CaseName GTEST_ATTRIBUTE_UNUSED_ = \
18655       ::testing::internal::TypeParameterizedTestCase<CaseName, \
18656           GTEST_CASE_NAMESPACE_(CaseName)::gtest_AllTests_, \
18657           ::testing::internal::TypeList< Types >::type>::Register(\
18658               #Prefix, \
18659               ::testing::internal::CodeLocation(__FILE__, __LINE__), \
18660               &GTEST_TYPED_TEST_CASE_P_STATE_(CaseName), \
18661               #CaseName, GTEST_REGISTERED_TEST_NAMES_(CaseName))
18662 
18663 #endif  // GTEST_HAS_TYPED_TEST_P
18664 
18665 #endif  // GTEST_INCLUDE_GTEST_GTEST_TYPED_TEST_H_
18666 
18667 // Depending on the platform, different string classes are available.
18668 // On Linux, in addition to ::std::string, Google also makes use of
18669 // class ::string, which has the same interface as ::std::string, but
18670 // has a different implementation.
18671 //
18672 // You can define GTEST_HAS_GLOBAL_STRING to 1 to indicate that
18673 // ::string is available AND is a distinct type to ::std::string, or
18674 // define it to 0 to indicate otherwise.
18675 //
18676 // If ::std::string and ::string are the same class on your platform
18677 // due to aliasing, you should define GTEST_HAS_GLOBAL_STRING to 0.
18678 //
18679 // If you do not define GTEST_HAS_GLOBAL_STRING, it is defined
18680 // heuristically.
18681 
18682 namespace testing {
18683 
18684 // Declares the flags.
18685 
18686 // This flag temporary enables the disabled tests.
18687 GTEST_DECLARE_bool_(also_run_disabled_tests);
18688 
18689 // This flag brings the debugger on an assertion failure.
18690 GTEST_DECLARE_bool_(break_on_failure);
18691 
18692 // This flag controls whether Google Test catches all test-thrown exceptions
18693 // and logs them as failures.
18694 GTEST_DECLARE_bool_(catch_exceptions);
18695 
18696 // This flag enables using colors in terminal output. Available values are
18697 // "yes" to enable colors, "no" (disable colors), or "auto" (the default)
18698 // to let Google Test decide.
18699 GTEST_DECLARE_string_(color);
18700 
18701 // This flag sets up the filter to select by name using a glob pattern
18702 // the tests to run. If the filter is not given all tests are executed.
18703 GTEST_DECLARE_string_(filter);
18704 
18705 // This flag causes the Google Test to list tests. None of the tests listed
18706 // are actually run if the flag is provided.
18707 GTEST_DECLARE_bool_(list_tests);
18708 
18709 // This flag controls whether Google Test emits a detailed XML report to a file
18710 // in addition to its normal textual output.
18711 GTEST_DECLARE_string_(output);
18712 
18713 // This flags control whether Google Test prints the elapsed time for each
18714 // test.
18715 GTEST_DECLARE_bool_(print_time);
18716 
18717 // This flag specifies the random number seed.
18718 GTEST_DECLARE_int32_(random_seed);
18719 
18720 // This flag sets how many times the tests are repeated. The default value
18721 // is 1. If the value is -1 the tests are repeating forever.
18722 GTEST_DECLARE_int32_(repeat);
18723 
18724 // This flag controls whether Google Test includes Google Test internal
18725 // stack frames in failure stack traces.
18726 GTEST_DECLARE_bool_(show_internal_stack_frames);
18727 
18728 // When this flag is specified, tests' order is randomized on every iteration.
18729 GTEST_DECLARE_bool_(shuffle);
18730 
18731 // This flag specifies the maximum number of stack frames to be
18732 // printed in a failure message.
18733 GTEST_DECLARE_int32_(stack_trace_depth);
18734 
18735 // When this flag is specified, a failed assertion will throw an
18736 // exception if exceptions are enabled, or exit the program with a
18737 // non-zero code otherwise.
18738 GTEST_DECLARE_bool_(throw_on_failure);
18739 
18740 // When this flag is set with a "host:port" string, on supported
18741 // platforms test results are streamed to the specified port on
18742 // the specified host machine.
18743 GTEST_DECLARE_string_(stream_result_to);
18744 
18745 // The upper limit for valid stack trace depths.
18746 const int kMaxStackTraceDepth = 100;
18747 
18748 namespace internal {
18749 
18750 class AssertHelper;
18751 class DefaultGlobalTestPartResultReporter;
18752 class ExecDeathTest;
18753 class NoExecDeathTest;
18754 class FinalSuccessChecker;
18755 class GTestFlagSaver;
18756 class StreamingListenerTest;
18757 class TestResultAccessor;
18758 class TestEventListenersAccessor;
18759 class TestEventRepeater;
18760 class UnitTestRecordPropertyTestHelper;
18761 class WindowsDeathTest;
18762 class UnitTestImpl* GetUnitTestImpl();
18763 void ReportFailureInUnknownLocation(TestPartResult::Type result_type,
18764                                     const std::string& message);
18765 
18766 }  // namespace internal
18767 
18768 // The friend relationship of some of these classes is cyclic.
18769 // If we don't forward declare them the compiler might confuse the classes
18770 // in friendship clauses with same named classes on the scope.
18771 class Test;
18772 class TestCase;
18773 class TestInfo;
18774 class UnitTest;
18775 
18776 // A class for indicating whether an assertion was successful.  When
18777 // the assertion wasn't successful, the AssertionResult object
18778 // remembers a non-empty message that describes how it failed.
18779 //
18780 // To create an instance of this class, use one of the factory functions
18781 // (AssertionSuccess() and AssertionFailure()).
18782 //
18783 // This class is useful for two purposes:
18784 //   1. Defining predicate functions to be used with Boolean test assertions
18785 //      EXPECT_TRUE/EXPECT_FALSE and their ASSERT_ counterparts
18786 //   2. Defining predicate-format functions to be
18787 //      used with predicate assertions (ASSERT_PRED_FORMAT*, etc).
18788 //
18789 // For example, if you define IsEven predicate:
18790 //
18791 //   testing::AssertionResult IsEven(int n) {
18792 //     if ((n % 2) == 0)
18793 //       return testing::AssertionSuccess();
18794 //     else
18795 //       return testing::AssertionFailure() << n << " is odd";
18796 //   }
18797 //
18798 // Then the failed expectation EXPECT_TRUE(IsEven(Fib(5)))
18799 // will print the message
18800 //
18801 //   Value of: IsEven(Fib(5))
18802 //     Actual: false (5 is odd)
18803 //   Expected: true
18804 //
18805 // instead of a more opaque
18806 //
18807 //   Value of: IsEven(Fib(5))
18808 //     Actual: false
18809 //   Expected: true
18810 //
18811 // in case IsEven is a simple Boolean predicate.
18812 //
18813 // If you expect your predicate to be reused and want to support informative
18814 // messages in EXPECT_FALSE and ASSERT_FALSE (negative assertions show up
18815 // about half as often as positive ones in our tests), supply messages for
18816 // both success and failure cases:
18817 //
18818 //   testing::AssertionResult IsEven(int n) {
18819 //     if ((n % 2) == 0)
18820 //       return testing::AssertionSuccess() << n << " is even";
18821 //     else
18822 //       return testing::AssertionFailure() << n << " is odd";
18823 //   }
18824 //
18825 // Then a statement EXPECT_FALSE(IsEven(Fib(6))) will print
18826 //
18827 //   Value of: IsEven(Fib(6))
18828 //     Actual: true (8 is even)
18829 //   Expected: false
18830 //
18831 // NB: Predicates that support negative Boolean assertions have reduced
18832 // performance in positive ones so be careful not to use them in tests
18833 // that have lots (tens of thousands) of positive Boolean assertions.
18834 //
18835 // To use this class with EXPECT_PRED_FORMAT assertions such as:
18836 //
18837 //   // Verifies that Foo() returns an even number.
18838 //   EXPECT_PRED_FORMAT1(IsEven, Foo());
18839 //
18840 // you need to define:
18841 //
18842 //   testing::AssertionResult IsEven(const char* expr, int n) {
18843 //     if ((n % 2) == 0)
18844 //       return testing::AssertionSuccess();
18845 //     else
18846 //       return testing::AssertionFailure()
18847 //         << "Expected: " << expr << " is even\n  Actual: it's " << n;
18848 //   }
18849 //
18850 // If Foo() returns 5, you will see the following message:
18851 //
18852 //   Expected: Foo() is even
18853 //     Actual: it's 5
18854 //
18855 class GTEST_API_ AssertionResult {
18856  public:
18857   // Copy constructor.
18858   // Used in EXPECT_TRUE/FALSE(assertion_result).
18859   AssertionResult(const AssertionResult& other);
18860 
18861   GTEST_DISABLE_MSC_WARNINGS_PUSH_(4800 /* forcing value to bool */)
18862 
18863   // Used in the EXPECT_TRUE/FALSE(bool_expression).
18864   //
18865   // T must be contextually convertible to bool.
18866   //
18867   // The second parameter prevents this overload from being considered if
18868   // the argument is implicitly convertible to AssertionResult. In that case
18869   // we want AssertionResult's copy constructor to be used.
18870   template <typename T>
18871   explicit AssertionResult(
18872       const T& success,
18873       typename internal::EnableIf<
18874           !internal::ImplicitlyConvertible<T, AssertionResult>::value>::type*
18875           /*enabler*/ = NULL)
18876       : success_(success) {}
18877 
18878   GTEST_DISABLE_MSC_WARNINGS_POP_()
18879 
18880   // Assignment operator.
18881   AssertionResult& operator=(AssertionResult other) {
18882     swap(other);
18883     return *this;
18884   }
18885 
18886   // Returns true iff the assertion succeeded.
18887   operator bool() const { return success_; }  // NOLINT
18888 
18889   // Returns the assertion's negation. Used with EXPECT/ASSERT_FALSE.
18890   AssertionResult operator!() const;
18891 
18892   // Returns the text streamed into this AssertionResult. Test assertions
18893   // use it when they fail (i.e., the predicate's outcome doesn't match the
18894   // assertion's expectation). When nothing has been streamed into the
18895   // object, returns an empty string.
18896   const char* message() const {
18897     return message_.get() != NULL ?  message_->c_str() : "";
18898   }
18899   // TODO(vladl@google.com): Remove this after making sure no clients use it.
18900   // Deprecated; please use message() instead.
18901   const char* failure_message() const { return message(); }
18902 
18903   // Streams a custom failure message into this object.
18904   template <typename T> AssertionResult& operator<<(const T& value) {
18905     AppendMessage(Message() << value);
18906     return *this;
18907   }
18908 
18909   // Allows streaming basic output manipulators such as endl or flush into
18910   // this object.
18911   AssertionResult& operator<<(
18912       ::std::ostream& (*basic_manipulator)(::std::ostream& stream)) {
18913     AppendMessage(Message() << basic_manipulator);
18914     return *this;
18915   }
18916 
18917  private:
18918   // Appends the contents of message to message_.
18919   void AppendMessage(const Message& a_message) {
18920     if (message_.get() == NULL)
18921       message_.reset(new ::std::string);
18922     message_->append(a_message.GetString().c_str());
18923   }
18924 
18925   // Swap the contents of this AssertionResult with other.
18926   void swap(AssertionResult& other);
18927 
18928   // Stores result of the assertion predicate.
18929   bool success_;
18930   // Stores the message describing the condition in case the expectation
18931   // construct is not satisfied with the predicate's outcome.
18932   // Referenced via a pointer to avoid taking too much stack frame space
18933   // with test assertions.
18934   internal::scoped_ptr< ::std::string> message_;
18935 };
18936 
18937 // Makes a successful assertion result.
18938 GTEST_API_ AssertionResult AssertionSuccess();
18939 
18940 // Makes a failed assertion result.
18941 GTEST_API_ AssertionResult AssertionFailure();
18942 
18943 // Makes a failed assertion result with the given failure message.
18944 // Deprecated; use AssertionFailure() << msg.
18945 GTEST_API_ AssertionResult AssertionFailure(const Message& msg);
18946 
18947 // The abstract class that all tests inherit from.
18948 //
18949 // In Google Test, a unit test program contains one or many TestCases, and
18950 // each TestCase contains one or many Tests.
18951 //
18952 // When you define a test using the TEST macro, you don't need to
18953 // explicitly derive from Test - the TEST macro automatically does
18954 // this for you.
18955 //
18956 // The only time you derive from Test is when defining a test fixture
18957 // to be used a TEST_F.  For example:
18958 //
18959 //   class FooTest : public testing::Test {
18960 //    protected:
18961 //     void SetUp() override { ... }
18962 //     void TearDown() override { ... }
18963 //     ...
18964 //   };
18965 //
18966 //   TEST_F(FooTest, Bar) { ... }
18967 //   TEST_F(FooTest, Baz) { ... }
18968 //
18969 // Test is not copyable.
18970 class GTEST_API_ Test {
18971  public:
18972   friend class TestInfo;
18973 
18974   // Defines types for pointers to functions that set up and tear down
18975   // a test case.
18976   typedef internal::SetUpTestCaseFunc SetUpTestCaseFunc;
18977   typedef internal::TearDownTestCaseFunc TearDownTestCaseFunc;
18978 
18979   // The d'tor is virtual as we intend to inherit from Test.
18980   virtual ~Test();
18981 
18982   // Sets up the stuff shared by all tests in this test case.
18983   //
18984   // Google Test will call Foo::SetUpTestCase() before running the first
18985   // test in test case Foo.  Hence a sub-class can define its own
18986   // SetUpTestCase() method to shadow the one defined in the super
18987   // class.
18988   static void SetUpTestCase() {}
18989 
18990   // Tears down the stuff shared by all tests in this test case.
18991   //
18992   // Google Test will call Foo::TearDownTestCase() after running the last
18993   // test in test case Foo.  Hence a sub-class can define its own
18994   // TearDownTestCase() method to shadow the one defined in the super
18995   // class.
18996   static void TearDownTestCase() {}
18997 
18998   // Returns true iff the current test has a fatal failure.
18999   static bool HasFatalFailure();
19000 
19001   // Returns true iff the current test has a non-fatal failure.
19002   static bool HasNonfatalFailure();
19003 
19004   // Returns true iff the current test has a (either fatal or
19005   // non-fatal) failure.
19006   static bool HasFailure() { return HasFatalFailure() || HasNonfatalFailure(); }
19007 
19008   // Logs a property for the current test, test case, or for the entire
19009   // invocation of the test program when used outside of the context of a
19010   // test case.  Only the last value for a given key is remembered.  These
19011   // are public static so they can be called from utility functions that are
19012   // not members of the test fixture.  Calls to RecordProperty made during
19013   // lifespan of the test (from the moment its constructor starts to the
19014   // moment its destructor finishes) will be output in XML as attributes of
19015   // the <testcase> element.  Properties recorded from fixture's
19016   // SetUpTestCase or TearDownTestCase are logged as attributes of the
19017   // corresponding <testsuite> element.  Calls to RecordProperty made in the
19018   // global context (before or after invocation of RUN_ALL_TESTS and from
19019   // SetUp/TearDown method of Environment objects registered with Google
19020   // Test) will be output as attributes of the <testsuites> element.
19021   static void RecordProperty(const std::string& key, const std::string& value);
19022   static void RecordProperty(const std::string& key, int value);
19023 
19024  protected:
19025   // Creates a Test object.
19026   Test();
19027 
19028   // Sets up the test fixture.
19029   virtual void SetUp();
19030 
19031   // Tears down the test fixture.
19032   virtual void TearDown();
19033 
19034  private:
19035   // Returns true iff the current test has the same fixture class as
19036   // the first test in the current test case.
19037   static bool HasSameFixtureClass();
19038 
19039   // Runs the test after the test fixture has been set up.
19040   //
19041   // A sub-class must implement this to define the test logic.
19042   //
19043   // DO NOT OVERRIDE THIS FUNCTION DIRECTLY IN A USER PROGRAM.
19044   // Instead, use the TEST or TEST_F macro.
19045   virtual void TestBody() = 0;
19046 
19047   // Sets up, executes, and tears down the test.
19048   void Run();
19049 
19050   // Deletes self.  We deliberately pick an unusual name for this
19051   // internal method to avoid clashing with names used in user TESTs.
19052   void DeleteSelf_() { delete this; }
19053 
19054   const internal::scoped_ptr< GTEST_FLAG_SAVER_ > gtest_flag_saver_;
19055 
19056   // Often a user misspells SetUp() as Setup() and spends a long time
19057   // wondering why it is never called by Google Test.  The declaration of
19058   // the following method is solely for catching such an error at
19059   // compile time:
19060   //
19061   //   - The return type is deliberately chosen to be not void, so it
19062   //   will be a conflict if void Setup() is declared in the user's
19063   //   test fixture.
19064   //
19065   //   - This method is private, so it will be another compiler error
19066   //   if the method is called from the user's test fixture.
19067   //
19068   // DO NOT OVERRIDE THIS FUNCTION.
19069   //
19070   // If you see an error about overriding the following function or
19071   // about it being private, you have mis-spelled SetUp() as Setup().
19072   struct Setup_should_be_spelled_SetUp {};
19073   virtual Setup_should_be_spelled_SetUp* Setup() { return NULL; }
19074 
19075   // We disallow copying Tests.
19076   GTEST_DISALLOW_COPY_AND_ASSIGN_(Test);
19077 };
19078 
19079 typedef internal::TimeInMillis TimeInMillis;
19080 
19081 // A copyable object representing a user specified test property which can be
19082 // output as a key/value string pair.
19083 //
19084 // Don't inherit from TestProperty as its destructor is not virtual.
19085 class TestProperty {
19086  public:
19087   // C'tor.  TestProperty does NOT have a default constructor.
19088   // Always use this constructor (with parameters) to create a
19089   // TestProperty object.
19090   TestProperty(const std::string& a_key, const std::string& a_value) :
19091     key_(a_key), value_(a_value) {
19092   }
19093 
19094   // Gets the user supplied key.
19095   const char* key() const {
19096     return key_.c_str();
19097   }
19098 
19099   // Gets the user supplied value.
19100   const char* value() const {
19101     return value_.c_str();
19102   }
19103 
19104   // Sets a new value, overriding the one supplied in the constructor.
19105   void SetValue(const std::string& new_value) {
19106     value_ = new_value;
19107   }
19108 
19109  private:
19110   // The key supplied by the user.
19111   std::string key_;
19112   // The value supplied by the user.
19113   std::string value_;
19114 };
19115 
19116 // The result of a single Test.  This includes a list of
19117 // TestPartResults, a list of TestProperties, a count of how many
19118 // death tests there are in the Test, and how much time it took to run
19119 // the Test.
19120 //
19121 // TestResult is not copyable.
19122 class GTEST_API_ TestResult {
19123  public:
19124   // Creates an empty TestResult.
19125   TestResult();
19126 
19127   // D'tor.  Do not inherit from TestResult.
19128   ~TestResult();
19129 
19130   // Gets the number of all test parts.  This is the sum of the number
19131   // of successful test parts and the number of failed test parts.
19132   int total_part_count() const;
19133 
19134   // Returns the number of the test properties.
19135   int test_property_count() const;
19136 
19137   // Returns true iff the test passed (i.e. no test part failed).
19138   bool Passed() const { return !Failed(); }
19139 
19140   // Returns true iff the test failed.
19141   bool Failed() const;
19142 
19143   // Returns true iff the test fatally failed.
19144   bool HasFatalFailure() const;
19145 
19146   // Returns true iff the test has a non-fatal failure.
19147   bool HasNonfatalFailure() const;
19148 
19149   // Returns the elapsed time, in milliseconds.
19150   TimeInMillis elapsed_time() const { return elapsed_time_; }
19151 
19152   // Returns the i-th test part result among all the results. i can range
19153   // from 0 to test_property_count() - 1. If i is not in that range, aborts
19154   // the program.
19155   const TestPartResult& GetTestPartResult(int i) const;
19156 
19157   // Returns the i-th test property. i can range from 0 to
19158   // test_property_count() - 1. If i is not in that range, aborts the
19159   // program.
19160   const TestProperty& GetTestProperty(int i) const;
19161 
19162  private:
19163   friend class TestInfo;
19164   friend class TestCase;
19165   friend class UnitTest;
19166   friend class internal::DefaultGlobalTestPartResultReporter;
19167   friend class internal::ExecDeathTest;
19168   friend class internal::TestResultAccessor;
19169   friend class internal::UnitTestImpl;
19170   friend class internal::WindowsDeathTest;
19171 
19172   // Gets the vector of TestPartResults.
19173   const std::vector<TestPartResult>& test_part_results() const {
19174     return test_part_results_;
19175   }
19176 
19177   // Gets the vector of TestProperties.
19178   const std::vector<TestProperty>& test_properties() const {
19179     return test_properties_;
19180   }
19181 
19182   // Sets the elapsed time.
19183   void set_elapsed_time(TimeInMillis elapsed) { elapsed_time_ = elapsed; }
19184 
19185   // Adds a test property to the list. The property is validated and may add
19186   // a non-fatal failure if invalid (e.g., if it conflicts with reserved
19187   // key names). If a property is already recorded for the same key, the
19188   // value will be updated, rather than storing multiple values for the same
19189   // key.  xml_element specifies the element for which the property is being
19190   // recorded and is used for validation.
19191   void RecordProperty(const std::string& xml_element,
19192                       const TestProperty& test_property);
19193 
19194   // Adds a failure if the key is a reserved attribute of Google Test
19195   // testcase tags.  Returns true if the property is valid.
19196   // TODO(russr): Validate attribute names are legal and human readable.
19197   static bool ValidateTestProperty(const std::string& xml_element,
19198                                    const TestProperty& test_property);
19199 
19200   // Adds a test part result to the list.
19201   void AddTestPartResult(const TestPartResult& test_part_result);
19202 
19203   // Returns the death test count.
19204   int death_test_count() const { return death_test_count_; }
19205 
19206   // Increments the death test count, returning the new count.
19207   int increment_death_test_count() { return ++death_test_count_; }
19208 
19209   // Clears the test part results.
19210   void ClearTestPartResults();
19211 
19212   // Clears the object.
19213   void Clear();
19214 
19215   // Protects mutable state of the property vector and of owned
19216   // properties, whose values may be updated.
19217   internal::Mutex test_properites_mutex_;
19218 
19219   // The vector of TestPartResults
19220   std::vector<TestPartResult> test_part_results_;
19221   // The vector of TestProperties
19222   std::vector<TestProperty> test_properties_;
19223   // Running count of death tests.
19224   int death_test_count_;
19225   // The elapsed time, in milliseconds.
19226   TimeInMillis elapsed_time_;
19227 
19228   // We disallow copying TestResult.
19229   GTEST_DISALLOW_COPY_AND_ASSIGN_(TestResult);
19230 };  // class TestResult
19231 
19232 // A TestInfo object stores the following information about a test:
19233 //
19234 //   Test case name
19235 //   Test name
19236 //   Whether the test should be run
19237 //   A function pointer that creates the test object when invoked
19238 //   Test result
19239 //
19240 // The constructor of TestInfo registers itself with the UnitTest
19241 // singleton such that the RUN_ALL_TESTS() macro knows which tests to
19242 // run.
19243 class GTEST_API_ TestInfo {
19244  public:
19245   // Destructs a TestInfo object.  This function is not virtual, so
19246   // don't inherit from TestInfo.
19247   ~TestInfo();
19248 
19249   // Returns the test case name.
19250   const char* test_case_name() const { return test_case_name_.c_str(); }
19251 
19252   // Returns the test name.
19253   const char* name() const { return name_.c_str(); }
19254 
19255   // Returns the name of the parameter type, or NULL if this is not a typed
19256   // or a type-parameterized test.
19257   const char* type_param() const {
19258     if (type_param_.get() != NULL)
19259       return type_param_->c_str();
19260     return NULL;
19261   }
19262 
19263   // Returns the text representation of the value parameter, or NULL if this
19264   // is not a value-parameterized test.
19265   const char* value_param() const {
19266     if (value_param_.get() != NULL)
19267       return value_param_->c_str();
19268     return NULL;
19269   }
19270 
19271   // Returns the file name where this test is defined.
19272   const char* file() const { return location_.file.c_str(); }
19273 
19274   // Returns the line where this test is defined.
19275   int line() const { return location_.line; }
19276 
19277   // Returns true if this test should run, that is if the test is not
19278   // disabled (or it is disabled but the also_run_disabled_tests flag has
19279   // been specified) and its full name matches the user-specified filter.
19280   //
19281   // Google Test allows the user to filter the tests by their full names.
19282   // The full name of a test Bar in test case Foo is defined as
19283   // "Foo.Bar".  Only the tests that match the filter will run.
19284   //
19285   // A filter is a colon-separated list of glob (not regex) patterns,
19286   // optionally followed by a '-' and a colon-separated list of
19287   // negative patterns (tests to exclude).  A test is run if it
19288   // matches one of the positive patterns and does not match any of
19289   // the negative patterns.
19290   //
19291   // For example, *A*:Foo.* is a filter that matches any string that
19292   // contains the character 'A' or starts with "Foo.".
19293   bool should_run() const { return should_run_; }
19294 
19295   // Returns true iff this test will appear in the XML report.
19296   bool is_reportable() const {
19297     // For now, the XML report includes all tests matching the filter.
19298     // In the future, we may trim tests that are excluded because of
19299     // sharding.
19300     return matches_filter_;
19301   }
19302 
19303   // Returns the result of the test.
19304   const TestResult* result() const { return &result_; }
19305 
19306  private:
19307 #if GTEST_HAS_DEATH_TEST
19308   friend class internal::DefaultDeathTestFactory;
19309 #endif  // GTEST_HAS_DEATH_TEST
19310   friend class Test;
19311   friend class TestCase;
19312   friend class internal::UnitTestImpl;
19313   friend class internal::StreamingListenerTest;
19314   friend TestInfo* internal::MakeAndRegisterTestInfo(
19315       const char* test_case_name,
19316       const char* name,
19317       const char* type_param,
19318       const char* value_param,
19319       internal::CodeLocation code_location,
19320       internal::TypeId fixture_class_id,
19321       Test::SetUpTestCaseFunc set_up_tc,
19322       Test::TearDownTestCaseFunc tear_down_tc,
19323       internal::TestFactoryBase* factory);
19324 
19325   // Constructs a TestInfo object. The newly constructed instance assumes
19326   // ownership of the factory object.
19327   TestInfo(const std::string& test_case_name,
19328            const std::string& name,
19329            const char* a_type_param,   // NULL if not a type-parameterized test
19330            const char* a_value_param,  // NULL if not a value-parameterized test
19331            internal::CodeLocation a_code_location,
19332            internal::TypeId fixture_class_id,
19333            internal::TestFactoryBase* factory);
19334 
19335   // Increments the number of death tests encountered in this test so
19336   // far.
19337   int increment_death_test_count() {
19338     return result_.increment_death_test_count();
19339   }
19340 
19341   // Creates the test object, runs it, records its result, and then
19342   // deletes it.
19343   void Run();
19344 
19345   static void ClearTestResult(TestInfo* test_info) {
19346     test_info->result_.Clear();
19347   }
19348 
19349   // These fields are immutable properties of the test.
19350   const std::string test_case_name_;     // Test case name
19351   const std::string name_;               // Test name
19352   // Name of the parameter type, or NULL if this is not a typed or a
19353   // type-parameterized test.
19354   const internal::scoped_ptr<const ::std::string> type_param_;
19355   // Text representation of the value parameter, or NULL if this is not a
19356   // value-parameterized test.
19357   const internal::scoped_ptr<const ::std::string> value_param_;
19358   internal::CodeLocation location_;
19359   const internal::TypeId fixture_class_id_;   // ID of the test fixture class
19360   bool should_run_;                 // True iff this test should run
19361   bool is_disabled_;                // True iff this test is disabled
19362   bool matches_filter_;             // True if this test matches the
19363                                     // user-specified filter.
19364   internal::TestFactoryBase* const factory_;  // The factory that creates
19365                                               // the test object
19366 
19367   // This field is mutable and needs to be reset before running the
19368   // test for the second time.
19369   TestResult result_;
19370 
19371   GTEST_DISALLOW_COPY_AND_ASSIGN_(TestInfo);
19372 };
19373 
19374 // A test case, which consists of a vector of TestInfos.
19375 //
19376 // TestCase is not copyable.
19377 class GTEST_API_ TestCase {
19378  public:
19379   // Creates a TestCase with the given name.
19380   //
19381   // TestCase does NOT have a default constructor.  Always use this
19382   // constructor to create a TestCase object.
19383   //
19384   // Arguments:
19385   //
19386   //   name:         name of the test case
19387   //   a_type_param: the name of the test's type parameter, or NULL if
19388   //                 this is not a type-parameterized test.
19389   //   set_up_tc:    pointer to the function that sets up the test case
19390   //   tear_down_tc: pointer to the function that tears down the test case
19391   TestCase(const char* name, const char* a_type_param,
19392            Test::SetUpTestCaseFunc set_up_tc,
19393            Test::TearDownTestCaseFunc tear_down_tc);
19394 
19395   // Destructor of TestCase.
19396   virtual ~TestCase();
19397 
19398   // Gets the name of the TestCase.
19399   const char* name() const { return name_.c_str(); }
19400 
19401   // Returns the name of the parameter type, or NULL if this is not a
19402   // type-parameterized test case.
19403   const char* type_param() const {
19404     if (type_param_.get() != NULL)
19405       return type_param_->c_str();
19406     return NULL;
19407   }
19408 
19409   // Returns true if any test in this test case should run.
19410   bool should_run() const { return should_run_; }
19411 
19412   // Gets the number of successful tests in this test case.
19413   int successful_test_count() const;
19414 
19415   // Gets the number of failed tests in this test case.
19416   int failed_test_count() const;
19417 
19418   // Gets the number of disabled tests that will be reported in the XML report.
19419   int reportable_disabled_test_count() const;
19420 
19421   // Gets the number of disabled tests in this test case.
19422   int disabled_test_count() const;
19423 
19424   // Gets the number of tests to be printed in the XML report.
19425   int reportable_test_count() const;
19426 
19427   // Get the number of tests in this test case that should run.
19428   int test_to_run_count() const;
19429 
19430   // Gets the number of all tests in this test case.
19431   int total_test_count() const;
19432 
19433   // Returns true iff the test case passed.
19434   bool Passed() const { return !Failed(); }
19435 
19436   // Returns true iff the test case failed.
19437   bool Failed() const { return failed_test_count() > 0; }
19438 
19439   // Returns the elapsed time, in milliseconds.
19440   TimeInMillis elapsed_time() const { return elapsed_time_; }
19441 
19442   // Returns the i-th test among all the tests. i can range from 0 to
19443   // total_test_count() - 1. If i is not in that range, returns NULL.
19444   const TestInfo* GetTestInfo(int i) const;
19445 
19446   // Returns the TestResult that holds test properties recorded during
19447   // execution of SetUpTestCase and TearDownTestCase.
19448   const TestResult& ad_hoc_test_result() const { return ad_hoc_test_result_; }
19449 
19450  private:
19451   friend class Test;
19452   friend class internal::UnitTestImpl;
19453 
19454   // Gets the (mutable) vector of TestInfos in this TestCase.
19455   std::vector<TestInfo*>& test_info_list() { return test_info_list_; }
19456 
19457   // Gets the (immutable) vector of TestInfos in this TestCase.
19458   const std::vector<TestInfo*>& test_info_list() const {
19459     return test_info_list_;
19460   }
19461 
19462   // Returns the i-th test among all the tests. i can range from 0 to
19463   // total_test_count() - 1. If i is not in that range, returns NULL.
19464   TestInfo* GetMutableTestInfo(int i);
19465 
19466   // Sets the should_run member.
19467   void set_should_run(bool should) { should_run_ = should; }
19468 
19469   // Adds a TestInfo to this test case.  Will delete the TestInfo upon
19470   // destruction of the TestCase object.
19471   void AddTestInfo(TestInfo * test_info);
19472 
19473   // Clears the results of all tests in this test case.
19474   void ClearResult();
19475 
19476   // Clears the results of all tests in the given test case.
19477   static void ClearTestCaseResult(TestCase* test_case) {
19478     test_case->ClearResult();
19479   }
19480 
19481   // Runs every test in this TestCase.
19482   void Run();
19483 
19484   // Runs SetUpTestCase() for this TestCase.  This wrapper is needed
19485   // for catching exceptions thrown from SetUpTestCase().
19486   void RunSetUpTestCase() { (*set_up_tc_)(); }
19487 
19488   // Runs TearDownTestCase() for this TestCase.  This wrapper is
19489   // needed for catching exceptions thrown from TearDownTestCase().
19490   void RunTearDownTestCase() { (*tear_down_tc_)(); }
19491 
19492   // Returns true iff test passed.
19493   static bool TestPassed(const TestInfo* test_info) {
19494     return test_info->should_run() && test_info->result()->Passed();
19495   }
19496 
19497   // Returns true iff test failed.
19498   static bool TestFailed(const TestInfo* test_info) {
19499     return test_info->should_run() && test_info->result()->Failed();
19500   }
19501 
19502   // Returns true iff the test is disabled and will be reported in the XML
19503   // report.
19504   static bool TestReportableDisabled(const TestInfo* test_info) {
19505     return test_info->is_reportable() && test_info->is_disabled_;
19506   }
19507 
19508   // Returns true iff test is disabled.
19509   static bool TestDisabled(const TestInfo* test_info) {
19510     return test_info->is_disabled_;
19511   }
19512 
19513   // Returns true iff this test will appear in the XML report.
19514   static bool TestReportable(const TestInfo* test_info) {
19515     return test_info->is_reportable();
19516   }
19517 
19518   // Returns true if the given test should run.
19519   static bool ShouldRunTest(const TestInfo* test_info) {
19520     return test_info->should_run();
19521   }
19522 
19523   // Shuffles the tests in this test case.
19524   void ShuffleTests(internal::Random* random);
19525 
19526   // Restores the test order to before the first shuffle.
19527   void UnshuffleTests();
19528 
19529   // Name of the test case.
19530   std::string name_;
19531   // Name of the parameter type, or NULL if this is not a typed or a
19532   // type-parameterized test.
19533   const internal::scoped_ptr<const ::std::string> type_param_;
19534   // The vector of TestInfos in their original order.  It owns the
19535   // elements in the vector.
19536   std::vector<TestInfo*> test_info_list_;
19537   // Provides a level of indirection for the test list to allow easy
19538   // shuffling and restoring the test order.  The i-th element in this
19539   // vector is the index of the i-th test in the shuffled test list.
19540   std::vector<int> test_indices_;
19541   // Pointer to the function that sets up the test case.
19542   Test::SetUpTestCaseFunc set_up_tc_;
19543   // Pointer to the function that tears down the test case.
19544   Test::TearDownTestCaseFunc tear_down_tc_;
19545   // True iff any test in this test case should run.
19546   bool should_run_;
19547   // Elapsed time, in milliseconds.
19548   TimeInMillis elapsed_time_;
19549   // Holds test properties recorded during execution of SetUpTestCase and
19550   // TearDownTestCase.
19551   TestResult ad_hoc_test_result_;
19552 
19553   // We disallow copying TestCases.
19554   GTEST_DISALLOW_COPY_AND_ASSIGN_(TestCase);
19555 };
19556 
19557 // An Environment object is capable of setting up and tearing down an
19558 // environment.  You should subclass this to define your own
19559 // environment(s).
19560 //
19561 // An Environment object does the set-up and tear-down in virtual
19562 // methods SetUp() and TearDown() instead of the constructor and the
19563 // destructor, as:
19564 //
19565 //   1. You cannot safely throw from a destructor.  This is a problem
19566 //      as in some cases Google Test is used where exceptions are enabled, and
19567 //      we may want to implement ASSERT_* using exceptions where they are
19568 //      available.
19569 //   2. You cannot use ASSERT_* directly in a constructor or
19570 //      destructor.
19571 class Environment {
19572  public:
19573   // The d'tor is virtual as we need to subclass Environment.
19574   virtual ~Environment() {}
19575 
19576   // Override this to define how to set up the environment.
19577   virtual void SetUp() {}
19578 
19579   // Override this to define how to tear down the environment.
19580   virtual void TearDown() {}
19581  private:
19582   // If you see an error about overriding the following function or
19583   // about it being private, you have mis-spelled SetUp() as Setup().
19584   struct Setup_should_be_spelled_SetUp {};
19585   virtual Setup_should_be_spelled_SetUp* Setup() { return NULL; }
19586 };
19587 
19588 // The interface for tracing execution of tests. The methods are organized in
19589 // the order the corresponding events are fired.
19590 class TestEventListener {
19591  public:
19592   virtual ~TestEventListener() {}
19593 
19594   // Fired before any test activity starts.
19595   virtual void OnTestProgramStart(const UnitTest& unit_test) = 0;
19596 
19597   // Fired before each iteration of tests starts.  There may be more than
19598   // one iteration if GTEST_FLAG(repeat) is set. iteration is the iteration
19599   // index, starting from 0.
19600   virtual void OnTestIterationStart(const UnitTest& unit_test,
19601                                     int iteration) = 0;
19602 
19603   // Fired before environment set-up for each iteration of tests starts.
19604   virtual void OnEnvironmentsSetUpStart(const UnitTest& unit_test) = 0;
19605 
19606   // Fired after environment set-up for each iteration of tests ends.
19607   virtual void OnEnvironmentsSetUpEnd(const UnitTest& unit_test) = 0;
19608 
19609   // Fired before the test case starts.
19610   virtual void OnTestCaseStart(const TestCase& test_case) = 0;
19611 
19612   // Fired before the test starts.
19613   virtual void OnTestStart(const TestInfo& test_info) = 0;
19614 
19615   // Fired after a failed assertion or a SUCCEED() invocation.
19616   virtual void OnTestPartResult(const TestPartResult& test_part_result) = 0;
19617 
19618   // Fired after the test ends.
19619   virtual void OnTestEnd(const TestInfo& test_info) = 0;
19620 
19621   // Fired after the test case ends.
19622   virtual void OnTestCaseEnd(const TestCase& test_case) = 0;
19623 
19624   // Fired before environment tear-down for each iteration of tests starts.
19625   virtual void OnEnvironmentsTearDownStart(const UnitTest& unit_test) = 0;
19626 
19627   // Fired after environment tear-down for each iteration of tests ends.
19628   virtual void OnEnvironmentsTearDownEnd(const UnitTest& unit_test) = 0;
19629 
19630   // Fired after each iteration of tests finishes.
19631   virtual void OnTestIterationEnd(const UnitTest& unit_test,
19632                                   int iteration) = 0;
19633 
19634   // Fired after all test activities have ended.
19635   virtual void OnTestProgramEnd(const UnitTest& unit_test) = 0;
19636 };
19637 
19638 // The convenience class for users who need to override just one or two
19639 // methods and are not concerned that a possible change to a signature of
19640 // the methods they override will not be caught during the build.  For
19641 // comments about each method please see the definition of TestEventListener
19642 // above.
19643 class EmptyTestEventListener : public TestEventListener {
19644  public:
19645   virtual void OnTestProgramStart(const UnitTest& /*unit_test*/) {}
19646   virtual void OnTestIterationStart(const UnitTest& /*unit_test*/,
19647                                     int /*iteration*/) {}
19648   virtual void OnEnvironmentsSetUpStart(const UnitTest& /*unit_test*/) {}
19649   virtual void OnEnvironmentsSetUpEnd(const UnitTest& /*unit_test*/) {}
19650   virtual void OnTestCaseStart(const TestCase& /*test_case*/) {}
19651   virtual void OnTestStart(const TestInfo& /*test_info*/) {}
19652   virtual void OnTestPartResult(const TestPartResult& /*test_part_result*/) {}
19653   virtual void OnTestEnd(const TestInfo& /*test_info*/) {}
19654   virtual void OnTestCaseEnd(const TestCase& /*test_case*/) {}
19655   virtual void OnEnvironmentsTearDownStart(const UnitTest& /*unit_test*/) {}
19656   virtual void OnEnvironmentsTearDownEnd(const UnitTest& /*unit_test*/) {}
19657   virtual void OnTestIterationEnd(const UnitTest& /*unit_test*/,
19658                                   int /*iteration*/) {}
19659   virtual void OnTestProgramEnd(const UnitTest& /*unit_test*/) {}
19660 };
19661 
19662 // TestEventListeners lets users add listeners to track events in Google Test.
19663 class GTEST_API_ TestEventListeners {
19664  public:
19665   TestEventListeners();
19666   ~TestEventListeners();
19667 
19668   // Appends an event listener to the end of the list. Google Test assumes
19669   // the ownership of the listener (i.e. it will delete the listener when
19670   // the test program finishes).
19671   void Append(TestEventListener* listener);
19672 
19673   // Removes the given event listener from the list and returns it.  It then
19674   // becomes the caller's responsibility to delete the listener. Returns
19675   // NULL if the listener is not found in the list.
19676   TestEventListener* Release(TestEventListener* listener);
19677 
19678   // Returns the standard listener responsible for the default console
19679   // output.  Can be removed from the listeners list to shut down default
19680   // console output.  Note that removing this object from the listener list
19681   // with Release transfers its ownership to the caller and makes this
19682   // function return NULL the next time.
19683   TestEventListener* default_result_printer() const {
19684     return default_result_printer_;
19685   }
19686 
19687   // Returns the standard listener responsible for the default XML output
19688   // controlled by the --gtest_output=xml flag.  Can be removed from the
19689   // listeners list by users who want to shut down the default XML output
19690   // controlled by this flag and substitute it with custom one.  Note that
19691   // removing this object from the listener list with Release transfers its
19692   // ownership to the caller and makes this function return NULL the next
19693   // time.
19694   TestEventListener* default_xml_generator() const {
19695     return default_xml_generator_;
19696   }
19697 
19698  private:
19699   friend class TestCase;
19700   friend class TestInfo;
19701   friend class internal::DefaultGlobalTestPartResultReporter;
19702   friend class internal::NoExecDeathTest;
19703   friend class internal::TestEventListenersAccessor;
19704   friend class internal::UnitTestImpl;
19705 
19706   // Returns repeater that broadcasts the TestEventListener events to all
19707   // subscribers.
19708   TestEventListener* repeater();
19709 
19710   // Sets the default_result_printer attribute to the provided listener.
19711   // The listener is also added to the listener list and previous
19712   // default_result_printer is removed from it and deleted. The listener can
19713   // also be NULL in which case it will not be added to the list. Does
19714   // nothing if the previous and the current listener objects are the same.
19715   void SetDefaultResultPrinter(TestEventListener* listener);
19716 
19717   // Sets the default_xml_generator attribute to the provided listener.  The
19718   // listener is also added to the listener list and previous
19719   // default_xml_generator is removed from it and deleted. The listener can
19720   // also be NULL in which case it will not be added to the list. Does
19721   // nothing if the previous and the current listener objects are the same.
19722   void SetDefaultXmlGenerator(TestEventListener* listener);
19723 
19724   // Controls whether events will be forwarded by the repeater to the
19725   // listeners in the list.
19726   bool EventForwardingEnabled() const;
19727   void SuppressEventForwarding();
19728 
19729   // The actual list of listeners.
19730   internal::TestEventRepeater* repeater_;
19731   // Listener responsible for the standard result output.
19732   TestEventListener* default_result_printer_;
19733   // Listener responsible for the creation of the XML output file.
19734   TestEventListener* default_xml_generator_;
19735 
19736   // We disallow copying TestEventListeners.
19737   GTEST_DISALLOW_COPY_AND_ASSIGN_(TestEventListeners);
19738 };
19739 
19740 // A UnitTest consists of a vector of TestCases.
19741 //
19742 // This is a singleton class.  The only instance of UnitTest is
19743 // created when UnitTest::GetInstance() is first called.  This
19744 // instance is never deleted.
19745 //
19746 // UnitTest is not copyable.
19747 //
19748 // This class is thread-safe as long as the methods are called
19749 // according to their specification.
19750 class GTEST_API_ UnitTest {
19751  public:
19752   // Gets the singleton UnitTest object.  The first time this method
19753   // is called, a UnitTest object is constructed and returned.
19754   // Consecutive calls will return the same object.
19755   static UnitTest* GetInstance();
19756 
19757   // Runs all tests in this UnitTest object and prints the result.
19758   // Returns 0 if successful, or 1 otherwise.
19759   //
19760   // This method can only be called from the main thread.
19761   //
19762   // INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
19763   int Run() GTEST_MUST_USE_RESULT_;
19764 
19765   // Returns the working directory when the first TEST() or TEST_F()
19766   // was executed.  The UnitTest object owns the string.
19767   const char* original_working_dir() const;
19768 
19769   // Returns the TestCase object for the test that's currently running,
19770   // or NULL if no test is running.
19771   const TestCase* current_test_case() const
19772       GTEST_LOCK_EXCLUDED_(mutex_);
19773 
19774   // Returns the TestInfo object for the test that's currently running,
19775   // or NULL if no test is running.
19776   const TestInfo* current_test_info() const
19777       GTEST_LOCK_EXCLUDED_(mutex_);
19778 
19779   // Returns the random seed used at the start of the current test run.
19780   int random_seed() const;
19781 
19782 #if GTEST_HAS_PARAM_TEST
19783   // Returns the ParameterizedTestCaseRegistry object used to keep track of
19784   // value-parameterized tests and instantiate and register them.
19785   //
19786   // INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
19787   internal::ParameterizedTestCaseRegistry& parameterized_test_registry()
19788       GTEST_LOCK_EXCLUDED_(mutex_);
19789 #endif  // GTEST_HAS_PARAM_TEST
19790 
19791   // Gets the number of successful test cases.
19792   int successful_test_case_count() const;
19793 
19794   // Gets the number of failed test cases.
19795   int failed_test_case_count() const;
19796 
19797   // Gets the number of all test cases.
19798   int total_test_case_count() const;
19799 
19800   // Gets the number of all test cases that contain at least one test
19801   // that should run.
19802   int test_case_to_run_count() const;
19803 
19804   // Gets the number of successful tests.
19805   int successful_test_count() const;
19806 
19807   // Gets the number of failed tests.
19808   int failed_test_count() const;
19809 
19810   // Gets the number of disabled tests that will be reported in the XML report.
19811   int reportable_disabled_test_count() const;
19812 
19813   // Gets the number of disabled tests.
19814   int disabled_test_count() const;
19815 
19816   // Gets the number of tests to be printed in the XML report.
19817   int reportable_test_count() const;
19818 
19819   // Gets the number of all tests.
19820   int total_test_count() const;
19821 
19822   // Gets the number of tests that should run.
19823   int test_to_run_count() const;
19824 
19825   // Gets the time of the test program start, in ms from the start of the
19826   // UNIX epoch.
19827   TimeInMillis start_timestamp() const;
19828 
19829   // Gets the elapsed time, in milliseconds.
19830   TimeInMillis elapsed_time() const;
19831 
19832   // Returns true iff the unit test passed (i.e. all test cases passed).
19833   bool Passed() const;
19834 
19835   // Returns true iff the unit test failed (i.e. some test case failed
19836   // or something outside of all tests failed).
19837   bool Failed() const;
19838 
19839   // Gets the i-th test case among all the test cases. i can range from 0 to
19840   // total_test_case_count() - 1. If i is not in that range, returns NULL.
19841   const TestCase* GetTestCase(int i) const;
19842 
19843   // Returns the TestResult containing information on test failures and
19844   // properties logged outside of individual test cases.
19845   const TestResult& ad_hoc_test_result() const;
19846 
19847   // Returns the list of event listeners that can be used to track events
19848   // inside Google Test.
19849   TestEventListeners& listeners();
19850 
19851  private:
19852   // Registers and returns a global test environment.  When a test
19853   // program is run, all global test environments will be set-up in
19854   // the order they were registered.  After all tests in the program
19855   // have finished, all global test environments will be torn-down in
19856   // the *reverse* order they were registered.
19857   //
19858   // The UnitTest object takes ownership of the given environment.
19859   //
19860   // This method can only be called from the main thread.
19861   Environment* AddEnvironment(Environment* env);
19862 
19863   // Adds a TestPartResult to the current TestResult object.  All
19864   // Google Test assertion macros (e.g. ASSERT_TRUE, EXPECT_EQ, etc)
19865   // eventually call this to report their results.  The user code
19866   // should use the assertion macros instead of calling this directly.
19867   void AddTestPartResult(TestPartResult::Type result_type,
19868                          const char* file_name,
19869                          int line_number,
19870                          const std::string& message,
19871                          const std::string& os_stack_trace)
19872       GTEST_LOCK_EXCLUDED_(mutex_);
19873 
19874   // Adds a TestProperty to the current TestResult object when invoked from
19875   // inside a test, to current TestCase's ad_hoc_test_result_ when invoked
19876   // from SetUpTestCase or TearDownTestCase, or to the global property set
19877   // when invoked elsewhere.  If the result already contains a property with
19878   // the same key, the value will be updated.
19879   void RecordProperty(const std::string& key, const std::string& value);
19880 
19881   // Gets the i-th test case among all the test cases. i can range from 0 to
19882   // total_test_case_count() - 1. If i is not in that range, returns NULL.
19883   TestCase* GetMutableTestCase(int i);
19884 
19885   // Accessors for the implementation object.
19886   internal::UnitTestImpl* impl() { return impl_; }
19887   const internal::UnitTestImpl* impl() const { return impl_; }
19888 
19889   // These classes and funcions are friends as they need to access private
19890   // members of UnitTest.
19891   friend class Test;
19892   friend class internal::AssertHelper;
19893   friend class internal::ScopedTrace;
19894   friend class internal::StreamingListenerTest;
19895   friend class internal::UnitTestRecordPropertyTestHelper;
19896   friend Environment* AddGlobalTestEnvironment(Environment* env);
19897   friend internal::UnitTestImpl* internal::GetUnitTestImpl();
19898   friend void internal::ReportFailureInUnknownLocation(
19899       TestPartResult::Type result_type,
19900       const std::string& message);
19901 
19902   // Creates an empty UnitTest.
19903   UnitTest();
19904 
19905   // D'tor
19906   virtual ~UnitTest();
19907 
19908   // Pushes a trace defined by SCOPED_TRACE() on to the per-thread
19909   // Google Test trace stack.
19910   void PushGTestTrace(const internal::TraceInfo& trace)
19911       GTEST_LOCK_EXCLUDED_(mutex_);
19912 
19913   // Pops a trace from the per-thread Google Test trace stack.
19914   void PopGTestTrace()
19915       GTEST_LOCK_EXCLUDED_(mutex_);
19916 
19917   // Protects mutable state in *impl_.  This is mutable as some const
19918   // methods need to lock it too.
19919   mutable internal::Mutex mutex_;
19920 
19921   // Opaque implementation object.  This field is never changed once
19922   // the object is constructed.  We don't mark it as const here, as
19923   // doing so will cause a warning in the constructor of UnitTest.
19924   // Mutable state in *impl_ is protected by mutex_.
19925   internal::UnitTestImpl* impl_;
19926 
19927   // We disallow copying UnitTest.
19928   GTEST_DISALLOW_COPY_AND_ASSIGN_(UnitTest);
19929 };
19930 
19931 // A convenient wrapper for adding an environment for the test
19932 // program.
19933 //
19934 // You should call this before RUN_ALL_TESTS() is called, probably in
19935 // main().  If you use gtest_main, you need to call this before main()
19936 // starts for it to take effect.  For example, you can define a global
19937 // variable like this:
19938 //
19939 //   testing::Environment* const foo_env =
19940 //       testing::AddGlobalTestEnvironment(new FooEnvironment);
19941 //
19942 // However, we strongly recommend you to write your own main() and
19943 // call AddGlobalTestEnvironment() there, as relying on initialization
19944 // of global variables makes the code harder to read and may cause
19945 // problems when you register multiple environments from different
19946 // translation units and the environments have dependencies among them
19947 // (remember that the compiler doesn't guarantee the order in which
19948 // global variables from different translation units are initialized).
19949 inline Environment* AddGlobalTestEnvironment(Environment* env) {
19950   return UnitTest::GetInstance()->AddEnvironment(env);
19951 }
19952 
19953 // Initializes Google Test.  This must be called before calling
19954 // RUN_ALL_TESTS().  In particular, it parses a command line for the
19955 // flags that Google Test recognizes.  Whenever a Google Test flag is
19956 // seen, it is removed from argv, and *argc is decremented.
19957 //
19958 // No value is returned.  Instead, the Google Test flag variables are
19959 // updated.
19960 //
19961 // Calling the function for the second time has no user-visible effect.
19962 GTEST_API_ void InitGoogleTest(int* argc, char** argv);
19963 
19964 // This overloaded version can be used in Windows programs compiled in
19965 // UNICODE mode.
19966 GTEST_API_ void InitGoogleTest(int* argc, wchar_t** argv);
19967 
19968 namespace internal {
19969 
19970 // Separate the error generating code from the code path to reduce the stack
19971 // frame size of CmpHelperEQ. This helps reduce the overhead of some sanitizers
19972 // when calling EXPECT_* in a tight loop.
19973 template <typename T1, typename T2>
19974 AssertionResult CmpHelperEQFailure(const char* lhs_expression,
19975                                    const char* rhs_expression,
19976                                    const T1& lhs, const T2& rhs) {
19977   return EqFailure(lhs_expression,
19978                    rhs_expression,
19979                    FormatForComparisonFailureMessage(lhs, rhs),
19980                    FormatForComparisonFailureMessage(rhs, lhs),
19981                    false);
19982 }
19983 
19984 // The helper function for {ASSERT|EXPECT}_EQ.
19985 template <typename T1, typename T2>
19986 AssertionResult CmpHelperEQ(const char* lhs_expression,
19987                             const char* rhs_expression,
19988                             const T1& lhs,
19989                             const T2& rhs) {
19990 GTEST_DISABLE_MSC_WARNINGS_PUSH_(4389 /* signed/unsigned mismatch */)
19991   if (lhs == rhs) {
19992     return AssertionSuccess();
19993   }
19994 GTEST_DISABLE_MSC_WARNINGS_POP_()
19995 
19996   return CmpHelperEQFailure(lhs_expression, rhs_expression, lhs, rhs);
19997 }
19998 
19999 // With this overloaded version, we allow anonymous enums to be used
20000 // in {ASSERT|EXPECT}_EQ when compiled with gcc 4, as anonymous enums
20001 // can be implicitly cast to BiggestInt.
20002 GTEST_API_ AssertionResult CmpHelperEQ(const char* lhs_expression,
20003                                        const char* rhs_expression,
20004                                        BiggestInt lhs,
20005                                        BiggestInt rhs);
20006 
20007 // The helper class for {ASSERT|EXPECT}_EQ.  The template argument
20008 // lhs_is_null_literal is true iff the first argument to ASSERT_EQ()
20009 // is a null pointer literal.  The following default implementation is
20010 // for lhs_is_null_literal being false.
20011 template <bool lhs_is_null_literal>
20012 class EqHelper {
20013  public:
20014   // This templatized version is for the general case.
20015   template <typename T1, typename T2>
20016   static AssertionResult Compare(const char* lhs_expression,
20017                                  const char* rhs_expression,
20018                                  const T1& lhs,
20019                                  const T2& rhs) {
20020     return CmpHelperEQ(lhs_expression, rhs_expression, lhs, rhs);
20021   }
20022 
20023   // With this overloaded version, we allow anonymous enums to be used
20024   // in {ASSERT|EXPECT}_EQ when compiled with gcc 4, as anonymous
20025   // enums can be implicitly cast to BiggestInt.
20026   //
20027   // Even though its body looks the same as the above version, we
20028   // cannot merge the two, as it will make anonymous enums unhappy.
20029   static AssertionResult Compare(const char* lhs_expression,
20030                                  const char* rhs_expression,
20031                                  BiggestInt lhs,
20032                                  BiggestInt rhs) {
20033     return CmpHelperEQ(lhs_expression, rhs_expression, lhs, rhs);
20034   }
20035 };
20036 
20037 // This specialization is used when the first argument to ASSERT_EQ()
20038 // is a null pointer literal, like NULL, false, or 0.
20039 template <>
20040 class EqHelper<true> {
20041  public:
20042   // We define two overloaded versions of Compare().  The first
20043   // version will be picked when the second argument to ASSERT_EQ() is
20044   // NOT a pointer, e.g. ASSERT_EQ(0, AnIntFunction()) or
20045   // EXPECT_EQ(false, a_bool).
20046   template <typename T1, typename T2>
20047   static AssertionResult Compare(
20048       const char* lhs_expression,
20049       const char* rhs_expression,
20050       const T1& lhs,
20051       const T2& rhs,
20052       // The following line prevents this overload from being considered if T2
20053       // is not a pointer type.  We need this because ASSERT_EQ(NULL, my_ptr)
20054       // expands to Compare("", "", NULL, my_ptr), which requires a conversion
20055       // to match the Secret* in the other overload, which would otherwise make
20056       // this template match better.
20057       typename EnableIf<!is_pointer<T2>::value>::type* = 0) {
20058     return CmpHelperEQ(lhs_expression, rhs_expression, lhs, rhs);
20059   }
20060 
20061   // This version will be picked when the second argument to ASSERT_EQ() is a
20062   // pointer, e.g. ASSERT_EQ(NULL, a_pointer).
20063   template <typename T>
20064   static AssertionResult Compare(
20065       const char* lhs_expression,
20066       const char* rhs_expression,
20067       // We used to have a second template parameter instead of Secret*.  That
20068       // template parameter would deduce to 'long', making this a better match
20069       // than the first overload even without the first overload's EnableIf.
20070       // Unfortunately, gcc with -Wconversion-null warns when "passing NULL to
20071       // non-pointer argument" (even a deduced integral argument), so the old
20072       // implementation caused warnings in user code.
20073       Secret* /* lhs (NULL) */,
20074       T* rhs) {
20075     // We already know that 'lhs' is a null pointer.
20076     return CmpHelperEQ(lhs_expression, rhs_expression,
20077                        static_cast<T*>(NULL), rhs);
20078   }
20079 };
20080 
20081 // Separate the error generating code from the code path to reduce the stack
20082 // frame size of CmpHelperOP. This helps reduce the overhead of some sanitizers
20083 // when calling EXPECT_OP in a tight loop.
20084 template <typename T1, typename T2>
20085 AssertionResult CmpHelperOpFailure(const char* expr1, const char* expr2,
20086                                    const T1& val1, const T2& val2,
20087                                    const char* op) {
20088   return AssertionFailure()
20089          << "Expected: (" << expr1 << ") " << op << " (" << expr2
20090          << "), actual: " << FormatForComparisonFailureMessage(val1, val2)
20091          << " vs " << FormatForComparisonFailureMessage(val2, val1);
20092 }
20093 
20094 // A macro for implementing the helper functions needed to implement
20095 // ASSERT_?? and EXPECT_??.  It is here just to avoid copy-and-paste
20096 // of similar code.
20097 //
20098 // For each templatized helper function, we also define an overloaded
20099 // version for BiggestInt in order to reduce code bloat and allow
20100 // anonymous enums to be used with {ASSERT|EXPECT}_?? when compiled
20101 // with gcc 4.
20102 //
20103 // INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
20104 
20105 #define GTEST_IMPL_CMP_HELPER_(op_name, op)\
20106 template <typename T1, typename T2>\
20107 AssertionResult CmpHelper##op_name(const char* expr1, const char* expr2, \
20108                                    const T1& val1, const T2& val2) {\
20109   if (val1 op val2) {\
20110     return AssertionSuccess();\
20111   } else {\
20112     return CmpHelperOpFailure(expr1, expr2, val1, val2, #op);\
20113   }\
20114 }\
20115 GTEST_API_ AssertionResult CmpHelper##op_name(\
20116     const char* expr1, const char* expr2, BiggestInt val1, BiggestInt val2)
20117 
20118 // INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
20119 
20120 // Implements the helper function for {ASSERT|EXPECT}_NE
20121 GTEST_IMPL_CMP_HELPER_(NE, !=);
20122 // Implements the helper function for {ASSERT|EXPECT}_LE
20123 GTEST_IMPL_CMP_HELPER_(LE, <=);
20124 // Implements the helper function for {ASSERT|EXPECT}_LT
20125 GTEST_IMPL_CMP_HELPER_(LT, <);
20126 // Implements the helper function for {ASSERT|EXPECT}_GE
20127 GTEST_IMPL_CMP_HELPER_(GE, >=);
20128 // Implements the helper function for {ASSERT|EXPECT}_GT
20129 GTEST_IMPL_CMP_HELPER_(GT, >);
20130 
20131 #undef GTEST_IMPL_CMP_HELPER_
20132 
20133 // The helper function for {ASSERT|EXPECT}_STREQ.
20134 //
20135 // INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
20136 GTEST_API_ AssertionResult CmpHelperSTREQ(const char* s1_expression,
20137                                           const char* s2_expression,
20138                                           const char* s1,
20139                                           const char* s2);
20140 
20141 // The helper function for {ASSERT|EXPECT}_STRCASEEQ.
20142 //
20143 // INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
20144 GTEST_API_ AssertionResult CmpHelperSTRCASEEQ(const char* s1_expression,
20145                                               const char* s2_expression,
20146                                               const char* s1,
20147                                               const char* s2);
20148 
20149 // The helper function for {ASSERT|EXPECT}_STRNE.
20150 //
20151 // INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
20152 GTEST_API_ AssertionResult CmpHelperSTRNE(const char* s1_expression,
20153                                           const char* s2_expression,
20154                                           const char* s1,
20155                                           const char* s2);
20156 
20157 // The helper function for {ASSERT|EXPECT}_STRCASENE.
20158 //
20159 // INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
20160 GTEST_API_ AssertionResult CmpHelperSTRCASENE(const char* s1_expression,
20161                                               const char* s2_expression,
20162                                               const char* s1,
20163                                               const char* s2);
20164 
20165 
20166 // Helper function for *_STREQ on wide strings.
20167 //
20168 // INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
20169 GTEST_API_ AssertionResult CmpHelperSTREQ(const char* s1_expression,
20170                                           const char* s2_expression,
20171                                           const wchar_t* s1,
20172                                           const wchar_t* s2);
20173 
20174 // Helper function for *_STRNE on wide strings.
20175 //
20176 // INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
20177 GTEST_API_ AssertionResult CmpHelperSTRNE(const char* s1_expression,
20178                                           const char* s2_expression,
20179                                           const wchar_t* s1,
20180                                           const wchar_t* s2);
20181 
20182 }  // namespace internal
20183 
20184 // IsSubstring() and IsNotSubstring() are intended to be used as the
20185 // first argument to {EXPECT,ASSERT}_PRED_FORMAT2(), not by
20186 // themselves.  They check whether needle is a substring of haystack
20187 // (NULL is considered a substring of itself only), and return an
20188 // appropriate error message when they fail.
20189 //
20190 // The {needle,haystack}_expr arguments are the stringified
20191 // expressions that generated the two real arguments.
20192 GTEST_API_ AssertionResult IsSubstring(
20193     const char* needle_expr, const char* haystack_expr,
20194     const char* needle, const char* haystack);
20195 GTEST_API_ AssertionResult IsSubstring(
20196     const char* needle_expr, const char* haystack_expr,
20197     const wchar_t* needle, const wchar_t* haystack);
20198 GTEST_API_ AssertionResult IsNotSubstring(
20199     const char* needle_expr, const char* haystack_expr,
20200     const char* needle, const char* haystack);
20201 GTEST_API_ AssertionResult IsNotSubstring(
20202     const char* needle_expr, const char* haystack_expr,
20203     const wchar_t* needle, const wchar_t* haystack);
20204 GTEST_API_ AssertionResult IsSubstring(
20205     const char* needle_expr, const char* haystack_expr,
20206     const ::std::string& needle, const ::std::string& haystack);
20207 GTEST_API_ AssertionResult IsNotSubstring(
20208     const char* needle_expr, const char* haystack_expr,
20209     const ::std::string& needle, const ::std::string& haystack);
20210 
20211 #if GTEST_HAS_STD_WSTRING
20212 GTEST_API_ AssertionResult IsSubstring(
20213     const char* needle_expr, const char* haystack_expr,
20214     const ::std::wstring& needle, const ::std::wstring& haystack);
20215 GTEST_API_ AssertionResult IsNotSubstring(
20216     const char* needle_expr, const char* haystack_expr,
20217     const ::std::wstring& needle, const ::std::wstring& haystack);
20218 #endif  // GTEST_HAS_STD_WSTRING
20219 
20220 namespace internal {
20221 
20222 // Helper template function for comparing floating-points.
20223 //
20224 // Template parameter:
20225 //
20226 //   RawType: the raw floating-point type (either float or double)
20227 //
20228 // INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
20229 template <typename RawType>
20230 AssertionResult CmpHelperFloatingPointEQ(const char* lhs_expression,
20231                                          const char* rhs_expression,
20232                                          RawType lhs_value,
20233                                          RawType rhs_value) {
20234   const FloatingPoint<RawType> lhs(lhs_value), rhs(rhs_value);
20235 
20236   if (lhs.AlmostEquals(rhs)) {
20237     return AssertionSuccess();
20238   }
20239 
20240   ::std::stringstream lhs_ss;
20241   lhs_ss << std::setprecision(std::numeric_limits<RawType>::digits10 + 2)
20242          << lhs_value;
20243 
20244   ::std::stringstream rhs_ss;
20245   rhs_ss << std::setprecision(std::numeric_limits<RawType>::digits10 + 2)
20246          << rhs_value;
20247 
20248   return EqFailure(lhs_expression,
20249                    rhs_expression,
20250                    StringStreamToString(&lhs_ss),
20251                    StringStreamToString(&rhs_ss),
20252                    false);
20253 }
20254 
20255 // Helper function for implementing ASSERT_NEAR.
20256 //
20257 // INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
20258 GTEST_API_ AssertionResult DoubleNearPredFormat(const char* expr1,
20259                                                 const char* expr2,
20260                                                 const char* abs_error_expr,
20261                                                 double val1,
20262                                                 double val2,
20263                                                 double abs_error);
20264 
20265 // INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.
20266 // A class that enables one to stream messages to assertion macros
20267 class GTEST_API_ AssertHelper {
20268  public:
20269   // Constructor.
20270   AssertHelper(TestPartResult::Type type,
20271                const char* file,
20272                int line,
20273                const char* message);
20274   ~AssertHelper();
20275 
20276   // Message assignment is a semantic trick to enable assertion
20277   // streaming; see the GTEST_MESSAGE_ macro below.
20278   void operator=(const Message& message) const;
20279 
20280  private:
20281   // We put our data in a struct so that the size of the AssertHelper class can
20282   // be as small as possible.  This is important because gcc is incapable of
20283   // re-using stack space even for temporary variables, so every EXPECT_EQ
20284   // reserves stack space for another AssertHelper.
20285   struct AssertHelperData {
20286     AssertHelperData(TestPartResult::Type t,
20287                      const char* srcfile,
20288                      int line_num,
20289                      const char* msg)
20290         : type(t), file(srcfile), line(line_num), message(msg) { }
20291 
20292     TestPartResult::Type const type;
20293     const char* const file;
20294     int const line;
20295     std::string const message;
20296 
20297    private:
20298     GTEST_DISALLOW_COPY_AND_ASSIGN_(AssertHelperData);
20299   };
20300 
20301   AssertHelperData* const data_;
20302 
20303   GTEST_DISALLOW_COPY_AND_ASSIGN_(AssertHelper);
20304 };
20305 
20306 }  // namespace internal
20307 
20308 #if GTEST_HAS_PARAM_TEST
20309 // The pure interface class that all value-parameterized tests inherit from.
20310 // A value-parameterized class must inherit from both ::testing::Test and
20311 // ::testing::WithParamInterface. In most cases that just means inheriting
20312 // from ::testing::TestWithParam, but more complicated test hierarchies
20313 // may need to inherit from Test and WithParamInterface at different levels.
20314 //
20315 // This interface has support for accessing the test parameter value via
20316 // the GetParam() method.
20317 //
20318 // Use it with one of the parameter generator defining functions, like Range(),
20319 // Values(), ValuesIn(), Bool(), and Combine().
20320 //
20321 // class FooTest : public ::testing::TestWithParam<int> {
20322 //  protected:
20323 //   FooTest() {
20324 //     // Can use GetParam() here.
20325 //   }
20326 //   virtual ~FooTest() {
20327 //     // Can use GetParam() here.
20328 //   }
20329 //   virtual void SetUp() {
20330 //     // Can use GetParam() here.
20331 //   }
20332 //   virtual void TearDown {
20333 //     // Can use GetParam() here.
20334 //   }
20335 // };
20336 // TEST_P(FooTest, DoesBar) {
20337 //   // Can use GetParam() method here.
20338 //   Foo foo;
20339 //   ASSERT_TRUE(foo.DoesBar(GetParam()));
20340 // }
20341 // INSTANTIATE_TEST_CASE_P(OneToTenRange, FooTest, ::testing::Range(1, 10));
20342 
20343 template <typename T>
20344 class WithParamInterface {
20345  public:
20346   typedef T ParamType;
20347   virtual ~WithParamInterface() {}
20348 
20349   // The current parameter value. Is also available in the test fixture's
20350   // constructor. This member function is non-static, even though it only
20351   // references static data, to reduce the opportunity for incorrect uses
20352   // like writing 'WithParamInterface<bool>::GetParam()' for a test that
20353   // uses a fixture whose parameter type is int.
20354   const ParamType& GetParam() const {
20355     GTEST_CHECK_(parameter_ != NULL)
20356         << "GetParam() can only be called inside a value-parameterized test "
20357         << "-- did you intend to write TEST_P instead of TEST_F?";
20358     return *parameter_;
20359   }
20360 
20361  private:
20362   // Sets parameter value. The caller is responsible for making sure the value
20363   // remains alive and unchanged throughout the current test.
20364   static void SetParam(const ParamType* parameter) {
20365     parameter_ = parameter;
20366   }
20367 
20368   // Static value used for accessing parameter during a test lifetime.
20369   static const ParamType* parameter_;
20370 
20371   // TestClass must be a subclass of WithParamInterface<T> and Test.
20372   template <class TestClass> friend class internal::ParameterizedTestFactory;
20373 };
20374 
20375 template <typename T>
20376 const T* WithParamInterface<T>::parameter_ = NULL;
20377 
20378 // Most value-parameterized classes can ignore the existence of
20379 // WithParamInterface, and can just inherit from ::testing::TestWithParam.
20380 
20381 template <typename T>
20382 class TestWithParam : public Test, public WithParamInterface<T> {
20383 };
20384 
20385 #endif  // GTEST_HAS_PARAM_TEST
20386 
20387 // Macros for indicating success/failure in test code.
20388 
20389 // ADD_FAILURE unconditionally adds a failure to the current test.
20390 // SUCCEED generates a success - it doesn't automatically make the
20391 // current test successful, as a test is only successful when it has
20392 // no failure.
20393 //
20394 // EXPECT_* verifies that a certain condition is satisfied.  If not,
20395 // it behaves like ADD_FAILURE.  In particular:
20396 //
20397 //   EXPECT_TRUE  verifies that a Boolean condition is true.
20398 //   EXPECT_FALSE verifies that a Boolean condition is false.
20399 //
20400 // FAIL and ASSERT_* are similar to ADD_FAILURE and EXPECT_*, except
20401 // that they will also abort the current function on failure.  People
20402 // usually want the fail-fast behavior of FAIL and ASSERT_*, but those
20403 // writing data-driven tests often find themselves using ADD_FAILURE
20404 // and EXPECT_* more.
20405 
20406 // Generates a nonfatal failure with a generic message.
20407 #define ADD_FAILURE() GTEST_NONFATAL_FAILURE_("Failed")
20408 
20409 // Generates a nonfatal failure at the given source file location with
20410 // a generic message.
20411 #define ADD_FAILURE_AT(file, line) \
20412   GTEST_MESSAGE_AT_(file, line, "Failed", \
20413                     ::testing::TestPartResult::kNonFatalFailure)
20414 
20415 // Generates a fatal failure with a generic message.
20416 #define GTEST_FAIL() GTEST_FATAL_FAILURE_("Failed")
20417 
20418 // Define this macro to 1 to omit the definition of FAIL(), which is a
20419 // generic name and clashes with some other libraries.
20420 #if !GTEST_DONT_DEFINE_FAIL
20421 # define FAIL() GTEST_FAIL()
20422 #endif
20423 
20424 // Generates a success with a generic message.
20425 #define GTEST_SUCCEED() GTEST_SUCCESS_("Succeeded")
20426 
20427 // Define this macro to 1 to omit the definition of SUCCEED(), which
20428 // is a generic name and clashes with some other libraries.
20429 #if !GTEST_DONT_DEFINE_SUCCEED
20430 # define SUCCEED() GTEST_SUCCEED()
20431 #endif
20432 
20433 // Macros for testing exceptions.
20434 //
20435 //    * {ASSERT|EXPECT}_THROW(statement, expected_exception):
20436 //         Tests that the statement throws the expected exception.
20437 //    * {ASSERT|EXPECT}_NO_THROW(statement):
20438 //         Tests that the statement doesn't throw any exception.
20439 //    * {ASSERT|EXPECT}_ANY_THROW(statement):
20440 //         Tests that the statement throws an exception.
20441 
20442 #define EXPECT_THROW(statement, expected_exception) \
20443   GTEST_TEST_THROW_(statement, expected_exception, GTEST_NONFATAL_FAILURE_)
20444 #define EXPECT_NO_THROW(statement) \
20445   GTEST_TEST_NO_THROW_(statement, GTEST_NONFATAL_FAILURE_)
20446 #define EXPECT_ANY_THROW(statement) \
20447   GTEST_TEST_ANY_THROW_(statement, GTEST_NONFATAL_FAILURE_)
20448 #define ASSERT_THROW(statement, expected_exception) \
20449   GTEST_TEST_THROW_(statement, expected_exception, GTEST_FATAL_FAILURE_)
20450 #define ASSERT_NO_THROW(statement) \
20451   GTEST_TEST_NO_THROW_(statement, GTEST_FATAL_FAILURE_)
20452 #define ASSERT_ANY_THROW(statement) \
20453   GTEST_TEST_ANY_THROW_(statement, GTEST_FATAL_FAILURE_)
20454 
20455 // Boolean assertions. Condition can be either a Boolean expression or an
20456 // AssertionResult. For more information on how to use AssertionResult with
20457 // these macros see comments on that class.
20458 #define EXPECT_TRUE(condition) \
20459   GTEST_TEST_BOOLEAN_((condition), #condition, false, true, \
20460                       GTEST_NONFATAL_FAILURE_)
20461 #define EXPECT_FALSE(condition) \
20462   GTEST_TEST_BOOLEAN_(!(condition), #condition, true, false, \
20463                       GTEST_NONFATAL_FAILURE_)
20464 #define ASSERT_TRUE(condition) \
20465   GTEST_TEST_BOOLEAN_((condition), #condition, false, true, \
20466                       GTEST_FATAL_FAILURE_)
20467 #define ASSERT_FALSE(condition) \
20468   GTEST_TEST_BOOLEAN_(!(condition), #condition, true, false, \
20469                       GTEST_FATAL_FAILURE_)
20470 
20471 // Includes the auto-generated header that implements a family of
20472 // generic predicate assertion macros.
20473 // Copyright 2006, Google Inc.
20474 // All rights reserved.
20475 //
20476 // Redistribution and use in source and binary forms, with or without
20477 // modification, are permitted provided that the following conditions are
20478 // met:
20479 //
20480 //     * Redistributions of source code must retain the above copyright
20481 // notice, this list of conditions and the following disclaimer.
20482 //     * Redistributions in binary form must reproduce the above
20483 // copyright notice, this list of conditions and the following disclaimer
20484 // in the documentation and/or other materials provided with the
20485 // distribution.
20486 //     * Neither the name of Google Inc. nor the names of its
20487 // contributors may be used to endorse or promote products derived from
20488 // this software without specific prior written permission.
20489 //
20490 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20491 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20492 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
20493 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20494 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
20495 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
20496 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
20497 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
20498 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
20499 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
20500 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
20501 
20502 // This file is AUTOMATICALLY GENERATED on 10/31/2011 by command
20503 // 'gen_gtest_pred_impl.py 5'.  DO NOT EDIT BY HAND!
20504 //
20505 // Implements a family of generic predicate assertion macros.
20506 
20507 #ifndef GTEST_INCLUDE_GTEST_GTEST_PRED_IMPL_H_
20508 #define GTEST_INCLUDE_GTEST_GTEST_PRED_IMPL_H_
20509 
20510 // Makes sure this header is not included before gtest.h.
20511 #ifndef GTEST_INCLUDE_GTEST_GTEST_H_
20512 # error Do not include gtest_pred_impl.h directly.  Include gtest.h instead.
20513 #endif  // GTEST_INCLUDE_GTEST_GTEST_H_
20514 
20515 // This header implements a family of generic predicate assertion
20516 // macros:
20517 //
20518 //   ASSERT_PRED_FORMAT1(pred_format, v1)
20519 //   ASSERT_PRED_FORMAT2(pred_format, v1, v2)
20520 //   ...
20521 //
20522 // where pred_format is a function or functor that takes n (in the
20523 // case of ASSERT_PRED_FORMATn) values and their source expression
20524 // text, and returns a testing::AssertionResult.  See the definition
20525 // of ASSERT_EQ in gtest.h for an example.
20526 //
20527 // If you don't care about formatting, you can use the more
20528 // restrictive version:
20529 //
20530 //   ASSERT_PRED1(pred, v1)
20531 //   ASSERT_PRED2(pred, v1, v2)
20532 //   ...
20533 //
20534 // where pred is an n-ary function or functor that returns bool,
20535 // and the values v1, v2, ..., must support the << operator for
20536 // streaming to std::ostream.
20537 //
20538 // We also define the EXPECT_* variations.
20539 //
20540 // For now we only support predicates whose arity is at most 5.
20541 // Please email googletestframework@googlegroups.com if you need
20542 // support for higher arities.
20543 
20544 // GTEST_ASSERT_ is the basic statement to which all of the assertions
20545 // in this file reduce.  Don't use this in your code.
20546 
20547 #define GTEST_ASSERT_(expression, on_failure) \
20548   GTEST_AMBIGUOUS_ELSE_BLOCKER_ \
20549   if (const ::testing::AssertionResult gtest_ar = (expression)) \
20550     ; \
20551   else \
20552     on_failure(gtest_ar.failure_message())
20553 
20554 
20555 // Helper function for implementing {EXPECT|ASSERT}_PRED1.  Don't use
20556 // this in your code.
20557 template <typename Pred,
20558           typename T1>
20559 AssertionResult AssertPred1Helper(const char* pred_text,
20560                                   const char* e1,
20561                                   Pred pred,
20562                                   const T1& v1) {
20563   if (pred(v1)) return AssertionSuccess();
20564 
20565   return AssertionFailure() << pred_text << "("
20566                             << e1 << ") evaluates to false, where"
20567                             << "\n" << e1 << " evaluates to " << v1;
20568 }
20569 
20570 // Internal macro for implementing {EXPECT|ASSERT}_PRED_FORMAT1.
20571 // Don't use this in your code.
20572 #define GTEST_PRED_FORMAT1_(pred_format, v1, on_failure)\
20573   GTEST_ASSERT_(pred_format(#v1, v1), \
20574                 on_failure)
20575 
20576 // Internal macro for implementing {EXPECT|ASSERT}_PRED1.  Don't use
20577 // this in your code.
20578 #define GTEST_PRED1_(pred, v1, on_failure)\
20579   GTEST_ASSERT_(::testing::AssertPred1Helper(#pred, \
20580                                              #v1, \
20581                                              pred, \
20582                                              v1), on_failure)
20583 
20584 // Unary predicate assertion macros.
20585 #define EXPECT_PRED_FORMAT1(pred_format, v1) \
20586   GTEST_PRED_FORMAT1_(pred_format, v1, GTEST_NONFATAL_FAILURE_)
20587 #define EXPECT_PRED1(pred, v1) \
20588   GTEST_PRED1_(pred, v1, GTEST_NONFATAL_FAILURE_)
20589 #define ASSERT_PRED_FORMAT1(pred_format, v1) \
20590   GTEST_PRED_FORMAT1_(pred_format, v1, GTEST_FATAL_FAILURE_)
20591 #define ASSERT_PRED1(pred, v1) \
20592   GTEST_PRED1_(pred, v1, GTEST_FATAL_FAILURE_)
20593 
20594 
20595 
20596 // Helper function for implementing {EXPECT|ASSERT}_PRED2.  Don't use
20597 // this in your code.
20598 template <typename Pred,
20599           typename T1,
20600           typename T2>
20601 AssertionResult AssertPred2Helper(const char* pred_text,
20602                                   const char* e1,
20603                                   const char* e2,
20604                                   Pred pred,
20605                                   const T1& v1,
20606                                   const T2& v2) {
20607   if (pred(v1, v2)) return AssertionSuccess();
20608 
20609   return AssertionFailure() << pred_text << "("
20610                             << e1 << ", "
20611                             << e2 << ") evaluates to false, where"
20612                             << "\n" << e1 << " evaluates to " << v1
20613                             << "\n" << e2 << " evaluates to " << v2;
20614 }
20615 
20616 // Internal macro for implementing {EXPECT|ASSERT}_PRED_FORMAT2.
20617 // Don't use this in your code.
20618 #define GTEST_PRED_FORMAT2_(pred_format, v1, v2, on_failure)\
20619   GTEST_ASSERT_(pred_format(#v1, #v2, v1, v2), \
20620                 on_failure)
20621 
20622 // Internal macro for implementing {EXPECT|ASSERT}_PRED2.  Don't use
20623 // this in your code.
20624 #define GTEST_PRED2_(pred, v1, v2, on_failure)\
20625   GTEST_ASSERT_(::testing::AssertPred2Helper(#pred, \
20626                                              #v1, \
20627                                              #v2, \
20628                                              pred, \
20629                                              v1, \
20630                                              v2), on_failure)
20631 
20632 // Binary predicate assertion macros.
20633 #define EXPECT_PRED_FORMAT2(pred_format, v1, v2) \
20634   GTEST_PRED_FORMAT2_(pred_format, v1, v2, GTEST_NONFATAL_FAILURE_)
20635 #define EXPECT_PRED2(pred, v1, v2) \
20636   GTEST_PRED2_(pred, v1, v2, GTEST_NONFATAL_FAILURE_)
20637 #define ASSERT_PRED_FORMAT2(pred_format, v1, v2) \
20638   GTEST_PRED_FORMAT2_(pred_format, v1, v2, GTEST_FATAL_FAILURE_)
20639 #define ASSERT_PRED2(pred, v1, v2) \
20640   GTEST_PRED2_(pred, v1, v2, GTEST_FATAL_FAILURE_)
20641 
20642 
20643 
20644 // Helper function for implementing {EXPECT|ASSERT}_PRED3.  Don't use
20645 // this in your code.
20646 template <typename Pred,
20647           typename T1,
20648           typename T2,
20649           typename T3>
20650 AssertionResult AssertPred3Helper(const char* pred_text,
20651                                   const char* e1,
20652                                   const char* e2,
20653                                   const char* e3,
20654                                   Pred pred,
20655                                   const T1& v1,
20656                                   const T2& v2,
20657                                   const T3& v3) {
20658   if (pred(v1, v2, v3)) return AssertionSuccess();
20659 
20660   return AssertionFailure() << pred_text << "("
20661                             << e1 << ", "
20662                             << e2 << ", "
20663                             << e3 << ") evaluates to false, where"
20664                             << "\n" << e1 << " evaluates to " << v1
20665                             << "\n" << e2 << " evaluates to " << v2
20666                             << "\n" << e3 << " evaluates to " << v3;
20667 }
20668 
20669 // Internal macro for implementing {EXPECT|ASSERT}_PRED_FORMAT3.
20670 // Don't use this in your code.
20671 #define GTEST_PRED_FORMAT3_(pred_format, v1, v2, v3, on_failure)\
20672   GTEST_ASSERT_(pred_format(#v1, #v2, #v3, v1, v2, v3), \
20673                 on_failure)
20674 
20675 // Internal macro for implementing {EXPECT|ASSERT}_PRED3.  Don't use
20676 // this in your code.
20677 #define GTEST_PRED3_(pred, v1, v2, v3, on_failure)\
20678   GTEST_ASSERT_(::testing::AssertPred3Helper(#pred, \
20679                                              #v1, \
20680                                              #v2, \
20681                                              #v3, \
20682                                              pred, \
20683                                              v1, \
20684                                              v2, \
20685                                              v3), on_failure)
20686 
20687 // Ternary predicate assertion macros.
20688 #define EXPECT_PRED_FORMAT3(pred_format, v1, v2, v3) \
20689   GTEST_PRED_FORMAT3_(pred_format, v1, v2, v3, GTEST_NONFATAL_FAILURE_)
20690 #define EXPECT_PRED3(pred, v1, v2, v3) \
20691   GTEST_PRED3_(pred, v1, v2, v3, GTEST_NONFATAL_FAILURE_)
20692 #define ASSERT_PRED_FORMAT3(pred_format, v1, v2, v3) \
20693   GTEST_PRED_FORMAT3_(pred_format, v1, v2, v3, GTEST_FATAL_FAILURE_)
20694 #define ASSERT_PRED3(pred, v1, v2, v3) \
20695   GTEST_PRED3_(pred, v1, v2, v3, GTEST_FATAL_FAILURE_)
20696 
20697 
20698 
20699 // Helper function for implementing {EXPECT|ASSERT}_PRED4.  Don't use
20700 // this in your code.
20701 template <typename Pred,
20702           typename T1,
20703           typename T2,
20704           typename T3,
20705           typename T4>
20706 AssertionResult AssertPred4Helper(const char* pred_text,
20707                                   const char* e1,
20708                                   const char* e2,
20709                                   const char* e3,
20710                                   const char* e4,
20711                                   Pred pred,
20712                                   const T1& v1,
20713                                   const T2& v2,
20714                                   const T3& v3,
20715                                   const T4& v4) {
20716   if (pred(v1, v2, v3, v4)) return AssertionSuccess();
20717 
20718   return AssertionFailure() << pred_text << "("
20719                             << e1 << ", "
20720                             << e2 << ", "
20721                             << e3 << ", "
20722                             << e4 << ") evaluates to false, where"
20723                             << "\n" << e1 << " evaluates to " << v1
20724                             << "\n" << e2 << " evaluates to " << v2
20725                             << "\n" << e3 << " evaluates to " << v3
20726                             << "\n" << e4 << " evaluates to " << v4;
20727 }
20728 
20729 // Internal macro for implementing {EXPECT|ASSERT}_PRED_FORMAT4.
20730 // Don't use this in your code.
20731 #define GTEST_PRED_FORMAT4_(pred_format, v1, v2, v3, v4, on_failure)\
20732   GTEST_ASSERT_(pred_format(#v1, #v2, #v3, #v4, v1, v2, v3, v4), \
20733                 on_failure)
20734 
20735 // Internal macro for implementing {EXPECT|ASSERT}_PRED4.  Don't use
20736 // this in your code.
20737 #define GTEST_PRED4_(pred, v1, v2, v3, v4, on_failure)\
20738   GTEST_ASSERT_(::testing::AssertPred4Helper(#pred, \
20739                                              #v1, \
20740                                              #v2, \
20741                                              #v3, \
20742                                              #v4, \
20743                                              pred, \
20744                                              v1, \
20745                                              v2, \
20746                                              v3, \
20747                                              v4), on_failure)
20748 
20749 // 4-ary predicate assertion macros.
20750 #define EXPECT_PRED_FORMAT4(pred_format, v1, v2, v3, v4) \
20751   GTEST_PRED_FORMAT4_(pred_format, v1, v2, v3, v4, GTEST_NONFATAL_FAILURE_)
20752 #define EXPECT_PRED4(pred, v1, v2, v3, v4) \
20753   GTEST_PRED4_(pred, v1, v2, v3, v4, GTEST_NONFATAL_FAILURE_)
20754 #define ASSERT_PRED_FORMAT4(pred_format, v1, v2, v3, v4) \
20755   GTEST_PRED_FORMAT4_(pred_format, v1, v2, v3, v4, GTEST_FATAL_FAILURE_)
20756 #define ASSERT_PRED4(pred, v1, v2, v3, v4) \
20757   GTEST_PRED4_(pred, v1, v2, v3, v4, GTEST_FATAL_FAILURE_)
20758 
20759 
20760 
20761 // Helper function for implementing {EXPECT|ASSERT}_PRED5.  Don't use
20762 // this in your code.
20763 template <typename Pred,
20764           typename T1,
20765           typename T2,
20766           typename T3,
20767           typename T4,
20768           typename T5>
20769 AssertionResult AssertPred5Helper(const char* pred_text,
20770                                   const char* e1,
20771                                   const char* e2,
20772                                   const char* e3,
20773                                   const char* e4,
20774                                   const char* e5,
20775                                   Pred pred,
20776                                   const T1& v1,
20777                                   const T2& v2,
20778                                   const T3& v3,
20779                                   const T4& v4,
20780                                   const T5& v5) {
20781   if (pred(v1, v2, v3, v4, v5)) return AssertionSuccess();
20782 
20783   return AssertionFailure() << pred_text << "("
20784                             << e1 << ", "
20785                             << e2 << ", "
20786                             << e3 << ", "
20787                             << e4 << ", "
20788                             << e5 << ") evaluates to false, where"
20789                             << "\n" << e1 << " evaluates to " << v1
20790                             << "\n" << e2 << " evaluates to " << v2
20791                             << "\n" << e3 << " evaluates to " << v3
20792                             << "\n" << e4 << " evaluates to " << v4
20793                             << "\n" << e5 << " evaluates to " << v5;
20794 }
20795 
20796 // Internal macro for implementing {EXPECT|ASSERT}_PRED_FORMAT5.
20797 // Don't use this in your code.
20798 #define GTEST_PRED_FORMAT5_(pred_format, v1, v2, v3, v4, v5, on_failure)\
20799   GTEST_ASSERT_(pred_format(#v1, #v2, #v3, #v4, #v5, v1, v2, v3, v4, v5), \
20800                 on_failure)
20801 
20802 // Internal macro for implementing {EXPECT|ASSERT}_PRED5.  Don't use
20803 // this in your code.
20804 #define GTEST_PRED5_(pred, v1, v2, v3, v4, v5, on_failure)\
20805   GTEST_ASSERT_(::testing::AssertPred5Helper(#pred, \
20806                                              #v1, \
20807                                              #v2, \
20808                                              #v3, \
20809                                              #v4, \
20810                                              #v5, \
20811                                              pred, \
20812                                              v1, \
20813                                              v2, \
20814                                              v3, \
20815                                              v4, \
20816                                              v5), on_failure)
20817 
20818 // 5-ary predicate assertion macros.
20819 #define EXPECT_PRED_FORMAT5(pred_format, v1, v2, v3, v4, v5) \
20820   GTEST_PRED_FORMAT5_(pred_format, v1, v2, v3, v4, v5, GTEST_NONFATAL_FAILURE_)
20821 #define EXPECT_PRED5(pred, v1, v2, v3, v4, v5) \
20822   GTEST_PRED5_(pred, v1, v2, v3, v4, v5, GTEST_NONFATAL_FAILURE_)
20823 #define ASSERT_PRED_FORMAT5(pred_format, v1, v2, v3, v4, v5) \
20824   GTEST_PRED_FORMAT5_(pred_format, v1, v2, v3, v4, v5, GTEST_FATAL_FAILURE_)
20825 #define ASSERT_PRED5(pred, v1, v2, v3, v4, v5) \
20826   GTEST_PRED5_(pred, v1, v2, v3, v4, v5, GTEST_FATAL_FAILURE_)
20827 
20828 
20829 
20830 #endif  // GTEST_INCLUDE_GTEST_GTEST_PRED_IMPL_H_
20831 
20832 // Macros for testing equalities and inequalities.
20833 //
20834 //    * {ASSERT|EXPECT}_EQ(v1, v2): Tests that v1 == v2
20835 //    * {ASSERT|EXPECT}_NE(v1, v2): Tests that v1 != v2
20836 //    * {ASSERT|EXPECT}_LT(v1, v2): Tests that v1 < v2
20837 //    * {ASSERT|EXPECT}_LE(v1, v2): Tests that v1 <= v2
20838 //    * {ASSERT|EXPECT}_GT(v1, v2): Tests that v1 > v2
20839 //    * {ASSERT|EXPECT}_GE(v1, v2): Tests that v1 >= v2
20840 //
20841 // When they are not, Google Test prints both the tested expressions and
20842 // their actual values.  The values must be compatible built-in types,
20843 // or you will get a compiler error.  By "compatible" we mean that the
20844 // values can be compared by the respective operator.
20845 //
20846 // Note:
20847 //
20848 //   1. It is possible to make a user-defined type work with
20849 //   {ASSERT|EXPECT}_??(), but that requires overloading the
20850 //   comparison operators and is thus discouraged by the Google C++
20851 //   Usage Guide.  Therefore, you are advised to use the
20852 //   {ASSERT|EXPECT}_TRUE() macro to assert that two objects are
20853 //   equal.
20854 //
20855 //   2. The {ASSERT|EXPECT}_??() macros do pointer comparisons on
20856 //   pointers (in particular, C strings).  Therefore, if you use it
20857 //   with two C strings, you are testing how their locations in memory
20858 //   are related, not how their content is related.  To compare two C
20859 //   strings by content, use {ASSERT|EXPECT}_STR*().
20860 //
20861 //   3. {ASSERT|EXPECT}_EQ(v1, v2) is preferred to
20862 //   {ASSERT|EXPECT}_TRUE(v1 == v2), as the former tells you
20863 //   what the actual value is when it fails, and similarly for the
20864 //   other comparisons.
20865 //
20866 //   4. Do not depend on the order in which {ASSERT|EXPECT}_??()
20867 //   evaluate their arguments, which is undefined.
20868 //
20869 //   5. These macros evaluate their arguments exactly once.
20870 //
20871 // Examples:
20872 //
20873 //   EXPECT_NE(5, Foo());
20874 //   EXPECT_EQ(NULL, a_pointer);
20875 //   ASSERT_LT(i, array_size);
20876 //   ASSERT_GT(records.size(), 0) << "There is no record left.";
20877 
20878 #define EXPECT_EQ(val1, val2) \
20879   EXPECT_PRED_FORMAT2(::testing::internal:: \
20880                       EqHelper<GTEST_IS_NULL_LITERAL_(val1)>::Compare, \
20881                       val1, val2)
20882 #define EXPECT_NE(val1, val2) \
20883   EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperNE, val1, val2)
20884 #define EXPECT_LE(val1, val2) \
20885   EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperLE, val1, val2)
20886 #define EXPECT_LT(val1, val2) \
20887   EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperLT, val1, val2)
20888 #define EXPECT_GE(val1, val2) \
20889   EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperGE, val1, val2)
20890 #define EXPECT_GT(val1, val2) \
20891   EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperGT, val1, val2)
20892 
20893 #define GTEST_ASSERT_EQ(val1, val2) \
20894   ASSERT_PRED_FORMAT2(::testing::internal:: \
20895                       EqHelper<GTEST_IS_NULL_LITERAL_(val1)>::Compare, \
20896                       val1, val2)
20897 #define GTEST_ASSERT_NE(val1, val2) \
20898   ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperNE, val1, val2)
20899 #define GTEST_ASSERT_LE(val1, val2) \
20900   ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperLE, val1, val2)
20901 #define GTEST_ASSERT_LT(val1, val2) \
20902   ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperLT, val1, val2)
20903 #define GTEST_ASSERT_GE(val1, val2) \
20904   ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperGE, val1, val2)
20905 #define GTEST_ASSERT_GT(val1, val2) \
20906   ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperGT, val1, val2)
20907 
20908 // Define macro GTEST_DONT_DEFINE_ASSERT_XY to 1 to omit the definition of
20909 // ASSERT_XY(), which clashes with some users' own code.
20910 
20911 #if !GTEST_DONT_DEFINE_ASSERT_EQ
20912 # define ASSERT_EQ(val1, val2) GTEST_ASSERT_EQ(val1, val2)
20913 #endif
20914 
20915 #if !GTEST_DONT_DEFINE_ASSERT_NE
20916 # define ASSERT_NE(val1, val2) GTEST_ASSERT_NE(val1, val2)
20917 #endif
20918 
20919 #if !GTEST_DONT_DEFINE_ASSERT_LE
20920 # define ASSERT_LE(val1, val2) GTEST_ASSERT_LE(val1, val2)
20921 #endif
20922 
20923 #if !GTEST_DONT_DEFINE_ASSERT_LT
20924 # define ASSERT_LT(val1, val2) GTEST_ASSERT_LT(val1, val2)
20925 #endif
20926 
20927 #if !GTEST_DONT_DEFINE_ASSERT_GE
20928 # define ASSERT_GE(val1, val2) GTEST_ASSERT_GE(val1, val2)
20929 #endif
20930 
20931 #if !GTEST_DONT_DEFINE_ASSERT_GT
20932 # define ASSERT_GT(val1, val2) GTEST_ASSERT_GT(val1, val2)
20933 #endif
20934 
20935 // C-string Comparisons.  All tests treat NULL and any non-NULL string
20936 // as different.  Two NULLs are equal.
20937 //
20938 //    * {ASSERT|EXPECT}_STREQ(s1, s2):     Tests that s1 == s2
20939 //    * {ASSERT|EXPECT}_STRNE(s1, s2):     Tests that s1 != s2
20940 //    * {ASSERT|EXPECT}_STRCASEEQ(s1, s2): Tests that s1 == s2, ignoring case
20941 //    * {ASSERT|EXPECT}_STRCASENE(s1, s2): Tests that s1 != s2, ignoring case
20942 //
20943 // For wide or narrow string objects, you can use the
20944 // {ASSERT|EXPECT}_??() macros.
20945 //
20946 // Don't depend on the order in which the arguments are evaluated,
20947 // which is undefined.
20948 //
20949 // These macros evaluate their arguments exactly once.
20950 
20951 #define EXPECT_STREQ(s1, s2) \
20952   EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperSTREQ, s1, s2)
20953 #define EXPECT_STRNE(s1, s2) \
20954   EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperSTRNE, s1, s2)
20955 #define EXPECT_STRCASEEQ(s1, s2) \
20956   EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperSTRCASEEQ, s1, s2)
20957 #define EXPECT_STRCASENE(s1, s2)\
20958   EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperSTRCASENE, s1, s2)
20959 
20960 #define ASSERT_STREQ(s1, s2) \
20961   ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperSTREQ, s1, s2)
20962 #define ASSERT_STRNE(s1, s2) \
20963   ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperSTRNE, s1, s2)
20964 #define ASSERT_STRCASEEQ(s1, s2) \
20965   ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperSTRCASEEQ, s1, s2)
20966 #define ASSERT_STRCASENE(s1, s2)\
20967   ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperSTRCASENE, s1, s2)
20968 
20969 // Macros for comparing floating-point numbers.
20970 //
20971 //    * {ASSERT|EXPECT}_FLOAT_EQ(val1, val2):
20972 //         Tests that two float values are almost equal.
20973 //    * {ASSERT|EXPECT}_DOUBLE_EQ(val1, val2):
20974 //         Tests that two double values are almost equal.
20975 //    * {ASSERT|EXPECT}_NEAR(v1, v2, abs_error):
20976 //         Tests that v1 and v2 are within the given distance to each other.
20977 //
20978 // Google Test uses ULP-based comparison to automatically pick a default
20979 // error bound that is appropriate for the operands.  See the
20980 // FloatingPoint template class in gtest-internal.h if you are
20981 // interested in the implementation details.
20982 
20983 #define EXPECT_FLOAT_EQ(val1, val2)\
20984   EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperFloatingPointEQ<float>, \
20985                       val1, val2)
20986 
20987 #define EXPECT_DOUBLE_EQ(val1, val2)\
20988   EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperFloatingPointEQ<double>, \
20989                       val1, val2)
20990 
20991 #define ASSERT_FLOAT_EQ(val1, val2)\
20992   ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperFloatingPointEQ<float>, \
20993                       val1, val2)
20994 
20995 #define ASSERT_DOUBLE_EQ(val1, val2)\
20996   ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperFloatingPointEQ<double>, \
20997                       val1, val2)
20998 
20999 #define EXPECT_NEAR(val1, val2, abs_error)\
21000   EXPECT_PRED_FORMAT3(::testing::internal::DoubleNearPredFormat, \
21001                       val1, val2, abs_error)
21002 
21003 #define ASSERT_NEAR(val1, val2, abs_error)\
21004   ASSERT_PRED_FORMAT3(::testing::internal::DoubleNearPredFormat, \
21005                       val1, val2, abs_error)
21006 
21007 // These predicate format functions work on floating-point values, and
21008 // can be used in {ASSERT|EXPECT}_PRED_FORMAT2*(), e.g.
21009 //
21010 //   EXPECT_PRED_FORMAT2(testing::DoubleLE, Foo(), 5.0);
21011 
21012 // Asserts that val1 is less than, or almost equal to, val2.  Fails
21013 // otherwise.  In particular, it fails if either val1 or val2 is NaN.
21014 GTEST_API_ AssertionResult FloatLE(const char* expr1, const char* expr2,
21015                                    float val1, float val2);
21016 GTEST_API_ AssertionResult DoubleLE(const char* expr1, const char* expr2,
21017                                     double val1, double val2);
21018 
21019 
21020 #if GTEST_OS_WINDOWS
21021 
21022 // Macros that test for HRESULT failure and success, these are only useful
21023 // on Windows, and rely on Windows SDK macros and APIs to compile.
21024 //
21025 //    * {ASSERT|EXPECT}_HRESULT_{SUCCEEDED|FAILED}(expr)
21026 //
21027 // When expr unexpectedly fails or succeeds, Google Test prints the
21028 // expected result and the actual result with both a human-readable
21029 // string representation of the error, if available, as well as the
21030 // hex result code.
21031 # define EXPECT_HRESULT_SUCCEEDED(expr) \
21032     EXPECT_PRED_FORMAT1(::testing::internal::IsHRESULTSuccess, (expr))
21033 
21034 # define ASSERT_HRESULT_SUCCEEDED(expr) \
21035     ASSERT_PRED_FORMAT1(::testing::internal::IsHRESULTSuccess, (expr))
21036 
21037 # define EXPECT_HRESULT_FAILED(expr) \
21038     EXPECT_PRED_FORMAT1(::testing::internal::IsHRESULTFailure, (expr))
21039 
21040 # define ASSERT_HRESULT_FAILED(expr) \
21041     ASSERT_PRED_FORMAT1(::testing::internal::IsHRESULTFailure, (expr))
21042 
21043 #endif  // GTEST_OS_WINDOWS
21044 
21045 // Macros that execute statement and check that it doesn't generate new fatal
21046 // failures in the current thread.
21047 //
21048 //   * {ASSERT|EXPECT}_NO_FATAL_FAILURE(statement);
21049 //
21050 // Examples:
21051 //
21052 //   EXPECT_NO_FATAL_FAILURE(Process());
21053 //   ASSERT_NO_FATAL_FAILURE(Process()) << "Process() failed";
21054 //
21055 #define ASSERT_NO_FATAL_FAILURE(statement) \
21056     GTEST_TEST_NO_FATAL_FAILURE_(statement, GTEST_FATAL_FAILURE_)
21057 #define EXPECT_NO_FATAL_FAILURE(statement) \
21058     GTEST_TEST_NO_FATAL_FAILURE_(statement, GTEST_NONFATAL_FAILURE_)
21059 
21060 // Causes a trace (including the source file path, the current line
21061 // number, and the given message) to be included in every test failure
21062 // message generated by code in the current scope.  The effect is
21063 // undone when the control leaves the current scope.
21064 //
21065 // The message argument can be anything streamable to std::ostream.
21066 //
21067 // In the implementation, we include the current line number as part
21068 // of the dummy variable name, thus allowing multiple SCOPED_TRACE()s
21069 // to appear in the same block - as long as they are on different
21070 // lines.
21071 #define SCOPED_TRACE(message) \
21072   ::testing::internal::ScopedTrace GTEST_CONCAT_TOKEN_(gtest_trace_, __LINE__)(\
21073     __FILE__, __LINE__, ::testing::Message() << (message))
21074 
21075 // Compile-time assertion for type equality.
21076 // StaticAssertTypeEq<type1, type2>() compiles iff type1 and type2 are
21077 // the same type.  The value it returns is not interesting.
21078 //
21079 // Instead of making StaticAssertTypeEq a class template, we make it a
21080 // function template that invokes a helper class template.  This
21081 // prevents a user from misusing StaticAssertTypeEq<T1, T2> by
21082 // defining objects of that type.
21083 //
21084 // CAVEAT:
21085 //
21086 // When used inside a method of a class template,
21087 // StaticAssertTypeEq<T1, T2>() is effective ONLY IF the method is
21088 // instantiated.  For example, given:
21089 //
21090 //   template <typename T> class Foo {
21091 //    public:
21092 //     void Bar() { testing::StaticAssertTypeEq<int, T>(); }
21093 //   };
21094 //
21095 // the code:
21096 //
21097 //   void Test1() { Foo<bool> foo; }
21098 //
21099 // will NOT generate a compiler error, as Foo<bool>::Bar() is never
21100 // actually instantiated.  Instead, you need:
21101 //
21102 //   void Test2() { Foo<bool> foo; foo.Bar(); }
21103 //
21104 // to cause a compiler error.
21105 template <typename T1, typename T2>
21106 bool StaticAssertTypeEq() {
21107   (void)internal::StaticAssertTypeEqHelper<T1, T2>();
21108   return true;
21109 }
21110 
21111 // Defines a test.
21112 //
21113 // The first parameter is the name of the test case, and the second
21114 // parameter is the name of the test within the test case.
21115 //
21116 // The convention is to end the test case name with "Test".  For
21117 // example, a test case for the Foo class can be named FooTest.
21118 //
21119 // Test code should appear between braces after an invocation of
21120 // this macro.  Example:
21121 //
21122 //   TEST(FooTest, InitializesCorrectly) {
21123 //     Foo foo;
21124 //     EXPECT_TRUE(foo.StatusIsOK());
21125 //   }
21126 
21127 // Note that we call GetTestTypeId() instead of GetTypeId<
21128 // ::testing::Test>() here to get the type ID of testing::Test.  This
21129 // is to work around a suspected linker bug when using Google Test as
21130 // a framework on Mac OS X.  The bug causes GetTypeId<
21131 // ::testing::Test>() to return different values depending on whether
21132 // the call is from the Google Test framework itself or from user test
21133 // code.  GetTestTypeId() is guaranteed to always return the same
21134 // value, as it always calls GetTypeId<>() from the Google Test
21135 // framework.
21136 #define GTEST_TEST(test_case_name, test_name)\
21137   GTEST_TEST_(test_case_name, test_name, \
21138               ::testing::Test, ::testing::internal::GetTestTypeId())
21139 
21140 // Define this macro to 1 to omit the definition of TEST(), which
21141 // is a generic name and clashes with some other libraries.
21142 #if !GTEST_DONT_DEFINE_TEST
21143 # define TEST(test_case_name, test_name) GTEST_TEST(test_case_name, test_name)
21144 #endif
21145 
21146 // Defines a test that uses a test fixture.
21147 //
21148 // The first parameter is the name of the test fixture class, which
21149 // also doubles as the test case name.  The second parameter is the
21150 // name of the test within the test case.
21151 //
21152 // A test fixture class must be declared earlier.  The user should put
21153 // his test code between braces after using this macro.  Example:
21154 //
21155 //   class FooTest : public testing::Test {
21156 //    protected:
21157 //     virtual void SetUp() { b_.AddElement(3); }
21158 //
21159 //     Foo a_;
21160 //     Foo b_;
21161 //   };
21162 //
21163 //   TEST_F(FooTest, InitializesCorrectly) {
21164 //     EXPECT_TRUE(a_.StatusIsOK());
21165 //   }
21166 //
21167 //   TEST_F(FooTest, ReturnsElementCountCorrectly) {
21168 //     EXPECT_EQ(0, a_.size());
21169 //     EXPECT_EQ(1, b_.size());
21170 //   }
21171 
21172 #define TEST_F(test_fixture, test_name)\
21173   GTEST_TEST_(test_fixture, test_name, test_fixture, \
21174               ::testing::internal::GetTypeId<test_fixture>())
21175 
21176 }  // namespace testing
21177 
21178 // Use this function in main() to run all tests.  It returns 0 if all
21179 // tests are successful, or 1 otherwise.
21180 //
21181 // RUN_ALL_TESTS() should be invoked after the command line has been
21182 // parsed by InitGoogleTest().
21183 //
21184 // This function was formerly a macro; thus, it is in the global
21185 // namespace and has an all-caps name.
21186 int RUN_ALL_TESTS() GTEST_MUST_USE_RESULT_;
21187 
21188 inline int RUN_ALL_TESTS() {
21189   return ::testing::UnitTest::GetInstance()->Run();
21190 }
21191 
21192 #endif  // GTEST_INCLUDE_GTEST_GTEST_H_
21193