18b52a31eSHanoh Haim// Copyright 2005, Google Inc.
28b52a31eSHanoh Haim// All rights reserved.
38b52a31eSHanoh Haim//
48b52a31eSHanoh Haim// Redistribution and use in source and binary forms, with or without
58b52a31eSHanoh Haim// modification, are permitted provided that the following conditions are
68b52a31eSHanoh Haim// met:
78b52a31eSHanoh Haim//
88b52a31eSHanoh Haim//     * Redistributions of source code must retain the above copyright
98b52a31eSHanoh Haim// notice, this list of conditions and the following disclaimer.
108b52a31eSHanoh Haim//     * Redistributions in binary form must reproduce the above
118b52a31eSHanoh Haim// copyright notice, this list of conditions and the following disclaimer
128b52a31eSHanoh Haim// in the documentation and/or other materials provided with the
138b52a31eSHanoh Haim// distribution.
148b52a31eSHanoh Haim//     * Neither the name of Google Inc. nor the names of its
158b52a31eSHanoh Haim// contributors may be used to endorse or promote products derived from
168b52a31eSHanoh Haim// this software without specific prior written permission.
178b52a31eSHanoh Haim//
188b52a31eSHanoh Haim// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
198b52a31eSHanoh Haim// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
208b52a31eSHanoh Haim// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
218b52a31eSHanoh Haim// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
228b52a31eSHanoh Haim// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
238b52a31eSHanoh Haim// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
248b52a31eSHanoh Haim// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
258b52a31eSHanoh Haim// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
268b52a31eSHanoh Haim// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
278b52a31eSHanoh Haim// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
288b52a31eSHanoh Haim// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
298b52a31eSHanoh Haim//
308b52a31eSHanoh Haim// Author: wan@google.com (Zhanyong Wan)
318b52a31eSHanoh Haim//
328b52a31eSHanoh Haim// The Google C++ Testing Framework (Google Test)
338b52a31eSHanoh Haim//
348b52a31eSHanoh Haim// This header file defines the public API for Google Test.  It should be
358b52a31eSHanoh Haim// included by any test program that uses Google Test.
368b52a31eSHanoh Haim//
378b52a31eSHanoh Haim// IMPORTANT NOTE: Due to limitation of the C++ language, we have to
388b52a31eSHanoh Haim// leave some internal implementation details in this header file.
398b52a31eSHanoh Haim// They are clearly marked by comments like this:
408b52a31eSHanoh Haim//
418b52a31eSHanoh Haim//   // INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
428b52a31eSHanoh Haim//
438b52a31eSHanoh Haim// Such code is NOT meant to be used by a user directly, and is subject
448b52a31eSHanoh Haim// to CHANGE WITHOUT NOTICE.  Therefore DO NOT DEPEND ON IT in a user
458b52a31eSHanoh Haim// program!
468b52a31eSHanoh Haim//
478b52a31eSHanoh Haim// Acknowledgment: Google Test borrowed the idea of automatic test
488b52a31eSHanoh Haim// registration from Barthelemy Dagenais' (barthelemy@prologique.com)
498b52a31eSHanoh Haim// easyUnit framework.
508b52a31eSHanoh Haim//
518b52a31eSHanoh Haim/*****
528b52a31eSHanoh Haim * NAME
538b52a31eSHanoh Haim *
548b52a31eSHanoh Haim *
558b52a31eSHanoh Haim * AUTHOR
568b52a31eSHanoh Haim *   google
578b52a31eSHanoh Haim *
588b52a31eSHanoh Haim * COPYRIGHT
598b52a31eSHanoh Haim *   Copyright (c) 2004-2011 by cisco Systems, Inc.
608b52a31eSHanoh Haim *   All rights reserved.
618b52a31eSHanoh Haim *
628b52a31eSHanoh Haim * DESCRIPTION
638b52a31eSHanoh Haim *
648b52a31eSHanoh Haim ****/
658b52a31eSHanoh Haim
668b52a31eSHanoh Haim
678b52a31eSHanoh Haim#ifndef GTEST_INCLUDE_GTEST_GTEST_H_
688b52a31eSHanoh Haim#define GTEST_INCLUDE_GTEST_GTEST_H_
698b52a31eSHanoh Haim
708b52a31eSHanoh Haim#include <limits>
718b52a31eSHanoh Haim#include <vector>
728b52a31eSHanoh Haim
738b52a31eSHanoh Haim// Copyright 2005, Google Inc.
748b52a31eSHanoh Haim// All rights reserved.
758b52a31eSHanoh Haim//
768b52a31eSHanoh Haim// Redistribution and use in source and binary forms, with or without
778b52a31eSHanoh Haim// modification, are permitted provided that the following conditions are
788b52a31eSHanoh Haim// met:
798b52a31eSHanoh Haim//
808b52a31eSHanoh Haim//     * Redistributions of source code must retain the above copyright
818b52a31eSHanoh Haim// notice, this list of conditions and the following disclaimer.
828b52a31eSHanoh Haim//     * Redistributions in binary form must reproduce the above
838b52a31eSHanoh Haim// copyright notice, this list of conditions and the following disclaimer
848b52a31eSHanoh Haim// in the documentation and/or other materials provided with the
858b52a31eSHanoh Haim// distribution.
868b52a31eSHanoh Haim//     * Neither the name of Google Inc. nor the names of its
878b52a31eSHanoh Haim// contributors may be used to endorse or promote products derived from
888b52a31eSHanoh Haim// this software without specific prior written permission.
898b52a31eSHanoh Haim//
908b52a31eSHanoh Haim// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
918b52a31eSHanoh Haim// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
928b52a31eSHanoh Haim// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
938b52a31eSHanoh Haim// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
948b52a31eSHanoh Haim// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
958b52a31eSHanoh Haim// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
968b52a31eSHanoh Haim// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
978b52a31eSHanoh Haim// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
988b52a31eSHanoh Haim// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
998b52a31eSHanoh Haim// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
1008b52a31eSHanoh Haim// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
1018b52a31eSHanoh Haim//
1028b52a31eSHanoh Haim// Authors: wan@google.com (Zhanyong Wan), eefacm@gmail.com (Sean Mcafee)
1038b52a31eSHanoh Haim//
1048b52a31eSHanoh Haim// The Google C++ Testing Framework (Google Test)
1058b52a31eSHanoh Haim//
1068b52a31eSHanoh Haim// This header file declares functions and macros used internally by
1078b52a31eSHanoh Haim// Google Test.  They are subject to change without notice.
1088b52a31eSHanoh Haim
1098b52a31eSHanoh Haim#ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_INTERNAL_H_
1108b52a31eSHanoh Haim#define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_INTERNAL_H_
1118b52a31eSHanoh Haim
1128b52a31eSHanoh Haim// Copyright 2005, Google Inc.
1138b52a31eSHanoh Haim// All rights reserved.
1148b52a31eSHanoh Haim//
1158b52a31eSHanoh Haim// Redistribution and use in source and binary forms, with or without
1168b52a31eSHanoh Haim// modification, are permitted provided that the following conditions are
1178b52a31eSHanoh Haim// met:
1188b52a31eSHanoh Haim//
1198b52a31eSHanoh Haim//     * Redistributions of source code must retain the above copyright
1208b52a31eSHanoh Haim// notice, this list of conditions and the following disclaimer.
1218b52a31eSHanoh Haim//     * Redistributions in binary form must reproduce the above
1228b52a31eSHanoh Haim// copyright notice, this list of conditions and the following disclaimer
1238b52a31eSHanoh Haim// in the documentation and/or other materials provided with the
1248b52a31eSHanoh Haim// distribution.
1258b52a31eSHanoh Haim//     * Neither the name of Google Inc. nor the names of its
1268b52a31eSHanoh Haim// contributors may be used to endorse or promote products derived from
1278b52a31eSHanoh Haim// this software without specific prior written permission.
1288b52a31eSHanoh Haim//
1298b52a31eSHanoh Haim// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
1308b52a31eSHanoh Haim// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
1318b52a31eSHanoh Haim// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
1328b52a31eSHanoh Haim// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
1338b52a31eSHanoh Haim// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
1348b52a31eSHanoh Haim// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
1358b52a31eSHanoh Haim// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
1368b52a31eSHanoh Haim// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
1378b52a31eSHanoh Haim// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
1388b52a31eSHanoh Haim// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
1398b52a31eSHanoh Haim// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
1408b52a31eSHanoh Haim//
1418b52a31eSHanoh Haim// Authors: wan@google.com (Zhanyong Wan)
1428b52a31eSHanoh Haim//
1438b52a31eSHanoh Haim// Low-level types and utilities for porting Google Test to various
1448b52a31eSHanoh Haim// platforms.  They are subject to change without notice.  DO NOT USE
1458b52a31eSHanoh Haim// THEM IN USER CODE.
1468b52a31eSHanoh Haim
1478b52a31eSHanoh Haim#ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PORT_H_
1488b52a31eSHanoh Haim#define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PORT_H_
1498b52a31eSHanoh Haim
1508b52a31eSHanoh Haim// The user can define the following macros in the build script to
1518b52a31eSHanoh Haim// control Google Test's behavior.  If the user doesn't define a macro
1528b52a31eSHanoh Haim// in this list, Google Test will define it.
1538b52a31eSHanoh Haim//
1548b52a31eSHanoh Haim//   GTEST_HAS_CLONE          - Define it to 1/0 to indicate that clone(2)
1558b52a31eSHanoh Haim//                              is/isn't available.
1568b52a31eSHanoh Haim//   GTEST_HAS_EXCEPTIONS     - Define it to 1/0 to indicate that exceptions
1578b52a31eSHanoh Haim//                              are enabled.
1588b52a31eSHanoh Haim//   GTEST_HAS_GLOBAL_STRING  - Define it to 1/0 to indicate that ::string
1598b52a31eSHanoh Haim//                              is/isn't available (some systems define
1608b52a31eSHanoh Haim//                              ::string, which is different to std::string).
1618b52a31eSHanoh Haim//   GTEST_HAS_GLOBAL_WSTRING - Define it to 1/0 to indicate that ::string
1628b52a31eSHanoh Haim//                              is/isn't available (some systems define
1638b52a31eSHanoh Haim//                              ::wstring, which is different to std::wstring).
1648b52a31eSHanoh Haim//   GTEST_HAS_PTHREAD        - Define it to 1/0 to indicate that <pthread.h>
1658b52a31eSHanoh Haim//                              is/isn't available.
1668b52a31eSHanoh Haim//   GTEST_HAS_RTTI           - Define it to 1/0 to indicate that RTTI is/isn't
1678b52a31eSHanoh Haim//                              enabled.
1688b52a31eSHanoh Haim//   GTEST_HAS_STD_WSTRING    - Define it to 1/0 to indicate that
1698b52a31eSHanoh Haim//                              std::wstring does/doesn't work (Google Test can
1708b52a31eSHanoh Haim//                              be used where std::wstring is unavailable).
1718b52a31eSHanoh Haim//   GTEST_HAS_TR1_TUPLE      - Define it to 1/0 to indicate tr1::tuple
1728b52a31eSHanoh Haim//                              is/isn't available.
1738b52a31eSHanoh Haim//   GTEST_HAS_SEH            - Define it to 1/0 to indicate whether the
1748b52a31eSHanoh Haim//                              compiler supports Microsoft's "Structured
1758b52a31eSHanoh Haim//                              Exception Handling".
1768b52a31eSHanoh Haim//   GTEST_USE_OWN_TR1_TUPLE  - Define it to 1/0 to indicate whether Google
1778b52a31eSHanoh Haim//                              Test's own tr1 tuple implementation should be
1788b52a31eSHanoh Haim//                              used.  Unused when the user sets
1798b52a31eSHanoh Haim//                              GTEST_HAS_TR1_TUPLE to 0.
1808b52a31eSHanoh Haim//   GTEST_LINKED_AS_SHARED_LIBRARY
1818b52a31eSHanoh Haim//                            - Define to 1 when compiling tests that use
1828b52a31eSHanoh Haim//                              Google Test as a shared library (known as
1838b52a31eSHanoh Haim//                              DLL on Windows).
1848b52a31eSHanoh Haim//   GTEST_CREATE_SHARED_LIBRARY
1858b52a31eSHanoh Haim//                            - Define to 1 when compiling Google Test itself
1868b52a31eSHanoh Haim//                              as a shared library.
1878b52a31eSHanoh Haim
1888b52a31eSHanoh Haim// This header defines the following utilities:
1898b52a31eSHanoh Haim//
1908b52a31eSHanoh Haim// Macros indicating the current platform (defined to 1 if compiled on
1918b52a31eSHanoh Haim// the given platform; otherwise undefined):
1928b52a31eSHanoh Haim//   GTEST_OS_AIX      - IBM AIX
1938b52a31eSHanoh Haim//   GTEST_OS_CYGWIN   - Cygwin
1948b52a31eSHanoh Haim//   GTEST_OS_LINUX    - Linux
1958b52a31eSHanoh Haim//   GTEST_OS_MAC      - Mac OS X
1968b52a31eSHanoh Haim//   GTEST_OS_SOLARIS  - Sun Solaris
1978b52a31eSHanoh Haim//   GTEST_OS_SYMBIAN  - Symbian
1988b52a31eSHanoh Haim//   GTEST_OS_WINDOWS  - Windows (Desktop, MinGW, or Mobile)
1998b52a31eSHanoh Haim//     GTEST_OS_WINDOWS_DESKTOP  - Windows Desktop
2008b52a31eSHanoh Haim//     GTEST_OS_WINDOWS_MINGW    - MinGW
2018b52a31eSHanoh Haim//     GTEST_OS_WINDOWS_MOBILE   - Windows Mobile
2028b52a31eSHanoh Haim//   GTEST_OS_ZOS      - z/OS
2038b52a31eSHanoh Haim//
2048b52a31eSHanoh Haim// Among the platforms, Cygwin, Linux, Max OS X, and Windows have the
2058b52a31eSHanoh Haim// most stable support.  Since core members of the Google Test project
2068b52a31eSHanoh Haim// don't have access to other platforms, support for them may be less
2078b52a31eSHanoh Haim// stable.  If you notice any problems on your platform, please notify
2088b52a31eSHanoh Haim// googletestframework@googlegroups.com (patches for fixing them are
2098b52a31eSHanoh Haim// even more welcome!).
2108b52a31eSHanoh Haim//
2118b52a31eSHanoh Haim// Note that it is possible that none of the GTEST_OS_* macros are defined.
2128b52a31eSHanoh Haim//
2138b52a31eSHanoh Haim// Macros indicating available Google Test features (defined to 1 if
2148b52a31eSHanoh Haim// the corresponding feature is supported; otherwise undefined):
2158b52a31eSHanoh Haim//   GTEST_HAS_COMBINE      - the Combine() function (for value-parameterized
2168b52a31eSHanoh Haim//                            tests)
2178b52a31eSHanoh Haim//   GTEST_HAS_DEATH_TEST   - death tests
2188b52a31eSHanoh Haim//   GTEST_HAS_PARAM_TEST   - value-parameterized tests
2198b52a31eSHanoh Haim//   GTEST_HAS_TYPED_TEST   - typed tests
2208b52a31eSHanoh Haim//   GTEST_HAS_TYPED_TEST_P - type-parameterized tests
2218b52a31eSHanoh Haim//   GTEST_USES_POSIX_RE    - enhanced POSIX regex is used.
2228b52a31eSHanoh Haim//   GTEST_USES_SIMPLE_RE   - our own simple regex is used;
2238b52a31eSHanoh Haim//                            the above two are mutually exclusive.
2248b52a31eSHanoh Haim//   GTEST_CAN_COMPARE_NULL - accepts untyped NULL in EXPECT_EQ().
2258b52a31eSHanoh Haim//
2268b52a31eSHanoh Haim// Macros for basic C++ coding:
2278b52a31eSHanoh Haim//   GTEST_AMBIGUOUS_ELSE_BLOCKER_ - for disabling a gcc warning.
2288b52a31eSHanoh Haim//   GTEST_ATTRIBUTE_UNUSED_  - declares that a class' instances or a
2298b52a31eSHanoh Haim//                              variable don't have to be used.
2308b52a31eSHanoh Haim//   GTEST_DISALLOW_ASSIGN_   - disables operator=.
2318b52a31eSHanoh Haim//   GTEST_DISALLOW_COPY_AND_ASSIGN_ - disables copy ctor and operator=.
2328b52a31eSHanoh Haim//   GTEST_MUST_USE_RESULT_   - declares that a function's result must be used.
2338b52a31eSHanoh Haim//
2348b52a31eSHanoh Haim// Synchronization:
2358b52a31eSHanoh Haim//   Mutex, MutexLock, ThreadLocal, GetThreadCount()
2368b52a31eSHanoh Haim//                  - synchronization primitives.
2378b52a31eSHanoh Haim//   GTEST_IS_THREADSAFE - defined to 1 to indicate that the above
2388b52a31eSHanoh Haim//                         synchronization primitives have real implementations
2398b52a31eSHanoh Haim//                         and Google Test is thread-safe; or 0 otherwise.
2408b52a31eSHanoh Haim//
2418b52a31eSHanoh Haim// Template meta programming:
2428b52a31eSHanoh Haim//   is_pointer     - as in TR1; needed on Symbian and IBM XL C/C++ only.
2438b52a31eSHanoh Haim//
2448b52a31eSHanoh Haim// Smart pointers:
2458b52a31eSHanoh Haim//   scoped_ptr     - as in TR2.
2468b52a31eSHanoh Haim//
2478b52a31eSHanoh Haim// Regular expressions:
2488b52a31eSHanoh Haim//   RE             - a simple regular expression class using the POSIX
2498b52a31eSHanoh Haim//                    Extended Regular Expression syntax.  Not available on
2508b52a31eSHanoh Haim//                    Windows.
2518b52a31eSHanoh Haim//
2528b52a31eSHanoh Haim// Logging:
2538b52a31eSHanoh Haim//   GTEST_LOG_()   - logs messages at the specified severity level.
2548b52a31eSHanoh Haim//   LogToStderr()  - directs all log messages to stderr.
2558b52a31eSHanoh Haim//   FlushInfoLog() - flushes informational log messages.
2568b52a31eSHanoh Haim//
2578b52a31eSHanoh Haim// Stdout and stderr capturing:
2588b52a31eSHanoh Haim//   CaptureStdout()     - starts capturing stdout.
2598b52a31eSHanoh Haim//   GetCapturedStdout() - stops capturing stdout and returns the captured
2608b52a31eSHanoh Haim//                         string.
2618b52a31eSHanoh Haim//   CaptureStderr()     - starts capturing stderr.
2628b52a31eSHanoh Haim//   GetCapturedStderr() - stops capturing stderr and returns the captured
2638b52a31eSHanoh Haim//                         string.
2648b52a31eSHanoh Haim//
2658b52a31eSHanoh Haim// Integer types:
2668b52a31eSHanoh Haim//   TypeWithSize   - maps an integer to a int type.
2678b52a31eSHanoh Haim//   Int32, UInt32, Int64, UInt64, TimeInMillis
2688b52a31eSHanoh Haim//                  - integers of known sizes.
2698b52a31eSHanoh Haim//   BiggestInt     - the biggest signed integer type.
2708b52a31eSHanoh Haim//
2718b52a31eSHanoh Haim// Command-line utilities:
2728b52a31eSHanoh Haim//   GTEST_FLAG()       - references a flag.
2738b52a31eSHanoh Haim//   GTEST_DECLARE_*()  - declares a flag.
2748b52a31eSHanoh Haim//   GTEST_DEFINE_*()   - defines a flag.
2758b52a31eSHanoh Haim//   GetArgvs()         - returns the command line as a vector of strings.
2768b52a31eSHanoh Haim//
2778b52a31eSHanoh Haim// Environment variable utilities:
2788b52a31eSHanoh Haim//   GetEnv()             - gets the value of an environment variable.
2798b52a31eSHanoh Haim//   BoolFromGTestEnv()   - parses a bool environment variable.
2808b52a31eSHanoh Haim//   Int32FromGTestEnv()  - parses an Int32 environment variable.
2818b52a31eSHanoh Haim//   StringFromGTestEnv() - parses a string environment variable.
2828b52a31eSHanoh Haim
2838b52a31eSHanoh Haim#include <stddef.h>  // For ptrdiff_t
2848b52a31eSHanoh Haim#include <stdlib.h>
2858b52a31eSHanoh Haim#include <stdio.h>
2868b52a31eSHanoh Haim#include <string.h>
2878b52a31eSHanoh Haim#ifndef _WIN32_WCE
2888b52a31eSHanoh Haim#include <sys/stat.h>
2898b52a31eSHanoh Haim#endif  // !_WIN32_WCE
2908b52a31eSHanoh Haim
2918b52a31eSHanoh Haim#include <iostream>  // NOLINT
2928b52a31eSHanoh Haim#include <sstream>  // NOLINT
2938b52a31eSHanoh Haim#include <string>  // NOLINT
2948b52a31eSHanoh Haim
2958b52a31eSHanoh Haim#define GTEST_DEV_EMAIL_ "googletestframework@@googlegroups.com"
2968b52a31eSHanoh Haim#define GTEST_FLAG_PREFIX_ "gtest_"
2978b52a31eSHanoh Haim#define GTEST_FLAG_PREFIX_DASH_ "gtest-"
2988b52a31eSHanoh Haim#define GTEST_FLAG_PREFIX_UPPER_ "GTEST_"
2998b52a31eSHanoh Haim#define GTEST_NAME_ "Google Test"
3008b52a31eSHanoh Haim#define GTEST_PROJECT_URL_ "http://code.google.com/p/googletest/"
3018b52a31eSHanoh Haim
3028b52a31eSHanoh Haim// Determines the version of gcc that is used to compile this.
3038b52a31eSHanoh Haim#ifdef __GNUC__
3048b52a31eSHanoh Haim// 40302 means version 4.3.2.
3058b52a31eSHanoh Haim#define GTEST_GCC_VER_ \
3068b52a31eSHanoh Haim    (__GNUC__*10000 + __GNUC_MINOR__*100 + __GNUC_PATCHLEVEL__)
3078b52a31eSHanoh Haim#endif  // __GNUC__
3088b52a31eSHanoh Haim
3098b52a31eSHanoh Haim// Determines the platform on which Google Test is compiled.
3108b52a31eSHanoh Haim#ifdef __CYGWIN__
3118b52a31eSHanoh Haim#define GTEST_OS_CYGWIN 1
3128b52a31eSHanoh Haim#elif defined __SYMBIAN32__
3138b52a31eSHanoh Haim#define GTEST_OS_SYMBIAN 1
3148b52a31eSHanoh Haim#elif defined _WIN32
3158b52a31eSHanoh Haim#define GTEST_OS_WINDOWS 1
3168b52a31eSHanoh Haim#ifdef _WIN32_WCE
3178b52a31eSHanoh Haim#define GTEST_OS_WINDOWS_MOBILE 1
3188b52a31eSHanoh Haim#elif defined(__MINGW__) || defined(__MINGW32__)
3198b52a31eSHanoh Haim#define GTEST_OS_WINDOWS_MINGW 1
3208b52a31eSHanoh Haim#else
3218b52a31eSHanoh Haim#define GTEST_OS_WINDOWS_DESKTOP 1
3228b52a31eSHanoh Haim#endif  // _WIN32_WCE
3238b52a31eSHanoh Haim#elif defined __APPLE__
3248b52a31eSHanoh Haim#define GTEST_OS_MAC 1
3258b52a31eSHanoh Haim#elif defined __linux__
3268b52a31eSHanoh Haim#define GTEST_OS_LINUX 1
3278b52a31eSHanoh Haim#elif defined __MVS__
3288b52a31eSHanoh Haim#define GTEST_OS_ZOS 1
3298b52a31eSHanoh Haim#elif defined(__sun) && defined(__SVR4)
3308b52a31eSHanoh Haim#define GTEST_OS_SOLARIS 1
3318b52a31eSHanoh Haim#elif defined(_AIX)
3328b52a31eSHanoh Haim#define GTEST_OS_AIX 1
3338b52a31eSHanoh Haim#endif  // __CYGWIN__
3348b52a31eSHanoh Haim
3358b52a31eSHanoh Haim#if GTEST_OS_CYGWIN || GTEST_OS_LINUX || GTEST_OS_MAC || GTEST_OS_SYMBIAN || \
3368b52a31eSHanoh Haim    GTEST_OS_SOLARIS || GTEST_OS_AIX
3378b52a31eSHanoh Haim
3388b52a31eSHanoh Haim// On some platforms, <regex.h> needs someone to define size_t, and
3398b52a31eSHanoh Haim// won't compile otherwise.  We can #include it here as we already
3408b52a31eSHanoh Haim// included <stdlib.h>, which is guaranteed to define size_t through
3418b52a31eSHanoh Haim// <stddef.h>.
3428b52a31eSHanoh Haim#include <regex.h>  // NOLINT
3438b52a31eSHanoh Haim#include <strings.h>  // NOLINT
3448b52a31eSHanoh Haim#include <sys/types.h>  // NOLINT
3458b52a31eSHanoh Haim#include <time.h>  // NOLINT
3468b52a31eSHanoh Haim#include <unistd.h>  // NOLINT
3478b52a31eSHanoh Haim
3488b52a31eSHanoh Haim#define GTEST_USES_POSIX_RE 1
3498b52a31eSHanoh Haim
3508b52a31eSHanoh Haim#elif GTEST_OS_WINDOWS
3518b52a31eSHanoh Haim
3528b52a31eSHanoh Haim#if !GTEST_OS_WINDOWS_MOBILE
3538b52a31eSHanoh Haim#include <direct.h>  // NOLINT
3548b52a31eSHanoh Haim#include <io.h>  // NOLINT
3558b52a31eSHanoh Haim#endif
3568b52a31eSHanoh Haim
3578b52a31eSHanoh Haim// <regex.h> is not available on Windows.  Use our own simple regex
3588b52a31eSHanoh Haim// implementation instead.
3598b52a31eSHanoh Haim#define GTEST_USES_SIMPLE_RE 1
3608b52a31eSHanoh Haim
3618b52a31eSHanoh Haim#else
3628b52a31eSHanoh Haim
3638b52a31eSHanoh Haim// <regex.h> may not be available on this platform.  Use our own
3648b52a31eSHanoh Haim// simple regex implementation instead.
3658b52a31eSHanoh Haim#define GTEST_USES_SIMPLE_RE 1
3668b52a31eSHanoh Haim
3678b52a31eSHanoh Haim#endif  // GTEST_OS_CYGWIN || GTEST_OS_LINUX || GTEST_OS_MAC ||
3688b52a31eSHanoh Haim        // GTEST_OS_SYMBIAN || GTEST_OS_SOLARIS || GTEST_OS_AIX
3698b52a31eSHanoh Haim
3708b52a31eSHanoh Haim#ifndef GTEST_HAS_EXCEPTIONS
3718b52a31eSHanoh Haim// The user didn't tell us whether exceptions are enabled, so we need
3728b52a31eSHanoh Haim// to figure it out.
3738b52a31eSHanoh Haim#if defined(_MSC_VER) || defined(__BORLANDC__)
3748b52a31eSHanoh Haim// MSVC's and C++Builder's implementations of the STL use the _HAS_EXCEPTIONS
3758b52a31eSHanoh Haim// macro to enable exceptions, so we'll do the same.
3768b52a31eSHanoh Haim// Assumes that exceptions are enabled by default.
3778b52a31eSHanoh Haim#ifndef _HAS_EXCEPTIONS
3788b52a31eSHanoh Haim#define _HAS_EXCEPTIONS 1
3798b52a31eSHanoh Haim#endif  // _HAS_EXCEPTIONS
3808b52a31eSHanoh Haim#define GTEST_HAS_EXCEPTIONS _HAS_EXCEPTIONS
3818b52a31eSHanoh Haim#elif defined(__GNUC__) && __EXCEPTIONS
3828b52a31eSHanoh Haim// gcc defines __EXCEPTIONS to 1 iff exceptions are enabled.
3838b52a31eSHanoh Haim#define GTEST_HAS_EXCEPTIONS 1
3848b52a31eSHanoh Haim#elif defined(__SUNPRO_CC)
3858b52a31eSHanoh Haim// Sun Pro CC supports exceptions.  However, there is no compile-time way of
3868b52a31eSHanoh Haim// detecting whether they are enabled or not.  Therefore, we assume that
3878b52a31eSHanoh Haim// they are enabled unless the user tells us otherwise.
3888b52a31eSHanoh Haim#define GTEST_HAS_EXCEPTIONS 1
3898b52a31eSHanoh Haim#elif defined(__IBMCPP__) && __EXCEPTIONS
3908b52a31eSHanoh Haim// xlC defines __EXCEPTIONS to 1 iff exceptions are enabled.
3918b52a31eSHanoh Haim#define GTEST_HAS_EXCEPTIONS 1
3928b52a31eSHanoh Haim#else
3938b52a31eSHanoh Haim// For other compilers, we assume exceptions are disabled to be
3948b52a31eSHanoh Haim// conservative.
3958b52a31eSHanoh Haim#define GTEST_HAS_EXCEPTIONS 0
3968b52a31eSHanoh Haim#endif  // defined(_MSC_VER) || defined(__BORLANDC__)
3978b52a31eSHanoh Haim#endif  // GTEST_HAS_EXCEPTIONS
3988b52a31eSHanoh Haim
3998b52a31eSHanoh Haim#if !defined(GTEST_HAS_STD_STRING)
4008b52a31eSHanoh Haim// Even though we don't use this macro any longer, we keep it in case
4018b52a31eSHanoh Haim// some clients still depend on it.
4028b52a31eSHanoh Haim
4038b52a31eSHanoh Haim#if !defined OCTEON_BUILD
4048b52a31eSHanoh Haim#define GTEST_HAS_STD_STRING 1
4058b52a31eSHanoh Haim#endif
4068b52a31eSHanoh Haim
4078b52a31eSHanoh Haim
4088b52a31eSHanoh Haim#elif !GTEST_HAS_STD_STRING
4098b52a31eSHanoh Haim// The user told us that ::std::string isn't available.
4108b52a31eSHanoh Haim#error "Google Test cannot be used where ::std::string isn't available."
4118b52a31eSHanoh Haim#endif  // !defined(GTEST_HAS_STD_STRING)
4128b52a31eSHanoh Haim
4138b52a31eSHanoh Haim#ifndef GTEST_HAS_GLOBAL_STRING
4148b52a31eSHanoh Haim// The user didn't tell us whether ::string is available, so we need
4158b52a31eSHanoh Haim// to figure it out.
4168b52a31eSHanoh Haim
4178b52a31eSHanoh Haim#define GTEST_HAS_GLOBAL_STRING 0
4188b52a31eSHanoh Haim
4198b52a31eSHanoh Haim#endif  // GTEST_HAS_GLOBAL_STRING
4208b52a31eSHanoh Haim
4218b52a31eSHanoh Haim#ifndef GTEST_HAS_STD_WSTRING
4228b52a31eSHanoh Haim// The user didn't tell us whether ::std::wstring is available, so we need
4238b52a31eSHanoh Haim// to figure it out.
4248b52a31eSHanoh Haim// TODO(wan@google.com): uses autoconf to detect whether ::std::wstring
4258b52a31eSHanoh Haim//   is available.
4268b52a31eSHanoh Haim
4278b52a31eSHanoh Haim// Cygwin 1.5 and below doesn't support ::std::wstring.
4288b52a31eSHanoh Haim// Cygwin 1.7 might add wstring support; this should be updated when clear.
4298b52a31eSHanoh Haim// Solaris' libc++ doesn't support it either.
4308b52a31eSHanoh Haim
4318b52a31eSHanoh Haim#if !defined OCTEON_BUILD
4328b52a31eSHanoh Haim#define GTEST_HAS_STD_WSTRING (!(GTEST_OS_CYGWIN || GTEST_OS_SOLARIS))
4338b52a31eSHanoh Haim#endif
4348b52a31eSHanoh Haim
4358b52a31eSHanoh Haim#endif  // GTEST_HAS_STD_WSTRING
4368b52a31eSHanoh Haim
4378b52a31eSHanoh Haim#ifndef GTEST_HAS_GLOBAL_WSTRING
4388b52a31eSHanoh Haim// The user didn't tell us whether ::wstring is available, so we need
4398b52a31eSHanoh Haim// to figure it out.
4408b52a31eSHanoh Haim#define GTEST_HAS_GLOBAL_WSTRING \
4418b52a31eSHanoh Haim    (GTEST_HAS_STD_WSTRING && GTEST_HAS_GLOBAL_STRING)
4428b52a31eSHanoh Haim#endif  // GTEST_HAS_GLOBAL_WSTRING
4438b52a31eSHanoh Haim
4448b52a31eSHanoh Haim// Determines whether RTTI is available.
4458b52a31eSHanoh Haim#ifndef GTEST_HAS_RTTI
4468b52a31eSHanoh Haim// The user didn't tell us whether RTTI is enabled, so we need to
4478b52a31eSHanoh Haim// figure it out.
4488b52a31eSHanoh Haim
4498b52a31eSHanoh Haim#ifdef _MSC_VER
4508b52a31eSHanoh Haim
4518b52a31eSHanoh Haim#ifdef _CPPRTTI  // MSVC defines this macro iff RTTI is enabled.
4528b52a31eSHanoh Haim#define GTEST_HAS_RTTI 1
4538b52a31eSHanoh Haim#else
4548b52a31eSHanoh Haim#define GTEST_HAS_RTTI 0
4558b52a31eSHanoh Haim#endif
4568b52a31eSHanoh Haim
4578b52a31eSHanoh Haim// Starting with version 4.3.2, gcc defines __GXX_RTTI iff RTTI is enabled.
4588b52a31eSHanoh Haim#elif defined(__GNUC__) && (GTEST_GCC_VER_ >= 40302)
4598b52a31eSHanoh Haim
4608b52a31eSHanoh Haim#ifdef __GXX_RTTI
4618b52a31eSHanoh Haim#define GTEST_HAS_RTTI 1
4628b52a31eSHanoh Haim#else
4638b52a31eSHanoh Haim#define GTEST_HAS_RTTI 0
4648b52a31eSHanoh Haim#endif  // __GXX_RTTI
4658b52a31eSHanoh Haim
4668b52a31eSHanoh Haim// Starting with version 9.0 IBM Visual Age defines __RTTI_ALL__ to 1 if
4678b52a31eSHanoh Haim// both the typeid and dynamic_cast features are present.
4688b52a31eSHanoh Haim#elif defined(__IBMCPP__) && (__IBMCPP__ >= 900)
4698b52a31eSHanoh Haim
4708b52a31eSHanoh Haim#ifdef __RTTI_ALL__
4718b52a31eSHanoh Haim#define GTEST_HAS_RTTI 1
4728b52a31eSHanoh Haim#else
4738b52a31eSHanoh Haim#define GTEST_HAS_RTTI 0
4748b52a31eSHanoh Haim#endif
4758b52a31eSHanoh Haim
4768b52a31eSHanoh Haim#else
4778b52a31eSHanoh Haim
4788b52a31eSHanoh Haim// For all other compilers, we assume RTTI is enabled.
4798b52a31eSHanoh Haim#define GTEST_HAS_RTTI 1
4808b52a31eSHanoh Haim
4818b52a31eSHanoh Haim#endif  // _MSC_VER
4828b52a31eSHanoh Haim
4838b52a31eSHanoh Haim#endif  // GTEST_HAS_RTTI
4848b52a31eSHanoh Haim
4858b52a31eSHanoh Haim// It's this header's responsibility to #include <typeinfo> when RTTI
4868b52a31eSHanoh Haim// is enabled.
4878b52a31eSHanoh Haim#if GTEST_HAS_RTTI
4888b52a31eSHanoh Haim#include <typeinfo>
4898b52a31eSHanoh Haim#endif
4908b52a31eSHanoh Haim
4918b52a31eSHanoh Haim// Determines whether Google Test can use the pthreads library.
4928b52a31eSHanoh Haim#ifndef GTEST_HAS_PTHREAD
4938b52a31eSHanoh Haim// The user didn't tell us explicitly, so we assume pthreads support is
4948b52a31eSHanoh Haim// available on Linux and Mac.
4958b52a31eSHanoh Haim//
4968b52a31eSHanoh Haim// To disable threading support in Google Test, add -DGTEST_HAS_PTHREAD=0
4978b52a31eSHanoh Haim// to your compiler flags.
4988b52a31eSHanoh Haim#define GTEST_HAS_PTHREAD (GTEST_OS_LINUX || GTEST_OS_MAC)
4998b52a31eSHanoh Haim#endif  // GTEST_HAS_PTHREAD
5008b52a31eSHanoh Haim
5018b52a31eSHanoh Haim// Determines whether Google Test can use tr1/tuple.  You can define
5028b52a31eSHanoh Haim// this macro to 0 to prevent Google Test from using tuple (any
5038b52a31eSHanoh Haim// feature depending on tuple with be disabled in this mode).
5048b52a31eSHanoh Haim#ifndef GTEST_HAS_TR1_TUPLE
5058b52a31eSHanoh Haim// The user didn't tell us not to do it, so we assume it's OK.
5068b52a31eSHanoh Haim#define GTEST_HAS_TR1_TUPLE 1
5078b52a31eSHanoh Haim#endif  // GTEST_HAS_TR1_TUPLE
5088b52a31eSHanoh Haim
5098b52a31eSHanoh Haim// Determines whether Google Test's own tr1 tuple implementation
5108b52a31eSHanoh Haim// should be used.
5118b52a31eSHanoh Haim#ifndef GTEST_USE_OWN_TR1_TUPLE
5128b52a31eSHanoh Haim// The user didn't tell us, so we need to figure it out.
5138b52a31eSHanoh Haim
5148b52a31eSHanoh Haim// We use our own TR1 tuple if we aren't sure the user has an
5158b52a31eSHanoh Haim// implementation of it already.  At this time, GCC 4.0.0+ and MSVC
5168b52a31eSHanoh Haim// 2010 are the only mainstream compilers that come with a TR1 tuple
5178b52a31eSHanoh Haim// implementation.  NVIDIA's CUDA NVCC compiler pretends to be GCC by
5188b52a31eSHanoh Haim// defining __GNUC__ and friends, but cannot compile GCC's tuple
5198b52a31eSHanoh Haim// implementation.  MSVC 2008 (9.0) provides TR1 tuple in a 323 MB
5208b52a31eSHanoh Haim// Feature Pack download, which we cannot assume the user has.
5218b52a31eSHanoh Haim#if (defined(__GNUC__) && !defined(__CUDACC__) && (GTEST_GCC_VER_ >= 40000)) \
5228b52a31eSHanoh Haim    || _MSC_VER >= 1600
5238b52a31eSHanoh Haim#define GTEST_USE_OWN_TR1_TUPLE 0
5248b52a31eSHanoh Haim#else
5258b52a31eSHanoh Haim#define GTEST_USE_OWN_TR1_TUPLE 1
5268b52a31eSHanoh Haim#endif
5278b52a31eSHanoh Haim
5288b52a31eSHanoh Haim#endif  // GTEST_USE_OWN_TR1_TUPLE
5298b52a31eSHanoh Haim
5308b52a31eSHanoh Haim// To avoid conditional compilation everywhere, we make it
5318b52a31eSHanoh Haim// gtest-port.h's responsibility to #include the header implementing
5328b52a31eSHanoh Haim// tr1/tuple.
5338b52a31eSHanoh Haim#if GTEST_HAS_TR1_TUPLE
5348b52a31eSHanoh Haim
5358b52a31eSHanoh Haim#if GTEST_USE_OWN_TR1_TUPLE
5368b52a31eSHanoh Haim// This file was GENERATED by a script.  DO NOT EDIT BY HAND!!!
5378b52a31eSHanoh Haim
5388b52a31eSHanoh Haim// Copyright 2009 Google Inc.
5398b52a31eSHanoh Haim// All Rights Reserved.
5408b52a31eSHanoh Haim//
5418b52a31eSHanoh Haim// Redistribution and use in source and binary forms, with or without
5428b52a31eSHanoh Haim// modification, are permitted provided that the following conditions are
5438b52a31eSHanoh Haim// met:
5448b52a31eSHanoh Haim//
5458b52a31eSHanoh Haim//     * Redistributions of source code must retain the above copyright
5468b52a31eSHanoh Haim// notice, this list of conditions and the following disclaimer.
5478b52a31eSHanoh Haim//     * Redistributions in binary form must reproduce the above
5488b52a31eSHanoh Haim// copyright notice, this list of conditions and the following disclaimer
5498b52a31eSHanoh Haim// in the documentation and/or other materials provided with the
5508b52a31eSHanoh Haim// distribution.
5518b52a31eSHanoh Haim//     * Neither the name of Google Inc. nor the names of its
5528b52a31eSHanoh Haim// contributors may be used to endorse or promote products derived from
5538b52a31eSHanoh Haim// this software without specific prior written permission.
5548b52a31eSHanoh Haim//
5558b52a31eSHanoh Haim// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
5568b52a31eSHanoh Haim// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
5578b52a31eSHanoh Haim// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
5588b52a31eSHanoh Haim// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
5598b52a31eSHanoh Haim// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
5608b52a31eSHanoh Haim// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
5618b52a31eSHanoh Haim// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
5628b52a31eSHanoh Haim// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
5638b52a31eSHanoh Haim// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
5648b52a31eSHanoh Haim// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
5658b52a31eSHanoh Haim// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
5668b52a31eSHanoh Haim//
5678b52a31eSHanoh Haim// Author: wan@google.com (Zhanyong Wan)
5688b52a31eSHanoh Haim
5698b52a31eSHanoh Haim// Implements a subset of TR1 tuple needed by Google Test and Google Mock.
5708b52a31eSHanoh Haim
5718b52a31eSHanoh Haim#ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_TUPLE_H_
5728b52a31eSHanoh Haim#define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_TUPLE_H_
5738b52a31eSHanoh Haim
5748b52a31eSHanoh Haim#include <utility>  // For ::std::pair.
5758b52a31eSHanoh Haim
5768b52a31eSHanoh Haim// The compiler used in Symbian has a bug that prevents us from declaring the
5778b52a31eSHanoh Haim// tuple template as a friend (it complains that tuple is redefined).  This
5788b52a31eSHanoh Haim// hack bypasses the bug by declaring the members that should otherwise be
5798b52a31eSHanoh Haim// private as public.
5808b52a31eSHanoh Haim// Sun Studio versions < 12 also have the above bug.
5818b52a31eSHanoh Haim#if defined(__SYMBIAN32__) || (defined(__SUNPRO_CC) && __SUNPRO_CC < 0x590)
5828b52a31eSHanoh Haim#define GTEST_DECLARE_TUPLE_AS_FRIEND_ public:
5838b52a31eSHanoh Haim#else
5848b52a31eSHanoh Haim#define GTEST_DECLARE_TUPLE_AS_FRIEND_ \
5858b52a31eSHanoh Haim    template <GTEST_10_TYPENAMES_(U)> friend class tuple; \
5868b52a31eSHanoh Haim   private:
5878b52a31eSHanoh Haim#endif
5888b52a31eSHanoh Haim
5898b52a31eSHanoh Haim// GTEST_n_TUPLE_(T) is the type of an n-tuple.
5908b52a31eSHanoh Haim#define GTEST_0_TUPLE_(T) tuple<>
5918b52a31eSHanoh Haim#define GTEST_1_TUPLE_(T) tuple<T##0, void, void, void, void, void, void, \
5928b52a31eSHanoh Haim    void, void, void>
5938b52a31eSHanoh Haim#define GTEST_2_TUPLE_(T) tuple<T##0, T##1, void, void, void, void, void, \
5948b52a31eSHanoh Haim    void, void, void>
5958b52a31eSHanoh Haim#define GTEST_3_TUPLE_(T) tuple<T##0, T##1, T##2, void, void, void, void, \
5968b52a31eSHanoh Haim    void, void, void>
5978b52a31eSHanoh Haim#define GTEST_4_TUPLE_(T) tuple<T##0, T##1, T##2, T##3, void, void, void, \
5988b52a31eSHanoh Haim    void, void, void>
5998b52a31eSHanoh Haim#define GTEST_5_TUPLE_(T) tuple<T##0, T##1, T##2, T##3, T##4, void, void, \
6008b52a31eSHanoh Haim    void, void, void>
6018b52a31eSHanoh Haim#define GTEST_6_TUPLE_(T) tuple<T##0, T##1, T##2, T##3, T##4, T##5, void, \
6028b52a31eSHanoh Haim    void, void, void>
6038b52a31eSHanoh Haim#define GTEST_7_TUPLE_(T) tuple<T##0, T##1, T##2, T##3, T##4, T##5, T##6, \
6048b52a31eSHanoh Haim    void, void, void>
6058b52a31eSHanoh Haim#define GTEST_8_TUPLE_(T) tuple<T##0, T##1, T##2, T##3, T##4, T##5, T##6, \
6068b52a31eSHanoh Haim    T##7, void, void>
6078b52a31eSHanoh Haim#define GTEST_9_TUPLE_(T) tuple<T##0, T##1, T##2, T##3, T##4, T##5, T##6, \
6088b52a31eSHanoh Haim    T##7, T##8, void>
6098b52a31eSHanoh Haim#define GTEST_10_TUPLE_(T) tuple<T##0, T##1, T##2, T##3, T##4, T##5, T##6, \
6108b52a31eSHanoh Haim    T##7, T##8, T##9>
6118b52a31eSHanoh Haim
6128b52a31eSHanoh Haim// GTEST_n_TYPENAMES_(T) declares a list of n typenames.
6138b52a31eSHanoh Haim#define GTEST_0_TYPENAMES_(T)
6148b52a31eSHanoh Haim#define GTEST_1_TYPENAMES_(T) typename T##0
6158b52a31eSHanoh Haim#define GTEST_2_TYPENAMES_(T) typename T##0, typename T##1
6168b52a31eSHanoh Haim#define GTEST_3_TYPENAMES_(T) typename T##0, typename T##1, typename T##2
6178b52a31eSHanoh Haim#define GTEST_4_TYPENAMES_(T) typename T##0, typename T##1, typename T##2, \
6188b52a31eSHanoh Haim    typename T##3
6198b52a31eSHanoh Haim#define GTEST_5_TYPENAMES_(T) typename T##0, typename T##1, typename T##2, \
6208b52a31eSHanoh Haim    typename T##3, typename T##4
6218b52a31eSHanoh Haim#define GTEST_6_TYPENAMES_(T) typename T##0, typename T##1, typename T##2, \
6228b52a31eSHanoh Haim    typename T##3, typename T##4, typename T##5
6238b52a31eSHanoh Haim#define GTEST_7_TYPENAMES_(T) typename T##0, typename T##1, typename T##2, \
6248b52a31eSHanoh Haim    typename T##3, typename T##4, typename T##5, typename T##6
6258b52a31eSHanoh Haim#define GTEST_8_TYPENAMES_(T) typename T##0, typename T##1, typename T##2, \
6268b52a31eSHanoh Haim    typename T##3, typename T##4, typename T##5, typename T##6, typename T##7
6278b52a31eSHanoh Haim#define GTEST_9_TYPENAMES_(T) typename T##0, typename T##1, typename T##2, \
6288b52a31eSHanoh Haim    typename T##3, typename T##4, typename T##5, typename T##6, \
6298b52a31eSHanoh Haim    typename T##7, typename T##8
6308b52a31eSHanoh Haim#define GTEST_10_TYPENAMES_(T) typename T##0, typename T##1, typename T##2, \
6318b52a31eSHanoh Haim    typename T##3, typename T##4, typename T##5, typename T##6, \
6328b52a31eSHanoh Haim    typename T##7, typename T##8, typename T##9
6338b52a31eSHanoh Haim
6348b52a31eSHanoh Haim// In theory, defining stuff in the ::std namespace is undefined
6358b52a31eSHanoh Haim// behavior.  We can do this as we are playing the role of a standard
6368b52a31eSHanoh Haim// library vendor.
6378b52a31eSHanoh Haimnamespace std {
6388b52a31eSHanoh Haimnamespace tr1 {
6398b52a31eSHanoh Haim
6408b52a31eSHanoh Haimtemplate <typename T0 = void, typename T1 = void, typename T2 = void,
6418b52a31eSHanoh Haim    typename T3 = void, typename T4 = void, typename T5 = void,
6428b52a31eSHanoh Haim    typename T6 = void, typename T7 = void, typename T8 = void,
6438b52a31eSHanoh Haim    typename T9 = void>
6448b52a31eSHanoh Haimclass tuple;
6458b52a31eSHanoh Haim
6468b52a31eSHanoh Haim// Anything in namespace gtest_internal is Google Test's INTERNAL
6478b52a31eSHanoh Haim// IMPLEMENTATION DETAIL and MUST NOT BE USED DIRECTLY in user code.
6488b52a31eSHanoh Haimnamespace gtest_internal {
6498b52a31eSHanoh Haim
6508b52a31eSHanoh Haim// ByRef<T>::type is T if T is a reference; otherwise it's const T&.
6518b52a31eSHanoh Haimtemplate <typename T>
6528b52a31eSHanoh Haimstruct ByRef { typedef const T& type; };  // NOLINT
6538b52a31eSHanoh Haimtemplate <typename T>
6548b52a31eSHanoh Haimstruct ByRef<T&> { typedef T& type; };  // NOLINT
6558b52a31eSHanoh Haim
6568b52a31eSHanoh Haim// A handy wrapper for ByRef.
6578b52a31eSHanoh Haim#define GTEST_BY_REF_(T) typename ::std::tr1::gtest_internal::ByRef<T>::type
6588b52a31eSHanoh Haim
6598b52a31eSHanoh Haim// AddRef<T>::type is T if T is a reference; otherwise it's T&.  This
6608b52a31eSHanoh Haim// is the same as tr1::add_reference<T>::type.
6618b52a31eSHanoh Haimtemplate <typename T>
6628b52a31eSHanoh Haimstruct AddRef { typedef T& type; };  // NOLINT
6638b52a31eSHanoh Haimtemplate <typename T>
6648b52a31eSHanoh Haimstruct AddRef<T&> { typedef T& type; };  // NOLINT
6658b52a31eSHanoh Haim
6668b52a31eSHanoh Haim// A handy wrapper for AddRef.
6678b52a31eSHanoh Haim#define GTEST_ADD_REF_(T) typename ::std::tr1::gtest_internal::AddRef<T>::type
6688b52a31eSHanoh Haim
6698b52a31eSHanoh Haim// A helper for implementing get<k>().
6708b52a31eSHanoh Haimtemplate <int k> class Get;
6718b52a31eSHanoh Haim
6728b52a31eSHanoh Haim// A helper for implementing tuple_element<k, T>.  kIndexValid is true
6738b52a31eSHanoh Haim// iff k < the number of fields in tuple type T.
6748b52a31eSHanoh Haimtemplate <bool kIndexValid, int kIndex, class Tuple>
6758b52a31eSHanoh Haimstruct TupleElement;
6768b52a31eSHanoh Haim
6778b52a31eSHanoh Haimtemplate <GTEST_10_TYPENAMES_(T)>
6788b52a31eSHanoh Haimstruct TupleElement<true, 0, GTEST_10_TUPLE_(T)> { typedef T0 type; };
6798b52a31eSHanoh Haim
6808b52a31eSHanoh Haimtemplate <GTEST_10_TYPENAMES_(T)>
6818b52a31eSHanoh Haimstruct TupleElement<true, 1, GTEST_10_TUPLE_(T)> { typedef T1 type; };
6828b52a31eSHanoh Haim
6838b52a31eSHanoh Haimtemplate <GTEST_10_TYPENAMES_(T)>
6848b52a31eSHanoh Haimstruct TupleElement<true, 2, GTEST_10_TUPLE_(T)> { typedef T2 type; };
6858b52a31eSHanoh Haim
6868b52a31eSHanoh Haimtemplate <GTEST_10_TYPENAMES_(T)>
6878b52a31eSHanoh Haimstruct TupleElement<true, 3, GTEST_10_TUPLE_(T)> { typedef T3 type; };
6888b52a31eSHanoh Haim
6898b52a31eSHanoh Haimtemplate <GTEST_10_TYPENAMES_(T)>
6908b52a31eSHanoh Haimstruct TupleElement<true, 4, GTEST_10_TUPLE_(T)> { typedef T4 type; };
6918b52a31eSHanoh Haim
6928b52a31eSHanoh Haimtemplate <GTEST_10_TYPENAMES_(T)>
6938b52a31eSHanoh Haimstruct TupleElement<true, 5, GTEST_10_TUPLE_(T)> { typedef T5 type; };
6948b52a31eSHanoh Haim
6958b52a31eSHanoh Haimtemplate <GTEST_10_TYPENAMES_(T)>
6968b52a31eSHanoh Haimstruct TupleElement<true, 6, GTEST_10_TUPLE_(T)> { typedef T6 type; };
6978b52a31eSHanoh Haim
6988b52a31eSHanoh Haimtemplate <GTEST_10_TYPENAMES_(T)>
6998b52a31eSHanoh Haimstruct TupleElement<true, 7, GTEST_10_TUPLE_(T)> { typedef T7 type; };
7008b52a31eSHanoh Haim
7018b52a31eSHanoh Haimtemplate <GTEST_10_TYPENAMES_(T)>
7028b52a31eSHanoh Haimstruct TupleElement<true, 8, GTEST_10_TUPLE_(T)> { typedef T8 type; };
7038b52a31eSHanoh Haim
7048b52a31eSHanoh Haimtemplate <GTEST_10_TYPENAMES_(T)>
7058b52a31eSHanoh Haimstruct TupleElement<true, 9, GTEST_10_TUPLE_(T)> { typedef T9 type; };
7068b52a31eSHanoh Haim
7078b52a31eSHanoh Haim}  // namespace gtest_internal
7088b52a31eSHanoh Haim
7098b52a31eSHanoh Haimtemplate <>
7108b52a31eSHanoh Haimclass tuple<> {
7118b52a31eSHanoh Haim public:
7128b52a31eSHanoh Haim  tuple() {}
7138b52a31eSHanoh Haim  tuple(const tuple& /* t */)  {}
7148b52a31eSHanoh Haim  tuple& operator=(const tuple& /* t */) { return *this; }
7158b52a31eSHanoh Haim};
7168b52a31eSHanoh Haim
7178b52a31eSHanoh Haimtemplate <GTEST_1_TYPENAMES_(T)>
7188b52a31eSHanoh Haimclass GTEST_1_TUPLE_(T) {
7198b52a31eSHanoh Haim public:
7208b52a31eSHanoh Haim  template <int k> friend class gtest_internal::Get;
7218b52a31eSHanoh Haim
7228b52a31eSHanoh Haim  tuple() : f0_() {}
7238b52a31eSHanoh Haim
7248b52a31eSHanoh Haim  explicit tuple(GTEST_BY_REF_(T0) f0) : f0_(f0) {}
7258b52a31eSHanoh Haim
7268b52a31eSHanoh Haim  tuple(const tuple& t) : f0_(t.f0_) {}
7278b52a31eSHanoh Haim
7288b52a31eSHanoh Haim  template <GTEST_1_TYPENAMES_(U)>
7298b52a31eSHanoh Haim  tuple(const GTEST_1_TUPLE_(U)& t) : f0_(t.f0_) {}
7308b52a31eSHanoh Haim
7318b52a31eSHanoh Haim  tuple& operator=(const tuple& t) { return CopyFrom(t); }
7328b52a31eSHanoh Haim
7338b52a31eSHanoh Haim  template <GTEST_1_TYPENAMES_(U)>
7348b52a31eSHanoh Haim  tuple& operator=(const GTEST_1_TUPLE_(U)& t) {
7358b52a31eSHanoh Haim    return CopyFrom(t);
7368b52a31eSHanoh Haim  }
7378b52a31eSHanoh Haim
7388b52a31eSHanoh Haim  GTEST_DECLARE_TUPLE_AS_FRIEND_
7398b52a31eSHanoh Haim
7408b52a31eSHanoh Haim  template <GTEST_1_TYPENAMES_(U)>
7418b52a31eSHanoh Haim  tuple& CopyFrom(const GTEST_1_TUPLE_(U)& t) {
7428b52a31eSHanoh Haim    f0_ = t.f0_;
7438b52a31eSHanoh Haim    return *this;
7448b52a31eSHanoh Haim  }
7458b52a31eSHanoh Haim
7468b52a31eSHanoh Haim  T0 f0_;
7478b52a31eSHanoh Haim};
7488b52a31eSHanoh Haim
7498b52a31eSHanoh Haimtemplate <GTEST_2_TYPENAMES_(T)>
7508b52a31eSHanoh Haimclass GTEST_2_TUPLE_(T) {
7518b52a31eSHanoh Haim public:
7528b52a31eSHanoh Haim  template <int k> friend class gtest_internal::Get;
7538b52a31eSHanoh Haim
7548b52a31eSHanoh Haim  tuple() : f0_(), f1_() {}
7558b52a31eSHanoh Haim
7568b52a31eSHanoh Haim  explicit tuple(GTEST_BY_REF_(T0) f0, GTEST_BY_REF_(T1) f1) : f0_(f0),
7578b52a31eSHanoh Haim      f1_(f1) {}
7588b52a31eSHanoh Haim
7598b52a31eSHanoh Haim  tuple(const tuple& t) : f0_(t.f0_), f1_(t.f1_) {}
7608b52a31eSHanoh Haim
7618b52a31eSHanoh Haim  template <GTEST_2_TYPENAMES_(U)>
7628b52a31eSHanoh Haim  tuple(const GTEST_2_TUPLE_(U)& t) : f0_(t.f0_), f1_(t.f1_) {}
7638b52a31eSHanoh Haim  template <typename U0, typename U1>
7648b52a31eSHanoh Haim  tuple(const ::std::pair<U0, U1>& p) : f0_(p.first), f1_(p.second) {}
7658b52a31eSHanoh Haim
7668b52a31eSHanoh Haim  tuple& operator=(const tuple& t) { return CopyFrom(t); }
7678b52a31eSHanoh Haim
7688b52a31eSHanoh Haim  template <GTEST_2_TYPENAMES_(U)>
7698b52a31eSHanoh Haim  tuple& operator=(const GTEST_2_TUPLE_(U)& t) {
7708b52a31eSHanoh Haim    return CopyFrom(t);
7718b52a31eSHanoh Haim  }
7728b52a31eSHanoh Haim  template <typename U0, typename U1>
7738b52a31eSHanoh Haim  tuple& operator=(const ::std::pair<U0, U1>& p) {
7748b52a31eSHanoh Haim    f0_ = p.first;
7758b52a31eSHanoh Haim    f1_ = p.second;
7768b52a31eSHanoh Haim    return *this;
7778b52a31eSHanoh Haim  }
7788b52a31eSHanoh Haim
7798b52a31eSHanoh Haim  GTEST_DECLARE_TUPLE_AS_FRIEND_
7808b52a31eSHanoh Haim
7818b52a31eSHanoh Haim  template <GTEST_2_TYPENAMES_(U)>
7828b52a31eSHanoh Haim  tuple& CopyFrom(const GTEST_2_TUPLE_(U)& t) {
7838b52a31eSHanoh Haim    f0_ = t.f0_;
7848b52a31eSHanoh Haim    f1_ = t.f1_;
7858b52a31eSHanoh Haim    return *this;
7868b52a31eSHanoh Haim  }
7878b52a31eSHanoh Haim
7888b52a31eSHanoh Haim  T0 f0_;
7898b52a31eSHanoh Haim  T1 f1_;
7908b52a31eSHanoh Haim};
7918b52a31eSHanoh Haim
7928b52a31eSHanoh Haimtemplate <GTEST_3_TYPENAMES_(T)>
7938b52a31eSHanoh Haimclass GTEST_3_TUPLE_(T) {
7948b52a31eSHanoh Haim public:
7958b52a31eSHanoh Haim  template <int k> friend class gtest_internal::Get;
7968b52a31eSHanoh Haim
7978b52a31eSHanoh Haim  tuple() : f0_(), f1_(), f2_() {}
7988b52a31eSHanoh Haim
7998b52a31eSHanoh Haim  explicit tuple(GTEST_BY_REF_(T0) f0, GTEST_BY_REF_(T1) f1,
8008b52a31eSHanoh Haim      GTEST_BY_REF_(T2) f2) : f0_(f0), f1_(f1), f2_(f2) {}
8018b52a31eSHanoh Haim
8028b52a31eSHanoh Haim  tuple(const tuple& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_) {}
8038b52a31eSHanoh Haim
8048b52a31eSHanoh Haim  template <GTEST_3_TYPENAMES_(U)>
8058b52a31eSHanoh Haim  tuple(const GTEST_3_TUPLE_(U)& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_) {}
8068b52a31eSHanoh Haim
8078b52a31eSHanoh Haim  tuple& operator=(const tuple& t) { return CopyFrom(t); }
8088b52a31eSHanoh Haim
8098b52a31eSHanoh Haim  template <GTEST_3_TYPENAMES_(U)>
8108b52a31eSHanoh Haim  tuple& operator=(const GTEST_3_TUPLE_(U)& t) {
8118b52a31eSHanoh Haim    return CopyFrom(t);
8128b52a31eSHanoh Haim  }
8138b52a31eSHanoh Haim
8148b52a31eSHanoh Haim  GTEST_DECLARE_TUPLE_AS_FRIEND_
8158b52a31eSHanoh Haim
8168b52a31eSHanoh Haim  template <GTEST_3_TYPENAMES_(U)>
8178b52a31eSHanoh Haim  tuple& CopyFrom(const GTEST_3_TUPLE_(U)& t) {
8188b52a31eSHanoh Haim    f0_ = t.f0_;
8198b52a31eSHanoh Haim    f1_ = t.f1_;
8208b52a31eSHanoh Haim    f2_ = t.f2_;
8218b52a31eSHanoh Haim    return *this;
8228b52a31eSHanoh Haim  }
8238b52a31eSHanoh Haim
8248b52a31eSHanoh Haim  T0 f0_;
8258b52a31eSHanoh Haim  T1 f1_;
8268b52a31eSHanoh Haim  T2 f2_;
8278b52a31eSHanoh Haim};
8288b52a31eSHanoh Haim
8298b52a31eSHanoh Haimtemplate <GTEST_4_TYPENAMES_(T)>
8308b52a31eSHanoh Haimclass GTEST_4_TUPLE_(T) {
8318b52a31eSHanoh Haim public:
8328b52a31eSHanoh Haim  template <int k> friend class gtest_internal::Get;
8338b52a31eSHanoh Haim
8348b52a31eSHanoh Haim  tuple() : f0_(), f1_(), f2_(), f3_() {}
8358b52a31eSHanoh Haim
8368b52a31eSHanoh Haim  explicit tuple(GTEST_BY_REF_(T0) f0, GTEST_BY_REF_(T1) f1,
8378b52a31eSHanoh Haim      GTEST_BY_REF_(T2) f2, GTEST_BY_REF_(T3) f3) : f0_(f0), f1_(f1), f2_(f2),
8388b52a31eSHanoh Haim      f3_(f3) {}
8398b52a31eSHanoh Haim
8408b52a31eSHanoh Haim  tuple(const tuple& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_), f3_(t.f3_) {}
8418b52a31eSHanoh Haim
8428b52a31eSHanoh Haim  template <GTEST_4_TYPENAMES_(U)>
8438b52a31eSHanoh Haim  tuple(const GTEST_4_TUPLE_(U)& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_),
8448b52a31eSHanoh Haim      f3_(t.f3_) {}
8458b52a31eSHanoh Haim
8468b52a31eSHanoh Haim  tuple& operator=(const tuple& t) { return CopyFrom(t); }
8478b52a31eSHanoh Haim
8488b52a31eSHanoh Haim  template <GTEST_4_TYPENAMES_(U)>
8498b52a31eSHanoh Haim  tuple& operator=(const GTEST_4_TUPLE_(U)& t) {
8508b52a31eSHanoh Haim    return CopyFrom(t);
8518b52a31eSHanoh Haim  }
8528b52a31eSHanoh Haim
8538b52a31eSHanoh Haim  GTEST_DECLARE_TUPLE_AS_FRIEND_
8548b52a31eSHanoh Haim
8558b52a31eSHanoh Haim  template <GTEST_4_TYPENAMES_(U)>
8568b52a31eSHanoh Haim  tuple& CopyFrom(const GTEST_4_TUPLE_(U)& t) {
8578b52a31eSHanoh Haim    f0_ = t.f0_;
8588b52a31eSHanoh Haim    f1_ = t.f1_;
8598b52a31eSHanoh Haim    f2_ = t.f2_;
8608b52a31eSHanoh Haim    f3_ = t.f3_;
8618b52a31eSHanoh Haim    return *this;
8628b52a31eSHanoh Haim  }
8638b52a31eSHanoh Haim
8648b52a31eSHanoh Haim  T0 f0_;
8658b52a31eSHanoh Haim  T1 f1_;
8668b52a31eSHanoh Haim  T2 f2_;
8678b52a31eSHanoh Haim  T3 f3_;
8688b52a31eSHanoh Haim};
8698b52a31eSHanoh Haim
8708b52a31eSHanoh Haimtemplate <GTEST_5_TYPENAMES_(T)>
8718b52a31eSHanoh Haimclass GTEST_5_TUPLE_(T) {
8728b52a31eSHanoh Haim public:
8738b52a31eSHanoh Haim  template <int k> friend class gtest_internal::Get;
8748b52a31eSHanoh Haim
8758b52a31eSHanoh Haim  tuple() : f0_(), f1_(), f2_(), f3_(), f4_() {}
8768b52a31eSHanoh Haim
8778b52a31eSHanoh Haim  explicit tuple(GTEST_BY_REF_(T0) f0, GTEST_BY_REF_(T1) f1,
8788b52a31eSHanoh Haim      GTEST_BY_REF_(T2) f2, GTEST_BY_REF_(T3) f3,
8798b52a31eSHanoh Haim      GTEST_BY_REF_(T4) f4) : f0_(f0), f1_(f1), f2_(f2), f3_(f3), f4_(f4) {}
8808b52a31eSHanoh Haim
8818b52a31eSHanoh Haim  tuple(const tuple& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_), f3_(t.f3_),
8828b52a31eSHanoh Haim      f4_(t.f4_) {}
8838b52a31eSHanoh Haim
8848b52a31eSHanoh Haim  template <GTEST_5_TYPENAMES_(U)>
8858b52a31eSHanoh Haim  tuple(const GTEST_5_TUPLE_(U)& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_),
8868b52a31eSHanoh Haim      f3_(t.f3_), f4_(t.f4_) {}
8878b52a31eSHanoh Haim
8888b52a31eSHanoh Haim  tuple& operator=(const tuple& t) { return CopyFrom(t); }
8898b52a31eSHanoh Haim
8908b52a31eSHanoh Haim  template <GTEST_5_TYPENAMES_(U)>
8918b52a31eSHanoh Haim  tuple& operator=(const GTEST_5_TUPLE_(U)& t) {
8928b52a31eSHanoh Haim    return CopyFrom(t);
8938b52a31eSHanoh Haim  }
8948b52a31eSHanoh Haim
8958b52a31eSHanoh Haim  GTEST_DECLARE_TUPLE_AS_FRIEND_
8968b52a31eSHanoh Haim
8978b52a31eSHanoh Haim  template <GTEST_5_TYPENAMES_(U)>
8988b52a31eSHanoh Haim  tuple& CopyFrom(const GTEST_5_TUPLE_(U)& t) {
8998b52a31eSHanoh Haim    f0_ = t.f0_;
9008b52a31eSHanoh Haim    f1_ = t.f1_;
9018b52a31eSHanoh Haim    f2_ = t.f2_;
9028b52a31eSHanoh Haim    f3_ = t.f3_;
9038b52a31eSHanoh Haim    f4_ = t.f4_;
9048b52a31eSHanoh Haim    return *this;
9058b52a31eSHanoh Haim  }
9068b52a31eSHanoh Haim
9078b52a31eSHanoh Haim  T0 f0_;
9088b52a31eSHanoh Haim  T1 f1_;
9098b52a31eSHanoh Haim  T2 f2_;
9108b52a31eSHanoh Haim  T3 f3_;
9118b52a31eSHanoh Haim  T4 f4_;
9128b52a31eSHanoh Haim};
9138b52a31eSHanoh Haim
9148b52a31eSHanoh Haimtemplate <GTEST_6_TYPENAMES_(T)>
9158b52a31eSHanoh Haimclass GTEST_6_TUPLE_(T) {
9168b52a31eSHanoh Haim public:
9178b52a31eSHanoh Haim  template <int k> friend class gtest_internal::Get;
9188b52a31eSHanoh Haim
9198b52a31eSHanoh Haim  tuple() : f0_(), f1_(), f2_(), f3_(), f4_(), f5_() {}
9208b52a31eSHanoh Haim
9218b52a31eSHanoh Haim  explicit tuple(GTEST_BY_REF_(T0) f0, GTEST_BY_REF_(T1) f1,
9228b52a31eSHanoh Haim      GTEST_BY_REF_(T2) f2, GTEST_BY_REF_(T3) f3, GTEST_BY_REF_(T4) f4,
9238b52a31eSHanoh Haim      GTEST_BY_REF_(T5) f5) : f0_(f0), f1_(f1), f2_(f2), f3_(f3), f4_(f4),
9248b52a31eSHanoh Haim      f5_(f5) {}
9258b52a31eSHanoh Haim
9268b52a31eSHanoh Haim  tuple(const tuple& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_), f3_(t.f3_),
9278b52a31eSHanoh Haim      f4_(t.f4_), f5_(t.f5_) {}
9288b52a31eSHanoh Haim
9298b52a31eSHanoh Haim  template <GTEST_6_TYPENAMES_(U)>
9308b52a31eSHanoh Haim  tuple(const GTEST_6_TUPLE_(U)& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_),
9318b52a31eSHanoh Haim      f3_(t.f3_), f4_(t.f4_), f5_(t.f5_) {}
9328b52a31eSHanoh Haim
9338b52a31eSHanoh Haim  tuple& operator=(const tuple& t) { return CopyFrom(t); }
9348b52a31eSHanoh Haim
9358b52a31eSHanoh Haim  template <GTEST_6_TYPENAMES_(U)>
9368b52a31eSHanoh Haim  tuple& operator=(const GTEST_6_TUPLE_(U)& t) {
9378b52a31eSHanoh Haim    return CopyFrom(t);
9388b52a31eSHanoh Haim  }
9398b52a31eSHanoh Haim
9408b52a31eSHanoh Haim  GTEST_DECLARE_TUPLE_AS_FRIEND_
9418b52a31eSHanoh Haim
9428b52a31eSHanoh Haim  template <GTEST_6_TYPENAMES_(U)>
9438b52a31eSHanoh Haim  tuple& CopyFrom(const GTEST_6_TUPLE_(U)& t) {
9448b52a31eSHanoh Haim    f0_ = t.f0_;
9458b52a31eSHanoh Haim    f1_ = t.f1_;
9468b52a31eSHanoh Haim    f2_ = t.f2_;
9478b52a31eSHanoh Haim    f3_ = t.f3_;
9488b52a31eSHanoh Haim    f4_ = t.f4_;
9498b52a31eSHanoh Haim    f5_ = t.f5_;
9508b52a31eSHanoh Haim    return *this;
9518b52a31eSHanoh Haim  }
9528b52a31eSHanoh Haim
9538b52a31eSHanoh Haim  T0 f0_;
9548b52a31eSHanoh Haim  T1 f1_;
9558b52a31eSHanoh Haim  T2 f2_;
9568b52a31eSHanoh Haim  T3 f3_;
9578b52a31eSHanoh Haim  T4 f4_;
9588b52a31eSHanoh Haim  T5 f5_;
9598b52a31eSHanoh Haim};
9608b52a31eSHanoh Haim
9618b52a31eSHanoh Haimtemplate <GTEST_7_TYPENAMES_(T)>
9628b52a31eSHanoh Haimclass GTEST_7_TUPLE_(T) {
9638b52a31eSHanoh Haim public:
9648b52a31eSHanoh Haim  template <int k> friend class gtest_internal::Get;
9658b52a31eSHanoh Haim
9668b52a31eSHanoh Haim  tuple() : f0_(), f1_(), f2_(), f3_(), f4_(), f5_(), f6_() {}
9678b52a31eSHanoh Haim
9688b52a31eSHanoh Haim  explicit tuple(GTEST_BY_REF_(T0) f0, GTEST_BY_REF_(T1) f1,
9698b52a31eSHanoh Haim      GTEST_BY_REF_(T2) f2, GTEST_BY_REF_(T3) f3, GTEST_BY_REF_(T4) f4,
9708b52a31eSHanoh Haim      GTEST_BY_REF_(T5) f5, GTEST_BY_REF_(T6) f6) : f0_(f0), f1_(f1), f2_(f2),
9718b52a31eSHanoh Haim      f3_(f3), f4_(f4), f5_(f5), f6_(f6) {}
9728b52a31eSHanoh Haim
9738b52a31eSHanoh Haim  tuple(const tuple& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_), f3_(t.f3_),
9748b52a31eSHanoh Haim      f4_(t.f4_), f5_(t.f5_), f6_(t.f6_) {}
9758b52a31eSHanoh Haim
9768b52a31eSHanoh Haim  template <GTEST_7_TYPENAMES_(U)>
9778b52a31eSHanoh Haim  tuple(const GTEST_7_TUPLE_(U)& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_),
9788b52a31eSHanoh Haim      f3_(t.f3_), f4_(t.f4_), f5_(t.f5_), f6_(t.f6_) {}
9798b52a31eSHanoh Haim
9808b52a31eSHanoh Haim  tuple& operator=(const tuple& t) { return CopyFrom(t); }
9818b52a31eSHanoh Haim
9828b52a31eSHanoh Haim  template <GTEST_7_TYPENAMES_(U)>
9838b52a31eSHanoh Haim  tuple& operator=(const GTEST_7_TUPLE_(U)& t) {
9848b52a31eSHanoh Haim    return CopyFrom(t);
9858b52a31eSHanoh Haim  }
9868b52a31eSHanoh Haim
9878b52a31eSHanoh Haim  GTEST_DECLARE_TUPLE_AS_FRIEND_
9888b52a31eSHanoh Haim
9898b52a31eSHanoh Haim  template <GTEST_7_TYPENAMES_(U)>
9908b52a31eSHanoh Haim  tuple& CopyFrom(const GTEST_7_TUPLE_(U)& t) {
9918b52a31eSHanoh Haim    f0_ = t.f0_;
9928b52a31eSHanoh Haim    f1_ = t.f1_;
9938b52a31eSHanoh Haim    f2_ = t.f2_;
9948b52a31eSHanoh Haim    f3_ = t.f3_;
9958b52a31eSHanoh Haim    f4_ = t.f4_;
9968b52a31eSHanoh Haim    f5_ = t.f5_;
9978b52a31eSHanoh Haim    f6_ = t.f6_;
9988b52a31eSHanoh Haim    return *this;
9998b52a31eSHanoh Haim  }
10008b52a31eSHanoh Haim
10018b52a31eSHanoh Haim  T0 f0_;
10028b52a31eSHanoh Haim  T1 f1_;
10038b52a31eSHanoh Haim  T2 f2_;
10048b52a31eSHanoh Haim  T3 f3_;
10058b52a31eSHanoh Haim  T4 f4_;
10068b52a31eSHanoh Haim  T5 f5_;
10078b52a31eSHanoh Haim  T6 f6_;
10088b52a31eSHanoh Haim};
10098b52a31eSHanoh Haim
10108b52a31eSHanoh Haimtemplate <GTEST_8_TYPENAMES_(T)>
10118b52a31eSHanoh Haimclass GTEST_8_TUPLE_(T) {
10128b52a31eSHanoh Haim public:
10138b52a31eSHanoh Haim  template <int k> friend class gtest_internal::Get;
10148b52a31eSHanoh Haim
10158b52a31eSHanoh Haim  tuple() : f0_(), f1_(), f2_(), f3_(), f4_(), f5_(), f6_(), f7_() {}
10168b52a31eSHanoh Haim
10178b52a31eSHanoh Haim  explicit tuple(GTEST_BY_REF_(T0) f0, GTEST_BY_REF_(T1) f1,
10188b52a31eSHanoh Haim      GTEST_BY_REF_(T2) f2, GTEST_BY_REF_(T3) f3, GTEST_BY_REF_(T4) f4,
10198b52a31eSHanoh Haim      GTEST_BY_REF_(T5) f5, GTEST_BY_REF_(T6) f6,
10208b52a31eSHanoh Haim      GTEST_BY_REF_(T7) f7) : f0_(f0), f1_(f1), f2_(f2), f3_(f3), f4_(f4),
10218b52a31eSHanoh Haim      f5_(f5), f6_(f6), f7_(f7) {}
10228b52a31eSHanoh Haim
10238b52a31eSHanoh Haim  tuple(const tuple& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_), f3_(t.f3_),
10248b52a31eSHanoh Haim      f4_(t.f4_), f5_(t.f5_), f6_(t.f6_), f7_(t.f7_) {}
10258b52a31eSHanoh Haim
10268b52a31eSHanoh Haim  template <GTEST_8_TYPENAMES_(U)>
10278b52a31eSHanoh Haim  tuple(const GTEST_8_TUPLE_(U)& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_),
10288b52a31eSHanoh Haim      f3_(t.f3_), f4_(t.f4_), f5_(t.f5_), f6_(t.f6_), f7_(t.f7_) {}
10298b52a31eSHanoh Haim
10308b52a31eSHanoh Haim  tuple& operator=(const tuple& t) { return CopyFrom(t); }
10318b52a31eSHanoh Haim
10328b52a31eSHanoh Haim  template <GTEST_8_TYPENAMES_(U)>
10338b52a31eSHanoh Haim  tuple& operator=(const GTEST_8_TUPLE_(U)& t) {
10348b52a31eSHanoh Haim    return CopyFrom(t);
10358b52a31eSHanoh Haim  }
10368b52a31eSHanoh Haim
10378b52a31eSHanoh Haim  GTEST_DECLARE_TUPLE_AS_FRIEND_
10388b52a31eSHanoh Haim
10398b52a31eSHanoh Haim  template <GTEST_8_TYPENAMES_(U)>
10408b52a31eSHanoh Haim  tuple& CopyFrom(const GTEST_8_TUPLE_(U)& t) {
10418b52a31eSHanoh Haim    f0_ = t.f0_;
10428b52a31eSHanoh Haim    f1_ = t.f1_;
10438b52a31eSHanoh Haim    f2_ = t.f2_;
10448b52a31eSHanoh Haim    f3_ = t.f3_;
10458b52a31eSHanoh Haim    f4_ = t.f4_;
10468b52a31eSHanoh Haim    f5_ = t.f5_;
10478b52a31eSHanoh Haim    f6_ = t.f6_;
10488b52a31eSHanoh Haim    f7_ = t.f7_;
10498b52a31eSHanoh Haim    return *this;
10508b52a31eSHanoh Haim  }
10518b52a31eSHanoh Haim
10528b52a31eSHanoh Haim  T0 f0_;
10538b52a31eSHanoh Haim  T1 f1_;
10548b52a31eSHanoh Haim  T2 f2_;
10558b52a31eSHanoh Haim  T3 f3_;
10568b52a31eSHanoh Haim  T4 f4_;
10578b52a31eSHanoh Haim  T5 f5_;
10588b52a31eSHanoh Haim  T6 f6_;
10598b52a31eSHanoh Haim  T7 f7_;
10608b52a31eSHanoh Haim};
10618b52a31eSHanoh Haim
10628b52a31eSHanoh Haimtemplate <GTEST_9_TYPENAMES_(T)>
10638b52a31eSHanoh Haimclass GTEST_9_TUPLE_(T) {
10648b52a31eSHanoh Haim public:
10658b52a31eSHanoh Haim  template <int k> friend class gtest_internal::Get;
10668b52a31eSHanoh Haim
10678b52a31eSHanoh Haim  tuple() : f0_(), f1_(), f2_(), f3_(), f4_(), f5_(), f6_(), f7_(), f8_() {}
10688b52a31eSHanoh Haim
10698b52a31eSHanoh Haim  explicit tuple(GTEST_BY_REF_(T0) f0, GTEST_BY_REF_(T1) f1,
10708b52a31eSHanoh Haim      GTEST_BY_REF_(T2) f2, GTEST_BY_REF_(T3) f3, GTEST_BY_REF_(T4) f4,
10718b52a31eSHanoh Haim      GTEST_BY_REF_(T5) f5, GTEST_BY_REF_(T6) f6, GTEST_BY_REF_(T7) f7,
10728b52a31eSHanoh Haim      GTEST_BY_REF_(T8) f8) : f0_(f0), f1_(f1), f2_(f2), f3_(f3), f4_(f4),
10738b52a31eSHanoh Haim      f5_(f5), f6_(f6), f7_(f7), f8_(f8) {}
10748b52a31eSHanoh Haim
10758b52a31eSHanoh Haim  tuple(const tuple& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_), f3_(t.f3_),
10768b52a31eSHanoh Haim      f4_(t.f4_), f5_(t.f5_), f6_(t.f6_), f7_(t.f7_), f8_(t.f8_) {}
10778b52a31eSHanoh Haim
10788b52a31eSHanoh Haim  template <GTEST_9_TYPENAMES_(U)>
10798b52a31eSHanoh Haim  tuple(const GTEST_9_TUPLE_(U)& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_),
10808b52a31eSHanoh Haim      f3_(t.f3_), f4_(t.f4_), f5_(t.f5_), f6_(t.f6_), f7_(t.f7_), f8_(t.f8_) {}
10818b52a31eSHanoh Haim
10828b52a31eSHanoh Haim  tuple& operator=(const tuple& t) { return CopyFrom(t); }
10838b52a31eSHanoh Haim
10848b52a31eSHanoh Haim  template <GTEST_9_TYPENAMES_(U)>
10858b52a31eSHanoh Haim  tuple& operator=(const GTEST_9_TUPLE_(U)& t) {
10868b52a31eSHanoh Haim    return CopyFrom(t);
10878b52a31eSHanoh Haim  }
10888b52a31eSHanoh Haim
10898b52a31eSHanoh Haim  GTEST_DECLARE_TUPLE_AS_FRIEND_
10908b52a31eSHanoh Haim
10918b52a31eSHanoh Haim  template <GTEST_9_TYPENAMES_(U)>
10928b52a31eSHanoh Haim  tuple& CopyFrom(const GTEST_9_TUPLE_(U)& t) {
10938b52a31eSHanoh Haim    f0_ = t.f0_;
10948b52a31eSHanoh Haim    f1_ = t.f1_;
10958b52a31eSHanoh Haim    f2_ = t.f2_;
10968b52a31eSHanoh Haim    f3_ = t.f3_;
10978b52a31eSHanoh Haim    f4_ = t.f4_;
10988b52a31eSHanoh Haim    f5_ = t.f5_;
10998b52a31eSHanoh Haim    f6_ = t.f6_;
11008b52a31eSHanoh Haim    f7_ = t.f7_;
11018b52a31eSHanoh Haim    f8_ = t.f8_;
11028b52a31eSHanoh Haim    return *this;
11038b52a31eSHanoh Haim  }
11048b52a31eSHanoh Haim
11058b52a31eSHanoh Haim  T0 f0_;
11068b52a31eSHanoh Haim  T1 f1_;
11078b52a31eSHanoh Haim  T2 f2_;
11088b52a31eSHanoh Haim  T3 f3_;
11098b52a31eSHanoh Haim  T4 f4_;
11108b52a31eSHanoh Haim  T5 f5_;
11118b52a31eSHanoh Haim  T6 f6_;
11128b52a31eSHanoh Haim  T7 f7_;
11138b52a31eSHanoh Haim  T8 f8_;
11148b52a31eSHanoh Haim};
11158b52a31eSHanoh Haim
11168b52a31eSHanoh Haimtemplate <GTEST_10_TYPENAMES_(T)>
11178b52a31eSHanoh Haimclass tuple {
11188b52a31eSHanoh Haim public:
11198b52a31eSHanoh Haim  template <int k> friend class gtest_internal::Get;
11208b52a31eSHanoh Haim
11218b52a31eSHanoh Haim  tuple() : f0_(), f1_(), f2_(), f3_(), f4_(), f5_(), f6_(), f7_(), f8_(),
11228b52a31eSHanoh Haim      f9_() {}
11238b52a31eSHanoh Haim
11248b52a31eSHanoh Haim  explicit tuple(GTEST_BY_REF_(T0) f0, GTEST_BY_REF_(T1) f1,
11258b52a31eSHanoh Haim      GTEST_BY_REF_(T2) f2, GTEST_BY_REF_(T3) f3, GTEST_BY_REF_(T4) f4,
11268b52a31eSHanoh Haim      GTEST_BY_REF_(T5) f5, GTEST_BY_REF_(T6) f6, GTEST_BY_REF_(T7) f7,
11278b52a31eSHanoh Haim      GTEST_BY_REF_(T8) f8, GTEST_BY_REF_(T9) f9) : f0_(f0), f1_(f1), f2_(f2),
11288b52a31eSHanoh Haim      f3_(f3), f4_(f4), f5_(f5), f6_(f6), f7_(f7), f8_(f8), f9_(f9) {}
11298b52a31eSHanoh Haim
11308b52a31eSHanoh Haim  tuple(const tuple& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_), f3_(t.f3_),
11318b52a31eSHanoh Haim      f4_(t.f4_), f5_(t.f5_), f6_(t.f6_), f7_(t.f7_), f8_(t.f8_), f9_(t.f9_) {}
11328b52a31eSHanoh Haim
11338b52a31eSHanoh Haim  template <GTEST_10_TYPENAMES_(U)>
11348b52a31eSHanoh Haim  tuple(const GTEST_10_TUPLE_(U)& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_),
11358b52a31eSHanoh Haim      f3_(t.f3_), f4_(t.f4_), f5_(t.f5_), f6_(t.f6_), f7_(t.f7_), f8_(t.f8_),
11368b52a31eSHanoh Haim      f9_(t.f9_) {}
11378b52a31eSHanoh Haim
11388b52a31eSHanoh Haim  tuple& operator=(const tuple& t) { return CopyFrom(t); }
11398b52a31eSHanoh Haim
11408b52a31eSHanoh Haim  template <GTEST_10_TYPENAMES_(U)>
11418b52a31eSHanoh Haim  tuple& operator=(const GTEST_10_TUPLE_(U)& t) {
11428b52a31eSHanoh Haim    return CopyFrom(t);
11438b52a31eSHanoh Haim  }
11448b52a31eSHanoh Haim
11458b52a31eSHanoh Haim  GTEST_DECLARE_TUPLE_AS_FRIEND_
11468b52a31eSHanoh Haim
11478b52a31eSHanoh Haim  template <GTEST_10_TYPENAMES_(U)>
11488b52a31eSHanoh Haim  tuple& CopyFrom(const GTEST_10_TUPLE_(U)& t) {
11498b52a31eSHanoh Haim    f0_ = t.f0_;
11508b52a31eSHanoh Haim    f1_ = t.f1_;
11518b52a31eSHanoh Haim    f2_ = t.f2_;
11528b52a31eSHanoh Haim    f3_ = t.f3_;
11538b52a31eSHanoh Haim    f4_ = t.f4_;
11548b52a31eSHanoh Haim    f5_ = t.f5_;
11558b52a31eSHanoh Haim    f6_ = t.f6_;
11568b52a31eSHanoh Haim    f7_ = t.f7_;
11578b52a31eSHanoh Haim    f8_ = t.f8_;
11588b52a31eSHanoh Haim    f9_ = t.f9_;
11598b52a31eSHanoh Haim    return *this;
11608b52a31eSHanoh Haim  }
11618b52a31eSHanoh Haim
11628b52a31eSHanoh Haim  T0 f0_;
11638b52a31eSHanoh Haim  T1 f1_;
11648b52a31eSHanoh Haim  T2 f2_;
11658b52a31eSHanoh Haim  T3 f3_;
11668b52a31eSHanoh Haim  T4 f4_;
11678b52a31eSHanoh Haim  T5 f5_;
11688b52a31eSHanoh Haim  T6 f6_;
11698b52a31eSHanoh Haim  T7 f7_;
11708b52a31eSHanoh Haim  T8 f8_;
11718b52a31eSHanoh Haim  T9 f9_;
11728b52a31eSHanoh Haim};
11738b52a31eSHanoh Haim
11748b52a31eSHanoh Haim// 6.1.3.2 Tuple creation functions.
11758b52a31eSHanoh Haim
11768b52a31eSHanoh Haim// Known limitations: we don't support passing an
11778b52a31eSHanoh Haim// std::tr1::reference_wrapper<T> to make_tuple().  And we don't
11788b52a31eSHanoh Haim// implement tie().
11798b52a31eSHanoh Haim
11808b52a31eSHanoh Haiminline tuple<> make_tuple() { return tuple<>(); }
11818b52a31eSHanoh Haim
11828b52a31eSHanoh Haimtemplate <GTEST_1_TYPENAMES_(T)>
11838b52a31eSHanoh Haiminline GTEST_1_TUPLE_(T) make_tuple(const T0& f0) {
11848b52a31eSHanoh Haim  return GTEST_1_TUPLE_(T)(f0);
11858b52a31eSHanoh Haim}
11868b52a31eSHanoh Haim
11878b52a31eSHanoh Haimtemplate <GTEST_2_TYPENAMES_(T)>
11888b52a31eSHanoh Haiminline GTEST_2_TUPLE_(T) make_tuple(const T0& f0, const T1& f1) {
11898b52a31eSHanoh Haim  return GTEST_2_TUPLE_(T)(f0, f1);
11908b52a31eSHanoh Haim}
11918b52a31eSHanoh Haim
11928b52a31eSHanoh Haimtemplate <GTEST_3_TYPENAMES_(T)>
11938b52a31eSHanoh Haiminline GTEST_3_TUPLE_(T) make_tuple(const T0& f0, const T1& f1, const T2& f2) {
11948b52a31eSHanoh Haim  return GTEST_3_TUPLE_(T)(f0, f1, f2);
11958b52a31eSHanoh Haim}
11968b52a31eSHanoh Haim
11978b52a31eSHanoh Haimtemplate <GTEST_4_TYPENAMES_(T)>
11988b52a31eSHanoh Haiminline GTEST_4_TUPLE_(T) make_tuple(const T0& f0, const T1& f1, const T2& f2,
11998b52a31eSHanoh Haim    const T3& f3) {
12008b52a31eSHanoh Haim  return GTEST_4_TUPLE_(T)(f0, f1, f2, f3);
12018b52a31eSHanoh Haim}
12028b52a31eSHanoh Haim
12038b52a31eSHanoh Haimtemplate <GTEST_5_TYPENAMES_(T)>
12048b52a31eSHanoh Haiminline GTEST_5_TUPLE_(T) make_tuple(const T0& f0, const T1& f1, const T2& f2,
12058b52a31eSHanoh Haim    const T3& f3, const T4& f4) {
12068b52a31eSHanoh Haim  return GTEST_5_TUPLE_(T)(f0, f1, f2, f3, f4);
12078b52a31eSHanoh Haim}
12088b52a31eSHanoh Haim
12098b52a31eSHanoh Haimtemplate <GTEST_6_TYPENAMES_(T)>
12108b52a31eSHanoh Haiminline GTEST_6_TUPLE_(T) make_tuple(const T0& f0, const T1& f1, const T2& f2,
12118b52a31eSHanoh Haim    const T3& f3, const T4& f4, const T5& f5) {
12128b52a31eSHanoh Haim  return GTEST_6_TUPLE_(T)(f0, f1, f2, f3, f4, f5);
12138b52a31eSHanoh Haim}
12148b52a31eSHanoh Haim
12158b52a31eSHanoh Haimtemplate <GTEST_7_TYPENAMES_(T)>
12168b52a31eSHanoh Haiminline GTEST_7_TUPLE_(T) make_tuple(const T0& f0, const T1& f1, const T2& f2,
12178b52a31eSHanoh Haim    const T3& f3, const T4& f4, const T5& f5, const T6& f6) {
12188b52a31eSHanoh Haim  return GTEST_7_TUPLE_(T)(f0, f1, f2, f3, f4, f5, f6);
12198b52a31eSHanoh Haim}
12208b52a31eSHanoh Haim
12218b52a31eSHanoh Haimtemplate <GTEST_8_TYPENAMES_(T)>
12228b52a31eSHanoh Haiminline GTEST_8_TUPLE_(T) make_tuple(const T0& f0, const T1& f1, const T2& f2,
12238b52a31eSHanoh Haim    const T3& f3, const T4& f4, const T5& f5, const T6& f6, const T7& f7) {
12248b52a31eSHanoh Haim  return GTEST_8_TUPLE_(T)(f0, f1, f2, f3, f4, f5, f6, f7);
12258b52a31eSHanoh Haim}
12268b52a31eSHanoh Haim
12278b52a31eSHanoh Haimtemplate <GTEST_9_TYPENAMES_(T)>
12288b52a31eSHanoh Haiminline GTEST_9_TUPLE_(T) make_tuple(const T0& f0, const T1& f1, const T2& f2,
12298b52a31eSHanoh Haim    const T3& f3, const T4& f4, const T5& f5, const T6& f6, const T7& f7,
12308b52a31eSHanoh Haim    const T8& f8) {
12318b52a31eSHanoh Haim  return GTEST_9_TUPLE_(T)(f0, f1, f2, f3, f4, f5, f6, f7, f8);
12328b52a31eSHanoh Haim}
12338b52a31eSHanoh Haim
12348b52a31eSHanoh Haimtemplate <GTEST_10_TYPENAMES_(T)>
12358b52a31eSHanoh Haiminline GTEST_10_TUPLE_(T) make_tuple(const T0& f0, const T1& f1, const T2& f2,
12368b52a31eSHanoh Haim    const T3& f3, const T4& f4, const T5& f5, const T6& f6, const T7& f7,
12378b52a31eSHanoh Haim    const T8& f8, const T9& f9) {
12388b52a31eSHanoh Haim  return GTEST_10_TUPLE_(T)(f0, f1, f2, f3, f4, f5, f6, f7, f8, f9);
12398b52a31eSHanoh Haim}
12408b52a31eSHanoh Haim
12418b52a31eSHanoh Haim// 6.1.3.3 Tuple helper classes.
12428b52a31eSHanoh Haim
12438b52a31eSHanoh Haimtemplate <typename Tuple> struct tuple_size;
12448b52a31eSHanoh Haim
12458b52a31eSHanoh Haimtemplate <GTEST_0_TYPENAMES_(T)>
12468b52a31eSHanoh Haimstruct tuple_size<GTEST_0_TUPLE_(T)> { static const int value = 0; };
12478b52a31eSHanoh Haim
12488b52a31eSHanoh Haimtemplate <GTEST_1_TYPENAMES_(T)>
12498b52a31eSHanoh Haimstruct tuple_size<GTEST_1_TUPLE_(T)> { static const int value = 1; };
12508b52a31eSHanoh Haim
12518b52a31eSHanoh Haimtemplate <GTEST_2_TYPENAMES_(T)>
12528b52a31eSHanoh Haimstruct tuple_size<GTEST_2_TUPLE_(T)> { static const int value = 2; };
12538b52a31eSHanoh Haim
12548b52a31eSHanoh Haimtemplate <GTEST_3_TYPENAMES_(T)>
12558b52a31eSHanoh Haimstruct tuple_size<GTEST_3_TUPLE_(T)> { static const int value = 3; };
12568b52a31eSHanoh Haim
12578b52a31eSHanoh Haimtemplate <GTEST_4_TYPENAMES_(T)>
12588b52a31eSHanoh Haimstruct tuple_size<GTEST_4_TUPLE_(T)> { static const int value = 4; };
12598b52a31eSHanoh Haim
12608b52a31eSHanoh Haimtemplate <GTEST_5_TYPENAMES_(T)>
12618b52a31eSHanoh Haimstruct tuple_size<GTEST_5_TUPLE_(T)> { static const int value = 5; };
12628b52a31eSHanoh Haim
12638b52a31eSHanoh Haimtemplate <GTEST_6_TYPENAMES_(T)>
12648b52a31eSHanoh Haimstruct tuple_size<GTEST_6_TUPLE_(T)> { static const int value = 6; };
12658b52a31eSHanoh Haim
12668b52a31eSHanoh Haimtemplate <GTEST_7_TYPENAMES_(T)>
12678b52a31eSHanoh Haimstruct tuple_size<GTEST_7_TUPLE_(T)> { static const int value = 7; };
12688b52a31eSHanoh Haim
12698b52a31eSHanoh Haimtemplate <GTEST_8_TYPENAMES_(T)>
12708b52a31eSHanoh Haimstruct tuple_size<GTEST_8_TUPLE_(T)> { static const int value = 8; };
12718b52a31eSHanoh Haim
12728b52a31eSHanoh Haimtemplate <GTEST_9_TYPENAMES_(T)>
12738b52a31eSHanoh Haimstruct tuple_size<GTEST_9_TUPLE_(T)> { static const int value = 9; };
12748b52a31eSHanoh Haim
12758b52a31eSHanoh Haimtemplate <GTEST_10_TYPENAMES_(T)>
12768b52a31eSHanoh Haimstruct tuple_size<GTEST_10_TUPLE_(T)> { static const int value = 10; };
12778b52a31eSHanoh Haim
12788b52a31eSHanoh Haimtemplate <int k, class Tuple>
12798b52a31eSHanoh Haimstruct tuple_element {
12808b52a31eSHanoh Haim  typedef typename gtest_internal::TupleElement<
12818b52a31eSHanoh Haim      k < (tuple_size<Tuple>::value), k, Tuple>::type type;
12828b52a31eSHanoh Haim};
12838b52a31eSHanoh Haim
12848b52a31eSHanoh Haim#define GTEST_TUPLE_ELEMENT_(k, Tuple) typename tuple_element<k, Tuple >::type
12858b52a31eSHanoh Haim
12868b52a31eSHanoh Haim// 6.1.3.4 Element access.
12878b52a31eSHanoh Haim
12888b52a31eSHanoh Haimnamespace gtest_internal {
12898b52a31eSHanoh Haim
12908b52a31eSHanoh Haimtemplate <>
12918b52a31eSHanoh Haimclass Get<0> {
12928b52a31eSHanoh Haim public:
12938b52a31eSHanoh Haim  template <class Tuple>
12948b52a31eSHanoh Haim  static GTEST_ADD_REF_(GTEST_TUPLE_ELEMENT_(0, Tuple))
12958b52a31eSHanoh Haim  Field(Tuple& t) { return t.f0_; }  // NOLINT
12968b52a31eSHanoh Haim
12978b52a31eSHanoh Haim  template <class Tuple>
12988b52a31eSHanoh Haim  static GTEST_BY_REF_(GTEST_TUPLE_ELEMENT_(0, Tuple))
12998b52a31eSHanoh Haim  ConstField(const Tuple& t) { return t.f0_; }
13008b52a31eSHanoh Haim};
13018b52a31eSHanoh Haim
13028b52a31eSHanoh Haimtemplate <>
13038b52a31eSHanoh Haimclass Get<1> {
13048b52a31eSHanoh Haim public:
13058b52a31eSHanoh Haim  template <class Tuple>
13068b52a31eSHanoh Haim  static GTEST_ADD_REF_(GTEST_TUPLE_ELEMENT_(1, Tuple))
13078b52a31eSHanoh Haim  Field(Tuple& t) { return t.f1_; }  // NOLINT
13088b52a31eSHanoh Haim
13098b52a31eSHanoh Haim  template <class Tuple>
13108b52a31eSHanoh Haim  static GTEST_BY_REF_(GTEST_TUPLE_ELEMENT_(1, Tuple))
13118b52a31eSHanoh Haim  ConstField(const Tuple& t) { return t.f1_; }
13128b52a31eSHanoh Haim};
13138b52a31eSHanoh Haim
13148b52a31eSHanoh Haimtemplate <>
13158b52a31eSHanoh Haimclass Get<2> {
13168b52a31eSHanoh Haim public:
13178b52a31eSHanoh Haim  template <class Tuple>
13188b52a31eSHanoh Haim  static GTEST_ADD_REF_(GTEST_TUPLE_ELEMENT_(2, Tuple))
13198b52a31eSHanoh Haim  Field(Tuple& t) { return t.f2_; }  // NOLINT
13208b52a31eSHanoh Haim
13218b52a31eSHanoh Haim  template <class Tuple>
13228b52a31eSHanoh Haim  static GTEST_BY_REF_(GTEST_TUPLE_ELEMENT_(2, Tuple))
13238b52a31eSHanoh Haim  ConstField(const Tuple& t) { return t.f2_; }
13248b52a31eSHanoh Haim};
13258b52a31eSHanoh Haim
13268b52a31eSHanoh Haimtemplate <>
13278b52a31eSHanoh Haimclass Get<3> {
13288b52a31eSHanoh Haim public:
13298b52a31eSHanoh Haim  template <class Tuple>
13308b52a31eSHanoh Haim  static GTEST_ADD_REF_(GTEST_TUPLE_ELEMENT_(3, Tuple))
13318b52a31eSHanoh Haim  Field(Tuple& t) { return t.f3_; }  // NOLINT
13328b52a31eSHanoh Haim
13338b52a31eSHanoh Haim  template <class Tuple>
13348b52a31eSHanoh Haim  static GTEST_BY_REF_(GTEST_TUPLE_ELEMENT_(3, Tuple))
13358b52a31eSHanoh Haim  ConstField(const Tuple& t) { return t.f3_; }
13368b52a31eSHanoh Haim};
13378b52a31eSHanoh Haim
13388b52a31eSHanoh Haimtemplate <>
13398b52a31eSHanoh Haimclass Get<4> {
13408b52a31eSHanoh Haim public:
13418b52a31eSHanoh Haim  template <class Tuple>
13428b52a31eSHanoh Haim  static GTEST_ADD_REF_(GTEST_TUPLE_ELEMENT_(4, Tuple))
13438b52a31eSHanoh Haim  Field(Tuple& t) { return t.f4_; }  // NOLINT
13448b52a31eSHanoh Haim
13458b52a31eSHanoh Haim  template <class Tuple>
13468b52a31eSHanoh Haim  static GTEST_BY_REF_(GTEST_TUPLE_ELEMENT_(4, Tuple))
13478b52a31eSHanoh Haim  ConstField(const Tuple& t) { return t.f4_; }
13488b52a31eSHanoh Haim};
13498b52a31eSHanoh Haim
13508b52a31eSHanoh Haimtemplate <>
13518b52a31eSHanoh Haimclass Get<5> {
13528b52a31eSHanoh Haim public:
13538b52a31eSHanoh Haim  template <class Tuple>
13548b52a31eSHanoh Haim  static GTEST_ADD_REF_(GTEST_TUPLE_ELEMENT_(5, Tuple))
13558b52a31eSHanoh Haim  Field(Tuple& t) { return t.f5_; }  // NOLINT
13568b52a31eSHanoh Haim
13578b52a31eSHanoh Haim  template <class Tuple>
13588b52a31eSHanoh Haim  static GTEST_BY_REF_(GTEST_TUPLE_ELEMENT_(5, Tuple))
13598b52a31eSHanoh Haim  ConstField(const Tuple& t) { return t.f5_; }
13608b52a31eSHanoh Haim};
13618b52a31eSHanoh Haim
13628b52a31eSHanoh Haimtemplate <>
13638b52a31eSHanoh Haimclass Get<6> {
13648b52a31eSHanoh Haim public:
13658b52a31eSHanoh Haim  template <class Tuple>
13668b52a31eSHanoh Haim  static GTEST_ADD_REF_(GTEST_TUPLE_ELEMENT_(6, Tuple))
13678b52a31eSHanoh Haim  Field(Tuple& t) { return t.f6_; }  // NOLINT
13688b52a31eSHanoh Haim
13698b52a31eSHanoh Haim  template <class Tuple>
13708b52a31eSHanoh Haim  static GTEST_BY_REF_(GTEST_TUPLE_ELEMENT_(6, Tuple))
13718b52a31eSHanoh Haim  ConstField(const Tuple& t) { return t.f6_; }
13728b52a31eSHanoh Haim};
13738b52a31eSHanoh Haim
13748b52a31eSHanoh Haimtemplate <>
13758b52a31eSHanoh Haimclass Get<7> {
13768b52a31eSHanoh Haim public:
13778b52a31eSHanoh Haim  template <class Tuple>
13788b52a31eSHanoh Haim  static GTEST_ADD_REF_(GTEST_TUPLE_ELEMENT_(7, Tuple))
13798b52a31eSHanoh Haim  Field(Tuple& t) { return t.f7_; }  // NOLINT
13808b52a31eSHanoh Haim
13818b52a31eSHanoh Haim  template <class Tuple>
13828b52a31eSHanoh Haim  static GTEST_BY_REF_(GTEST_TUPLE_ELEMENT_(7, Tuple))
13838b52a31eSHanoh Haim  ConstField(const Tuple& t) { return t.f7_; }
13848b52a31eSHanoh Haim};
13858b52a31eSHanoh Haim
13868b52a31eSHanoh Haimtemplate <>
13878b52a31eSHanoh Haimclass Get<8> {
13888b52a31eSHanoh Haim public:
13898b52a31eSHanoh Haim  template <class Tuple>
13908b52a31eSHanoh Haim  static GTEST_ADD_REF_(GTEST_TUPLE_ELEMENT_(8, Tuple))
13918b52a31eSHanoh Haim  Field(Tuple& t) { return t.f8_; }  // NOLINT
13928b52a31eSHanoh Haim
13938b52a31eSHanoh Haim  template <class Tuple>
13948b52a31eSHanoh Haim  static GTEST_BY_REF_(GTEST_TUPLE_ELEMENT_(8, Tuple))
13958b52a31eSHanoh Haim  ConstField(const Tuple& t) { return t.f8_; }
13968b52a31eSHanoh Haim};
13978b52a31eSHanoh Haim
13988b52a31eSHanoh Haimtemplate <>
13998b52a31eSHanoh Haimclass Get<9> {
14008b52a31eSHanoh Haim public:
14018b52a31eSHanoh Haim  template <class Tuple>
14028b52a31eSHanoh Haim  static GTEST_ADD_REF_(GTEST_TUPLE_ELEMENT_(9, Tuple))
14038b52a31eSHanoh Haim  Field(Tuple& t) { return t.f9_; }  // NOLINT
14048b52a31eSHanoh Haim
14058b52a31eSHanoh Haim  template <class Tuple>
14068b52a31eSHanoh Haim  static GTEST_BY_REF_(GTEST_TUPLE_ELEMENT_(9, Tuple))
14078b52a31eSHanoh Haim  ConstField(const Tuple& t) { return t.f9_; }
14088b52a31eSHanoh Haim};
14098b52a31eSHanoh Haim
14108b52a31eSHanoh Haim}