1167514562bbce1eb0566271d6cb41d90d2b5ffa0hclam@chromium.org// Copyright 2005, Google Inc.
2167514562bbce1eb0566271d6cb41d90d2b5ffa0hclam@chromium.org// All rights reserved.
3167514562bbce1eb0566271d6cb41d90d2b5ffa0hclam@chromium.org//
4167514562bbce1eb0566271d6cb41d90d2b5ffa0hclam@chromium.org// Redistribution and use in source and binary forms, with or without
5167514562bbce1eb0566271d6cb41d90d2b5ffa0hclam@chromium.org// modification, are permitted provided that the following conditions are
6167514562bbce1eb0566271d6cb41d90d2b5ffa0hclam@chromium.org// met:
7167514562bbce1eb0566271d6cb41d90d2b5ffa0hclam@chromium.org//
8167514562bbce1eb0566271d6cb41d90d2b5ffa0hclam@chromium.org//     * Redistributions of source code must retain the above copyright
9167514562bbce1eb0566271d6cb41d90d2b5ffa0hclam@chromium.org// notice, this list of conditions and the following disclaimer.
10167514562bbce1eb0566271d6cb41d90d2b5ffa0hclam@chromium.org//     * Redistributions in binary form must reproduce the above
11167514562bbce1eb0566271d6cb41d90d2b5ffa0hclam@chromium.org// copyright notice, this list of conditions and the following disclaimer
12167514562bbce1eb0566271d6cb41d90d2b5ffa0hclam@chromium.org// in the documentation and/or other materials provided with the
13167514562bbce1eb0566271d6cb41d90d2b5ffa0hclam@chromium.org// distribution.
14167514562bbce1eb0566271d6cb41d90d2b5ffa0hclam@chromium.org//     * Neither the name of Google Inc. nor the names of its
15167514562bbce1eb0566271d6cb41d90d2b5ffa0hclam@chromium.org// contributors may be used to endorse or promote products derived from
16167514562bbce1eb0566271d6cb41d90d2b5ffa0hclam@chromium.org// this software without specific prior written permission.
17167514562bbce1eb0566271d6cb41d90d2b5ffa0hclam@chromium.org//
18167514562bbce1eb0566271d6cb41d90d2b5ffa0hclam@chromium.org// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19167514562bbce1eb0566271d6cb41d90d2b5ffa0hclam@chromium.org// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20167514562bbce1eb0566271d6cb41d90d2b5ffa0hclam@chromium.org// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21167514562bbce1eb0566271d6cb41d90d2b5ffa0hclam@chromium.org// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22167514562bbce1eb0566271d6cb41d90d2b5ffa0hclam@chromium.org// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23167514562bbce1eb0566271d6cb41d90d2b5ffa0hclam@chromium.org// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24167514562bbce1eb0566271d6cb41d90d2b5ffa0hclam@chromium.org// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25167514562bbce1eb0566271d6cb41d90d2b5ffa0hclam@chromium.org// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26167514562bbce1eb0566271d6cb41d90d2b5ffa0hclam@chromium.org// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27167514562bbce1eb0566271d6cb41d90d2b5ffa0hclam@chromium.org// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28167514562bbce1eb0566271d6cb41d90d2b5ffa0hclam@chromium.org// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29167514562bbce1eb0566271d6cb41d90d2b5ffa0hclam@chromium.org//
30167514562bbce1eb0566271d6cb41d90d2b5ffa0hclam@chromium.org// Author: wan@google.com (Zhanyong Wan)
31167514562bbce1eb0566271d6cb41d90d2b5ffa0hclam@chromium.org//
32167514562bbce1eb0566271d6cb41d90d2b5ffa0hclam@chromium.org// The Google C++ Testing Framework (Google Test)
33167514562bbce1eb0566271d6cb41d90d2b5ffa0hclam@chromium.org//
34167514562bbce1eb0566271d6cb41d90d2b5ffa0hclam@chromium.org// This header file defines the public API for Google Test.  It should be
35167514562bbce1eb0566271d6cb41d90d2b5ffa0hclam@chromium.org// included by any test program that uses Google Test.
36167514562bbce1eb0566271d6cb41d90d2b5ffa0hclam@chromium.org//
37167514562bbce1eb0566271d6cb41d90d2b5ffa0hclam@chromium.org// IMPORTANT NOTE: Due to limitation of the C++ language, we have to
38167514562bbce1eb0566271d6cb41d90d2b5ffa0hclam@chromium.org// leave some internal implementation details in this header file.
39167514562bbce1eb0566271d6cb41d90d2b5ffa0hclam@chromium.org// They are clearly marked by comments like this:
40167514562bbce1eb0566271d6cb41d90d2b5ffa0hclam@chromium.org//
41167514562bbce1eb0566271d6cb41d90d2b5ffa0hclam@chromium.org//   // INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
42167514562bbce1eb0566271d6cb41d90d2b5ffa0hclam@chromium.org//
43167514562bbce1eb0566271d6cb41d90d2b5ffa0hclam@chromium.org// Such code is NOT meant to be used by a user directly, and is subject
44167514562bbce1eb0566271d6cb41d90d2b5ffa0hclam@chromium.org// to CHANGE WITHOUT NOTICE.  Therefore DO NOT DEPEND ON IT in a user
45167514562bbce1eb0566271d6cb41d90d2b5ffa0hclam@chromium.org// program!
46167514562bbce1eb0566271d6cb41d90d2b5ffa0hclam@chromium.org//
47167514562bbce1eb0566271d6cb41d90d2b5ffa0hclam@chromium.org// Acknowledgment: Google Test borrowed the idea of automatic test
48167514562bbce1eb0566271d6cb41d90d2b5ffa0hclam@chromium.org// registration from Barthelemy Dagenais' (barthelemy@prologique.com)
49167514562bbce1eb0566271d6cb41d90d2b5ffa0hclam@chromium.org// easyUnit framework.
50167514562bbce1eb0566271d6cb41d90d2b5ffa0hclam@chromium.org
51167514562bbce1eb0566271d6cb41d90d2b5ffa0hclam@chromium.org#ifndef GTEST_INCLUDE_GTEST_GTEST_H_
52167514562bbce1eb0566271d6cb41d90d2b5ffa0hclam@chromium.org#define GTEST_INCLUDE_GTEST_GTEST_H_
53167514562bbce1eb0566271d6cb41d90d2b5ffa0hclam@chromium.org
54167514562bbce1eb0566271d6cb41d90d2b5ffa0hclam@chromium.org#include <limits>
550d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org#include <ostream>
56167514562bbce1eb0566271d6cb41d90d2b5ffa0hclam@chromium.org#include <vector>
57167514562bbce1eb0566271d6cb41d90d2b5ffa0hclam@chromium.org
580d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// Copyright 2005, Google Inc.
590d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// All rights reserved.
600d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org//
610d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// Redistribution and use in source and binary forms, with or without
620d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// modification, are permitted provided that the following conditions are
630d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// met:
640d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org//
650d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org//     * Redistributions of source code must retain the above copyright
660d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// notice, this list of conditions and the following disclaimer.
670d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org//     * Redistributions in binary form must reproduce the above
680d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// copyright notice, this list of conditions and the following disclaimer
690d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// in the documentation and/or other materials provided with the
700d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// distribution.
710d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org//     * Neither the name of Google Inc. nor the names of its
720d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// contributors may be used to endorse or promote products derived from
730d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// this software without specific prior written permission.
740d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org//
750d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
760d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
770d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
780d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
790d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
800d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
810d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
820d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
830d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
840d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
850d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
860d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org//
870d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// Authors: wan@google.com (Zhanyong Wan), eefacm@gmail.com (Sean Mcafee)
880d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org//
890d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// The Google C++ Testing Framework (Google Test)
900d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org//
910d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// This header file declares functions and macros used internally by
920d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// Google Test.  They are subject to change without notice.
930d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
940d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org#ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_INTERNAL_H_
950d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org#define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_INTERNAL_H_
960d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
970d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// Copyright 2005, Google Inc.
980d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// All rights reserved.
990d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org//
1000d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// Redistribution and use in source and binary forms, with or without
1010d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// modification, are permitted provided that the following conditions are
1020d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// met:
1030d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org//
1040d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org//     * Redistributions of source code must retain the above copyright
1050d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// notice, this list of conditions and the following disclaimer.
1060d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org//     * Redistributions in binary form must reproduce the above
1070d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// copyright notice, this list of conditions and the following disclaimer
1080d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// in the documentation and/or other materials provided with the
1090d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// distribution.
1100d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org//     * Neither the name of Google Inc. nor the names of its
1110d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// contributors may be used to endorse or promote products derived from
1120d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// this software without specific prior written permission.
1130d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org//
1140d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
1150d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
1160d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
1170d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
1180d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
1190d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
1200d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
1210d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
1220d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
1230d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
1240d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
1250d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org//
1260d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// Authors: wan@google.com (Zhanyong Wan)
1270d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org//
1280d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// Low-level types and utilities for porting Google Test to various
1290d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// platforms.  They are subject to change without notice.  DO NOT USE
1300d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// THEM IN USER CODE.
1310d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org//
1320d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// This file is fundamental to Google Test.  All other Google Test source
1330d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// files are expected to #include this.  Therefore, it cannot #include
1340d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// any other Google Test header.
1350d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
1360d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org#ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PORT_H_
1370d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org#define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PORT_H_
1380d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
1390d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// The user can define the following macros in the build script to
1400d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// control Google Test's behavior.  If the user doesn't define a macro
1410d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// in this list, Google Test will define it.
1420d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org//
1430d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org//   GTEST_HAS_CLONE          - Define it to 1/0 to indicate that clone(2)
1440d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org//                              is/isn't available.
1450d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org//   GTEST_HAS_EXCEPTIONS     - Define it to 1/0 to indicate that exceptions
1460d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org//                              are enabled.
1470d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org//   GTEST_HAS_GLOBAL_STRING  - Define it to 1/0 to indicate that ::string
1480d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org//                              is/isn't available (some systems define
1490d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org//                              ::string, which is different to std::string).
1500d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org//   GTEST_HAS_GLOBAL_WSTRING - Define it to 1/0 to indicate that ::string
1510d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org//                              is/isn't available (some systems define
1520d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org//                              ::wstring, which is different to std::wstring).
1530d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org//   GTEST_HAS_POSIX_RE       - Define it to 1/0 to indicate that POSIX regular
1540d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org//                              expressions are/aren't available.
1550d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org//   GTEST_HAS_PTHREAD        - Define it to 1/0 to indicate that <pthread.h>
1560d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org//                              is/isn't available.
1570d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org//   GTEST_HAS_RTTI           - Define it to 1/0 to indicate that RTTI is/isn't
1580d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org//                              enabled.
1590d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org//   GTEST_HAS_STD_WSTRING    - Define it to 1/0 to indicate that
1600d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org//                              std::wstring does/doesn't work (Google Test can
1610d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org//                              be used where std::wstring is unavailable).
1620d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org//   GTEST_HAS_TR1_TUPLE      - Define it to 1/0 to indicate tr1::tuple
1630d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org//                              is/isn't available.
1640d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org//   GTEST_HAS_SEH            - Define it to 1/0 to indicate whether the
1650d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org//                              compiler supports Microsoft's "Structured
1660d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org//                              Exception Handling".
1670d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org//   GTEST_HAS_STREAM_REDIRECTION
1680d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org//                            - Define it to 1/0 to indicate whether the
1690d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org//                              platform supports I/O stream redirection using
1700d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org//                              dup() and dup2().
1710d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org//   GTEST_USE_OWN_TR1_TUPLE  - Define it to 1/0 to indicate whether Google
1720d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org//                              Test's own tr1 tuple implementation should be
1730d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org//                              used.  Unused when the user sets
1740d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org//                              GTEST_HAS_TR1_TUPLE to 0.
1750d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org//   GTEST_LANG_CXX11         - Define it to 1/0 to indicate that Google Test
1760d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org//                              is building in C++11/C++98 mode.
1770d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org//   GTEST_LINKED_AS_SHARED_LIBRARY
1780d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org//                            - Define to 1 when compiling tests that use
1790d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org//                              Google Test as a shared library (known as
1800d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org//                              DLL on Windows).
1810d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org//   GTEST_CREATE_SHARED_LIBRARY
1820d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org//                            - Define to 1 when compiling Google Test itself
1830d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org//                              as a shared library.
1840d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
1850d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// This header defines the following utilities:
1860d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org//
1870d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// Macros indicating the current platform (defined to 1 if compiled on
1880d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// the given platform; otherwise undefined):
1890d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org//   GTEST_OS_AIX      - IBM AIX
1900d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org//   GTEST_OS_CYGWIN   - Cygwin
1910d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org//   GTEST_OS_HPUX     - HP-UX
1920d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org//   GTEST_OS_LINUX    - Linux
1930d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org//     GTEST_OS_LINUX_ANDROID - Google Android
1940d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org//   GTEST_OS_MAC      - Mac OS X
1950d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org//     GTEST_OS_IOS    - iOS
1960d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org//       GTEST_OS_IOS_SIMULATOR - iOS simulator
1970d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org//   GTEST_OS_NACL     - Google Native Client (NaCl)
1980d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org//   GTEST_OS_OPENBSD  - OpenBSD
1990d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org//   GTEST_OS_QNX      - QNX
2000d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org//   GTEST_OS_SOLARIS  - Sun Solaris
2010d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org//   GTEST_OS_SYMBIAN  - Symbian
2020d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org//   GTEST_OS_WINDOWS  - Windows (Desktop, MinGW, or Mobile)
2030d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org//     GTEST_OS_WINDOWS_DESKTOP  - Windows Desktop
2040d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org//     GTEST_OS_WINDOWS_MINGW    - MinGW
2050d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org//     GTEST_OS_WINDOWS_MOBILE   - Windows Mobile
2060d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org//   GTEST_OS_ZOS      - z/OS
2070d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org//
2080d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// Among the platforms, Cygwin, Linux, Max OS X, and Windows have the
2090d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// most stable support.  Since core members of the Google Test project
2100d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// don't have access to other platforms, support for them may be less
2110d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// stable.  If you notice any problems on your platform, please notify
2120d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// googletestframework@googlegroups.com (patches for fixing them are
2130d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// even more welcome!).
2140d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org//
2150d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// Note that it is possible that none of the GTEST_OS_* macros are defined.
2160d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org//
2170d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// Macros indicating available Google Test features (defined to 1 if
2180d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// the corresponding feature is supported; otherwise undefined):
2190d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org//   GTEST_HAS_COMBINE      - the Combine() function (for value-parameterized
2200d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org//                            tests)
2210d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org//   GTEST_HAS_DEATH_TEST   - death tests
2220d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org//   GTEST_HAS_PARAM_TEST   - value-parameterized tests
2230d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org//   GTEST_HAS_TYPED_TEST   - typed tests
2240d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org//   GTEST_HAS_TYPED_TEST_P - type-parameterized tests
2250d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org//   GTEST_USES_POSIX_RE    - enhanced POSIX regex is used. Do not confuse with
2260d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org//                            GTEST_HAS_POSIX_RE (see above) which users can
2270d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org//                            define themselves.
2280d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org//   GTEST_USES_SIMPLE_RE   - our own simple regex is used;
2290d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org//                            the above two are mutually exclusive.
2300d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org//   GTEST_CAN_COMPARE_NULL - accepts untyped NULL in EXPECT_EQ().
2310d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org//
2320d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// Macros for basic C++ coding:
2330d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org//   GTEST_AMBIGUOUS_ELSE_BLOCKER_ - for disabling a gcc warning.
2340d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org//   GTEST_ATTRIBUTE_UNUSED_  - declares that a class' instances or a
2350d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org//                              variable don't have to be used.
2360d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org//   GTEST_DISALLOW_ASSIGN_   - disables operator=.
2370d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org//   GTEST_DISALLOW_COPY_AND_ASSIGN_ - disables copy ctor and operator=.
2380d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org//   GTEST_MUST_USE_RESULT_   - declares that a function's result must be used.
2390d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org//
2400d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// Synchronization:
2410d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org//   Mutex, MutexLock, ThreadLocal, GetThreadCount()
2420d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org//                  - synchronization primitives.
2430d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org//   GTEST_IS_THREADSAFE - defined to 1 to indicate that the above
2440d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org//                         synchronization primitives have real implementations
2450d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org//                         and Google Test is thread-safe; or 0 otherwise.
2460d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org//
2470d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// Template meta programming:
2480d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org//   is_pointer     - as in TR1; needed on Symbian and IBM XL C/C++ only.
2490d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org//   IteratorTraits - partial implementation of std::iterator_traits, which
2500d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org//                    is not available in libCstd when compiled with Sun C++.
2510d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org//
2520d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// Smart pointers:
2530d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org//   scoped_ptr     - as in TR2.
2540d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org//
2550d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// Regular expressions:
2560d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org//   RE             - a simple regular expression class using the POSIX
2570d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org//                    Extended Regular Expression syntax on UNIX-like
2580d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org//                    platforms, or a reduced regular exception syntax on
2590d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org//                    other platforms, including Windows.
2600d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org//
2610d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// Logging:
2620d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org//   GTEST_LOG_()   - logs messages at the specified severity level.
2630d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org//   LogToStderr()  - directs all log messages to stderr.
2640d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org//   FlushInfoLog() - flushes informational log messages.
2650d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org//
2660d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// Stdout and stderr capturing:
2670d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org//   CaptureStdout()     - starts capturing stdout.
2680d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org//   GetCapturedStdout() - stops capturing stdout and returns the captured
2690d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org//                         string.
2700d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org//   CaptureStderr()     - starts capturing stderr.
2710d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org//   GetCapturedStderr() - stops capturing stderr and returns the captured
2720d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org//                         string.
2730d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org//
2740d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// Integer types:
2750d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org//   TypeWithSize   - maps an integer to a int type.
2760d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org//   Int32, UInt32, Int64, UInt64, TimeInMillis
2770d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org//                  - integers of known sizes.
2780d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org//   BiggestInt     - the biggest signed integer type.
2790d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org//
2800d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// Command-line utilities:
2810d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org//   GTEST_FLAG()       - references a flag.
2820d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org//   GTEST_DECLARE_*()  - declares a flag.
2830d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org//   GTEST_DEFINE_*()   - defines a flag.
2840d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org//   GetInjectableArgvs() - returns the command line as a vector of strings.
2850d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org//
2860d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// Environment variable utilities:
2870d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org//   GetEnv()             - gets the value of an environment variable.
2880d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org//   BoolFromGTestEnv()   - parses a bool environment variable.
2890d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org//   Int32FromGTestEnv()  - parses an Int32 environment variable.
2900d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org//   StringFromGTestEnv() - parses a string environment variable.
2910d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
2920d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org#include <ctype.h>   // for isspace, etc
2930d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org#include <stddef.h>  // for ptrdiff_t
2940d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org#include <stdlib.h>
2950d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org#include <stdio.h>
2960d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org#include <string.h>
2970d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org#ifndef _WIN32_WCE
2980d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org# include <sys/types.h>
2990d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org# include <sys/stat.h>
3000d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org#endif  // !_WIN32_WCE
3010d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
3020d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org#if defined __APPLE__
3030d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org# include <AvailabilityMacros.h>
3040d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org# include <TargetConditionals.h>
3050d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org#endif
3060d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
3070d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org#include <iostream>  // NOLINT
3080d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org#include <sstream>  // NOLINT
3090d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org#include <string>  // NOLINT
3100d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
3110d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org#define GTEST_DEV_EMAIL_ "googletestframework@@googlegroups.com"
3120d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org#define GTEST_FLAG_PREFIX_ "gtest_"
3130d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org#define GTEST_FLAG_PREFIX_DASH_ "gtest-"
3140d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org#define GTEST_FLAG_PREFIX_UPPER_ "GTEST_"
3150d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org#define GTEST_NAME_ "Google Test"
3160d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org#define GTEST_PROJECT_URL_ "http://code.google.com/p/googletest/"
3170d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
3180d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// Determines the version of gcc that is used to compile this.
3190d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org#ifdef __GNUC__
3200d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// 40302 means version 4.3.2.
3210d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org# define GTEST_GCC_VER_ \
3220d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org    (__GNUC__*10000 + __GNUC_MINOR__*100 + __GNUC_PATCHLEVEL__)
3230d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org#endif  // __GNUC__
3240d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
3250d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// Determines the platform on which Google Test is compiled.
3260d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org#ifdef __CYGWIN__
3270d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org# define GTEST_OS_CYGWIN 1
3280d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org#elif defined __SYMBIAN32__
3290d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org# define GTEST_OS_SYMBIAN 1
3300d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org#elif defined _WIN32
3310d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org# define GTEST_OS_WINDOWS 1
3320d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org# ifdef _WIN32_WCE
3330d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org#  define GTEST_OS_WINDOWS_MOBILE 1
3340d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org# elif defined(__MINGW__) || defined(__MINGW32__)
3350d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org#  define GTEST_OS_WINDOWS_MINGW 1
3360d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org# else
3370d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org#  define GTEST_OS_WINDOWS_DESKTOP 1
3380d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org# endif  // _WIN32_WCE
3390d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org#elif defined __APPLE__
3400d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org# define GTEST_OS_MAC 1
3410d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org# if TARGET_OS_IPHONE
3420d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org#  define GTEST_OS_IOS 1
3430d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org#  if TARGET_IPHONE_SIMULATOR
3440d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org#   define GTEST_OS_IOS_SIMULATOR 1
3450d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org#  endif
3460d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org# endif
3470d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org#elif defined __linux__
3480d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org# define GTEST_OS_LINUX 1
3490d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org# if defined __ANDROID__
3500d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org#  define GTEST_OS_LINUX_ANDROID 1
3510d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org# endif
3520d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org#elif defined __MVS__
3530d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org# define GTEST_OS_ZOS 1
3540d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org#elif defined(__sun) && defined(__SVR4)
3550d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org# define GTEST_OS_SOLARIS 1
3560d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org#elif defined(_AIX)
3570d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org# define GTEST_OS_AIX 1
3580d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org#elif defined(__hpux)
3590d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org# define GTEST_OS_HPUX 1
3600d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org#elif defined __native_client__
3610d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org# define GTEST_OS_NACL 1
3620d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org#elif defined __OpenBSD__
3630d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org# define GTEST_OS_OPENBSD 1
3640d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org#elif defined __QNX__
3650d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org# define GTEST_OS_QNX 1
3660d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org#endif  // __CYGWIN__
3670d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
3680d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org#ifndef GTEST_LANG_CXX11
3690d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// gcc and clang define __GXX_EXPERIMENTAL_CXX0X__ when
3700d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// -std={c,gnu}++{0x,11} is passed.  The C++11 standard specifies a
3710d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// value for __cplusplus, and recent versions of clang, gcc, and
3720d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// probably other compilers set that too in C++11 mode.
3730d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org# if __GXX_EXPERIMENTAL_CXX0X__ || __cplusplus >= 201103L
3740d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// Compiling in at least C++11 mode.
3750d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org#  define GTEST_LANG_CXX11 1
3760d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org# else
3770d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org#  define GTEST_LANG_CXX11 0
3780d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org# endif
3790d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org#endif
3800d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
3810d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// Brings in definitions for functions used in the testing::internal::posix
3820d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// namespace (read, write, close, chdir, isatty, stat). We do not currently
3830d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// use them on Windows Mobile.
3840d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org#if !GTEST_OS_WINDOWS
3850d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// This assumes that non-Windows OSes provide unistd.h. For OSes where this
3860d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// is not the case, we need to include headers that provide the functions
3870d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// mentioned above.
3880d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org# include <unistd.h>
3890d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org# include <strings.h>
3900d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org#elif !GTEST_OS_WINDOWS_MOBILE
3910d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org# include <direct.h>
3920d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org# include <io.h>
3930d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org#endif
3940d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
3950d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org#if GTEST_OS_LINUX_ANDROID
3960d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// Used to define __ANDROID_API__ matching the target NDK API level.
3970d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org#  include <android/api-level.h>  // NOLINT
3980d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org#endif
3990d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
4000d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// Defines this to true iff Google Test can use POSIX regular expressions.
4010d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org#ifndef GTEST_HAS_POSIX_RE
4020d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org# if GTEST_OS_LINUX_ANDROID
4030d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// On Android, <regex.h> is only available starting with Gingerbread.
4040d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org#  define GTEST_HAS_POSIX_RE (__ANDROID_API__ >= 9)
4050d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org# else
4060d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org#  define GTEST_HAS_POSIX_RE (!GTEST_OS_WINDOWS)
4070d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org# endif
4080d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org#endif
4090d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
4100d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org#if GTEST_HAS_POSIX_RE
4110d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
4120d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// On some platforms, <regex.h> needs someone to define size_t, and
4130d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// won't compile otherwise.  We can #include it here as we already
4140d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// included <stdlib.h>, which is guaranteed to define size_t through
4150d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// <stddef.h>.
4160d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org# include <regex.h>  // NOLINT
4170d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
4180d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org# define GTEST_USES_POSIX_RE 1
4190d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
4200d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org#elif GTEST_OS_WINDOWS
4210d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
4220d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// <regex.h> is not available on Windows.  Use our own simple regex
4230d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// implementation instead.
4240d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org# define GTEST_USES_SIMPLE_RE 1
4250d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
4260d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org#else
4270d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
4280d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// <regex.h> may not be available on this platform.  Use our own
4290d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// simple regex implementation instead.
4300d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org# define GTEST_USES_SIMPLE_RE 1
4310d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
4320d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org#endif  // GTEST_HAS_POSIX_RE
4330d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
4340d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org#ifndef GTEST_HAS_EXCEPTIONS
4350d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// The user didn't tell us whether exceptions are enabled, so we need
4360d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// to figure it out.
4370d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org# if defined(_MSC_VER) || defined(__BORLANDC__)
4380d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// MSVC's and C++Builder's implementations of the STL use the _HAS_EXCEPTIONS
4390d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// macro to enable exceptions, so we'll do the same.
4400d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// Assumes that exceptions are enabled by default.
4410d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org#  ifndef _HAS_EXCEPTIONS
4420d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org#   define _HAS_EXCEPTIONS 1
4430d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org#  endif  // _HAS_EXCEPTIONS
4440d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org#  define GTEST_HAS_EXCEPTIONS _HAS_EXCEPTIONS
4450d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org# elif defined(__GNUC__) && __EXCEPTIONS
4460d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// gcc defines __EXCEPTIONS to 1 iff exceptions are enabled.
4470d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org#  define GTEST_HAS_EXCEPTIONS 1
4480d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org# elif defined(__SUNPRO_CC)
4490d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// Sun Pro CC supports exceptions.  However, there is no compile-time way of
4500d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// detecting whether they are enabled or not.  Therefore, we assume that
4510d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// they are enabled unless the user tells us otherwise.
4520d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org#  define GTEST_HAS_EXCEPTIONS 1
4530d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org# elif defined(__IBMCPP__) && __EXCEPTIONS
4540d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// xlC defines __EXCEPTIONS to 1 iff exceptions are enabled.
4550d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org#  define GTEST_HAS_EXCEPTIONS 1
4560d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org# elif defined(__HP_aCC)
4570d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// Exception handling is in effect by default in HP aCC compiler. It has to
4580d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// be turned of by +noeh compiler option if desired.
4590d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org#  define GTEST_HAS_EXCEPTIONS 1
4600d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org# else
4610d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// For other compilers, we assume exceptions are disabled to be
4620d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// conservative.
4630d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org#  define GTEST_HAS_EXCEPTIONS 0
4640d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org# endif  // defined(_MSC_VER) || defined(__BORLANDC__)
4650d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org#endif  // GTEST_HAS_EXCEPTIONS
4660d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
4670d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org#if !defined(GTEST_HAS_STD_STRING)
4680d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// Even though we don't use this macro any longer, we keep it in case
4690d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// some clients still depend on it.
4700d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org# define GTEST_HAS_STD_STRING 1
4710d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org#elif !GTEST_HAS_STD_STRING
4720d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// The user told us that ::std::string isn't available.
4730d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org# error "Google Test cannot be used where ::std::string isn't available."
4740d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org#endif  // !defined(GTEST_HAS_STD_STRING)
4750d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
4760d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org#ifndef GTEST_HAS_GLOBAL_STRING
4770d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// The user didn't tell us whether ::string is available, so we need
4780d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// to figure it out.
4790d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
4800d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org# define GTEST_HAS_GLOBAL_STRING 0
4810d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
4820d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org#endif  // GTEST_HAS_GLOBAL_STRING
4830d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
4840d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org#ifndef GTEST_HAS_STD_WSTRING
4850d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// The user didn't tell us whether ::std::wstring is available, so we need
4860d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// to figure it out.
4870d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// TODO(wan@google.com): uses autoconf to detect whether ::std::wstring
4880d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org//   is available.
4890d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
4900d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// Cygwin 1.7 and below doesn't support ::std::wstring.
4910d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// Solaris' libc++ doesn't support it either.  Android has
4920d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// no support for it at least as recent as Froyo (2.2).
4930d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org# define GTEST_HAS_STD_WSTRING \
4940d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org    (!(GTEST_OS_LINUX_ANDROID || GTEST_OS_CYGWIN || GTEST_OS_SOLARIS))
4950d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
4960d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org#endif  // GTEST_HAS_STD_WSTRING
4970d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
4980d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org#ifndef GTEST_HAS_GLOBAL_WSTRING
4990d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// The user didn't tell us whether ::wstring is available, so we need
5000d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// to figure it out.
5010d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org# define GTEST_HAS_GLOBAL_WSTRING \
5020d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org    (GTEST_HAS_STD_WSTRING && GTEST_HAS_GLOBAL_STRING)
5030d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org#endif  // GTEST_HAS_GLOBAL_WSTRING
5040d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
5050d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// Determines whether RTTI is available.
5060d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org#ifndef GTEST_HAS_RTTI
5070d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// The user didn't tell us whether RTTI is enabled, so we need to
5080d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// figure it out.
5090d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
5100d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org# ifdef _MSC_VER
5110d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
5120d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org#  ifdef _CPPRTTI  // MSVC defines this macro iff RTTI is enabled.
5130d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org#   define GTEST_HAS_RTTI 1
5140d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org#  else
5150d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org#   define GTEST_HAS_RTTI 0
5160d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org#  endif
5170d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
5180d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// Starting with version 4.3.2, gcc defines __GXX_RTTI iff RTTI is enabled.
5190d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org# elif defined(__GNUC__) && (GTEST_GCC_VER_ >= 40302)
5200d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
5210d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org#  ifdef __GXX_RTTI
5220d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// When building against STLport with the Android NDK and with
5230d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// -frtti -fno-exceptions, the build fails at link time with undefined
5240d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// references to __cxa_bad_typeid. Note sure if STL or toolchain bug,
5250d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// so disable RTTI when detected.
5260d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org#   if GTEST_OS_LINUX_ANDROID && defined(_STLPORT_MAJOR) && \
5270d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org       !defined(__EXCEPTIONS)
5280d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org#    define GTEST_HAS_RTTI 0
5290d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org#   else
5300d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org#    define GTEST_HAS_RTTI 1
5310d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org#   endif  // GTEST_OS_LINUX_ANDROID && __STLPORT_MAJOR && !__EXCEPTIONS
5320d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org#  else
5330d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org#   define GTEST_HAS_RTTI 0
5340d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org#  endif  // __GXX_RTTI
5350d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
5360d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// Clang defines __GXX_RTTI starting with version 3.0, but its manual recommends
5370d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// using has_feature instead. has_feature(cxx_rtti) is supported since 2.7, the
5380d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// first version with C++ support.
5390d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org# elif defined(__clang__)
5400d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
5410d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org#  define GTEST_HAS_RTTI __has_feature(cxx_rtti)
5420d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
5430d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// Starting with version 9.0 IBM Visual Age defines __RTTI_ALL__ to 1 if
5440d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// both the typeid and dynamic_cast features are present.
5450d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org# elif defined(__IBMCPP__) && (__IBMCPP__ >= 900)
5460d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
5470d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org#  ifdef __RTTI_ALL__
5480d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org#   define GTEST_HAS_RTTI 1
5490d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org#  else
5500d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org#   define GTEST_HAS_RTTI 0
5510d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org#  endif
5520d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
5530d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org# else
5540d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
5550d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// For all other compilers, we assume RTTI is enabled.
5560d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org#  define GTEST_HAS_RTTI 1
5570d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
5580d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org# endif  // _MSC_VER
5590d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
5600d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org#endif  // GTEST_HAS_RTTI
5610d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
5620d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// It's this header's responsibility to #include <typeinfo> when RTTI
5630d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// is enabled.
5640d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org#if GTEST_HAS_RTTI
5650d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org# include <typeinfo>
5660d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org#endif
5670d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
5680d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// Determines whether Google Test can use the pthreads library.
5690d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org#ifndef GTEST_HAS_PTHREAD
5700d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// The user didn't tell us explicitly, so we assume pthreads support is
5710d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// available on Linux and Mac.
5720d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org//
5730d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// To disable threading support in Google Test, add -DGTEST_HAS_PTHREAD=0
5740d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// to your compiler flags.
5750d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org# define GTEST_HAS_PTHREAD (GTEST_OS_LINUX || GTEST_OS_MAC || GTEST_OS_HPUX \
5760d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org    || GTEST_OS_QNX)
5770d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org#endif  // GTEST_HAS_PTHREAD
5780d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
5790d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org#if GTEST_HAS_PTHREAD
5800d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// gtest-port.h guarantees to #include <pthread.h> when GTEST_HAS_PTHREAD is
5810d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// true.
5820d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org# include <pthread.h>  // NOLINT
5830d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
5840d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// For timespec and nanosleep, used below.
5850d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org# include <time.h>  // NOLINT
5860d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org#endif
5870d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
5880d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// Determines whether Google Test can use tr1/tuple.  You can define
5890d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// this macro to 0 to prevent Google Test from using tuple (any
5900d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// feature depending on tuple with be disabled in this mode).
5910d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org#ifndef GTEST_HAS_TR1_TUPLE
5920d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org# if GTEST_OS_LINUX_ANDROID && defined(_STLPORT_MAJOR)
5930d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// STLport, provided with the Android NDK, has neither <tr1/tuple> or <tuple>.
5940d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org#  define GTEST_HAS_TR1_TUPLE 0
5950d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org# else
5960d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// The user didn't tell us not to do it, so we assume it's OK.
5970d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org#  define GTEST_HAS_TR1_TUPLE 1
5980d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org# endif
5990d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org#endif  // GTEST_HAS_TR1_TUPLE
6000d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
6010d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// Determines whether Google Test's own tr1 tuple implementation
6020d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// should be used.
6030d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org#ifndef GTEST_USE_OWN_TR1_TUPLE
6040d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// The user didn't tell us, so we need to figure it out.
6050d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
6060d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// We use our own TR1 tuple if we aren't sure the user has an
6070d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// implementation of it already.  At this time, libstdc++ 4.0.0+ and
6080d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// MSVC 2010 are the only mainstream standard libraries that come
6090d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// with a TR1 tuple implementation.  NVIDIA's CUDA NVCC compiler
6100d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// pretends to be GCC by defining __GNUC__ and friends, but cannot
6110d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// compile GCC's tuple implementation.  MSVC 2008 (9.0) provides TR1
6120d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// tuple in a 323 MB Feature Pack download, which we cannot assume the
6130d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// user has.  QNX's QCC compiler is a modified GCC but it doesn't
6140d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// support TR1 tuple.  libc++ only provides std::tuple, in C++11 mode,
6150d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// and it can be used with some compilers that define __GNUC__.
6160d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org# if (defined(__GNUC__) && !defined(__CUDACC__) && (GTEST_GCC_VER_ >= 40000) \
6170d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org      && !GTEST_OS_QNX && !defined(_LIBCPP_VERSION)) || _MSC_VER >= 1600
6180d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org#  define GTEST_ENV_HAS_TR1_TUPLE_ 1
6190d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org# endif
6200d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
6210d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// C++11 specifies that <tuple> provides std::tuple. Use that if gtest is used
6220d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// in C++11 mode and libstdc++ isn't very old (binaries targeting OS X 10.6
6230d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// can build with clang but need to use gcc4.2's libstdc++).
6240d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org# if GTEST_LANG_CXX11 && (!defined(__GLIBCXX__) || __GLIBCXX__ > 20110325)
6250d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org#  define GTEST_ENV_HAS_STD_TUPLE_ 1
6260d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org# endif
6270d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
6280d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org# if GTEST_ENV_HAS_TR1_TUPLE_ || GTEST_ENV_HAS_STD_TUPLE_
6290d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org#  define GTEST_USE_OWN_TR1_TUPLE 0
6300d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org# else
6310d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org#  define GTEST_USE_OWN_TR1_TUPLE 1
6320d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org# endif
6330d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
6340d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org#endif  // GTEST_USE_OWN_TR1_TUPLE
6350d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
6360d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// To avoid conditional compilation everywhere, we make it
6370d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// gtest-port.h's responsibility to #include the header implementing
6380d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// tr1/tuple.
6390d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org#if GTEST_HAS_TR1_TUPLE
6400d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
6410d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org# if GTEST_USE_OWN_TR1_TUPLE
6420d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// This file was GENERATED by command:
6430d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org//     pump.py gtest-tuple.h.pump
6440d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// DO NOT EDIT BY HAND!!!
6450d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
6460d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// Copyright 2009 Google Inc.
6470d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// All Rights Reserved.
6480d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org//
6490d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// Redistribution and use in source and binary forms, with or without
6500d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// modification, are permitted provided that the following conditions are
6510d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// met:
6520d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org//
6530d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org//     * Redistributions of source code must retain the above copyright
6540d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// notice, this list of conditions and the following disclaimer.
6550d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org//     * Redistributions in binary form must reproduce the above
6560d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// copyright notice, this list of conditions and the following disclaimer
6570d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// in the documentation and/or other materials provided with the
6580d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// distribution.
6590d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org//     * Neither the name of Google Inc. nor the names of its
6600d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// contributors may be used to endorse or promote products derived from
6610d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// this software without specific prior written permission.
6620d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org//
6630d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
6640d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
6650d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
6660d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
6670d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
6680d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
6690d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
6700d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
6710d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
6720d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
6730d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
6740d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org//
6750d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// Author: wan@google.com (Zhanyong Wan)
6760d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
6770d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// Implements a subset of TR1 tuple needed by Google Test and Google Mock.
6780d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
6790d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org#ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_TUPLE_H_
6800d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org#define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_TUPLE_H_
6810d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
6820d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org#include <utility>  // For ::std::pair.
6830d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
6840d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// The compiler used in Symbian has a bug that prevents us from declaring the
6850d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// tuple template as a friend (it complains that tuple is redefined).  This
6860d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// hack bypasses the bug by declaring the members that should otherwise be
6870d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// private as public.
6880d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// Sun Studio versions < 12 also have the above bug.
6890d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org#if defined(__SYMBIAN32__) || (defined(__SUNPRO_CC) && __SUNPRO_CC < 0x590)
6900d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org# define GTEST_DECLARE_TUPLE_AS_FRIEND_ public:
6910d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org#else
6920d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org# define GTEST_DECLARE_TUPLE_AS_FRIEND_ \
6930d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org    template <GTEST_10_TYPENAMES_(U)> friend class tuple; \
6940d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org   private:
6950d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org#endif
6960d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
6970d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// GTEST_n_TUPLE_(T) is the type of an n-tuple.
6980d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org#define GTEST_0_TUPLE_(T) tuple<>
6990d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org#define GTEST_1_TUPLE_(T) tuple<T##0, void, void, void, void, void, void, \
7000d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org    void, void, void>
7010d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org#define GTEST_2_TUPLE_(T) tuple<T##0, T##1, void, void, void, void, void, \
7020d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org    void, void, void>
7030d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org#define GTEST_3_TUPLE_(T) tuple<T##0, T##1, T##2, void, void, void, void, \
7040d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org    void, void, void>
7050d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org#define GTEST_4_TUPLE_(T) tuple<T##0, T##1, T##2, T##3, void, void, void, \
7060d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org    void, void, void>
7070d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org#define GTEST_5_TUPLE_(T) tuple<T##0, T##1, T##2, T##3, T##4, void, void, \
7080d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org    void, void, void>
7090d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org#define GTEST_6_TUPLE_(T) tuple<T##0, T##1, T##2, T##3, T##4, T##5, void, \
7100d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org    void, void, void>
7110d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org#define GTEST_7_TUPLE_(T) tuple<T##0, T##1, T##2, T##3, T##4, T##5, T##6, \
7120d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org    void, void, void>
7130d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org#define GTEST_8_TUPLE_(T) tuple<T##0, T##1, T##2, T##3, T##4, T##5, T##6, \
7140d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org    T##7, void, void>
7150d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org#define GTEST_9_TUPLE_(T) tuple<T##0, T##1, T##2, T##3, T##4, T##5, T##6, \
7160d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org    T##7, T##8, void>
7170d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org#define GTEST_10_TUPLE_(T) tuple<T##0, T##1, T##2, T##3, T##4, T##5, T##6, \
7180d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org    T##7, T##8, T##9>
7190d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
7200d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// GTEST_n_TYPENAMES_(T) declares a list of n typenames.
7210d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org#define GTEST_0_TYPENAMES_(T)
7220d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org#define GTEST_1_TYPENAMES_(T) typename T##0
7230d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org#define GTEST_2_TYPENAMES_(T) typename T##0, typename T##1
7240d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org#define GTEST_3_TYPENAMES_(T) typename T##0, typename T##1, typename T##2
7250d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org#define GTEST_4_TYPENAMES_(T) typename T##0, typename T##1, typename T##2, \
7260d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org    typename T##3
7270d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org#define GTEST_5_TYPENAMES_(T) typename T##0, typename T##1, typename T##2, \
7280d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org    typename T##3, typename T##4
7290d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org#define GTEST_6_TYPENAMES_(T) typename T##0, typename T##1, typename T##2, \
7300d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org    typename T##3, typename T##4, typename T##5
7310d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org#define GTEST_7_TYPENAMES_(T) typename T##0, typename T##1, typename T##2, \
7320d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org    typename T##3, typename T##4, typename T##5, typename T##6
7330d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org#define GTEST_8_TYPENAMES_(T) typename T##0, typename T##1, typename T##2, \
7340d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org    typename T##3, typename T##4, typename T##5, typename T##6, typename T##7
7350d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org#define GTEST_9_TYPENAMES_(T) typename T##0, typename T##1, typename T##2, \
7360d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org    typename T##3, typename T##4, typename T##5, typename T##6, \
7370d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org    typename T##7, typename T##8
7380d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org#define GTEST_10_TYPENAMES_(T) typename T##0, typename T##1, typename T##2, \
7390d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org    typename T##3, typename T##4, typename T##5, typename T##6, \
7400d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org    typename T##7, typename T##8, typename T##9
7410d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
7420d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// In theory, defining stuff in the ::std namespace is undefined
7430d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// behavior.  We can do this as we are playing the role of a standard
7440d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// library vendor.
7450d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.orgnamespace std {
7460d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.orgnamespace tr1 {
7470d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
7480d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.orgtemplate <typename T0 = void, typename T1 = void, typename T2 = void,
7490d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org    typename T3 = void, typename T4 = void, typename T5 = void,
7500d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org    typename T6 = void, typename T7 = void, typename T8 = void,
7510d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org    typename T9 = void>
7520d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.orgclass tuple;
7530d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
7540d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// Anything in namespace gtest_internal is Google Test's INTERNAL
7550d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// IMPLEMENTATION DETAIL and MUST NOT BE USED DIRECTLY in user code.
7560d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.orgnamespace gtest_internal {
7570d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
7580d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// ByRef<T>::type is T if T is a reference; otherwise it's const T&.
7590d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.orgtemplate <typename T>
7600d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.orgstruct ByRef { typedef const T& type; };  // NOLINT
7610d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.orgtemplate <typename T>
7620d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.orgstruct ByRef<T&> { typedef T& type; };  // NOLINT
7630d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
7640d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// A handy wrapper for ByRef.
7650d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org#define GTEST_BY_REF_(T) typename ::std::tr1::gtest_internal::ByRef<T>::type
7660d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
7670d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// AddRef<T>::type is T if T is a reference; otherwise it's T&.  This
7680d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// is the same as tr1::add_reference<T>::type.
7690d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.orgtemplate <typename T>
7700d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.orgstruct AddRef { typedef T& type; };  // NOLINT
7710d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.orgtemplate <typename T>
7720d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.orgstruct AddRef<T&> { typedef T& type; };  // NOLINT
7730d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
7740d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// A handy wrapper for AddRef.
7750d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org#define GTEST_ADD_REF_(T) typename ::std::tr1::gtest_internal::AddRef<T>::type
7760d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
7770d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// A helper for implementing get<k>().
7780d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.orgtemplate <int k> class Get;
7790d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
7800d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// A helper for implementing tuple_element<k, T>.  kIndexValid is true
7810d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// iff k < the number of fields in tuple type T.
7820d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.orgtemplate <bool kIndexValid, int kIndex, class Tuple>
7830d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.orgstruct TupleElement;
7840d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
7850d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.orgtemplate <GTEST_10_TYPENAMES_(T)>
7860d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.orgstruct TupleElement<true, 0, GTEST_10_TUPLE_(T) > {
7870d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  typedef T0 type;
7880d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org};
7890d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
7900d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.orgtemplate <GTEST_10_TYPENAMES_(T)>
7910d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.orgstruct TupleElement<true, 1, GTEST_10_TUPLE_(T) > {
7920d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  typedef T1 type;
7930d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org};
7940d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
7950d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.orgtemplate <GTEST_10_TYPENAMES_(T)>
7960d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.orgstruct TupleElement<true, 2, GTEST_10_TUPLE_(T) > {
7970d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  typedef T2 type;
7980d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org};
7990d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
8000d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.orgtemplate <GTEST_10_TYPENAMES_(T)>
8010d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.orgstruct TupleElement<true, 3, GTEST_10_TUPLE_(T) > {
8020d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  typedef T3 type;
8030d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org};
8040d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
8050d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.orgtemplate <GTEST_10_TYPENAMES_(T)>
8060d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.orgstruct TupleElement<true, 4, GTEST_10_TUPLE_(T) > {
8070d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  typedef T4 type;
8080d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org};
8090d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
8100d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.orgtemplate <GTEST_10_TYPENAMES_(T)>
8110d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.orgstruct TupleElement<true, 5, GTEST_10_TUPLE_(T) > {
8120d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  typedef T5 type;
8130d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org};
8140d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
8150d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.orgtemplate <GTEST_10_TYPENAMES_(T)>
8160d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.orgstruct TupleElement<true, 6, GTEST_10_TUPLE_(T) > {
8170d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  typedef T6 type;
8180d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org};
8190d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
8200d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.orgtemplate <GTEST_10_TYPENAMES_(T)>
8210d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.orgstruct TupleElement<true, 7, GTEST_10_TUPLE_(T) > {
8220d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  typedef T7 type;
8230d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org};
8240d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
8250d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.orgtemplate <GTEST_10_TYPENAMES_(T)>
8260d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.orgstruct TupleElement<true, 8, GTEST_10_TUPLE_(T) > {
8270d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  typedef T8 type;
8280d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org};
8290d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
8300d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.orgtemplate <GTEST_10_TYPENAMES_(T)>
8310d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.orgstruct TupleElement<true, 9, GTEST_10_TUPLE_(T) > {
8320d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  typedef T9 type;
8330d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org};
8340d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
8350d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org}  // namespace gtest_internal
8360d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
8370d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.orgtemplate <>
8380d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.orgclass tuple<> {
8390d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org public:
8400d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  tuple() {}
8410d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  tuple(const tuple& /* t */)  {}
8420d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  tuple& operator=(const tuple& /* t */) { return *this; }
8430d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org};
8440d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
8450d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.orgtemplate <GTEST_1_TYPENAMES_(T)>
8460d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.orgclass GTEST_1_TUPLE_(T) {
8470d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org public:
8480d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  template <int k> friend class gtest_internal::Get;
8490d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
8500d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  tuple() : f0_() {}
8510d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
8520d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  explicit tuple(GTEST_BY_REF_(T0) f0) : f0_(f0) {}
8530d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
8540d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  tuple(const tuple& t) : f0_(t.f0_) {}
8550d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
8560d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  template <GTEST_1_TYPENAMES_(U)>
8570d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  tuple(const GTEST_1_TUPLE_(U)& t) : f0_(t.f0_) {}
8580d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
8590d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  tuple& operator=(const tuple& t) { return CopyFrom(t); }
8600d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
8610d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  template <GTEST_1_TYPENAMES_(U)>
8620d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  tuple& operator=(const GTEST_1_TUPLE_(U)& t) {
8630d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org    return CopyFrom(t);
8640d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  }
8650d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
8660d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  GTEST_DECLARE_TUPLE_AS_FRIEND_
8670d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
8680d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  template <GTEST_1_TYPENAMES_(U)>
8690d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  tuple& CopyFrom(const GTEST_1_TUPLE_(U)& t) {
8700d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org    f0_ = t.f0_;
8710d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org    return *this;
8720d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  }
8730d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
8740d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  T0 f0_;
8750d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org};
8760d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
8770d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.orgtemplate <GTEST_2_TYPENAMES_(T)>
8780d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.orgclass GTEST_2_TUPLE_(T) {
8790d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org public:
8800d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  template <int k> friend class gtest_internal::Get;
8810d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
8820d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  tuple() : f0_(), f1_() {}
8830d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
8840d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  explicit tuple(GTEST_BY_REF_(T0) f0, GTEST_BY_REF_(T1) f1) : f0_(f0),
8850d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org      f1_(f1) {}
8860d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
8870d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  tuple(const tuple& t) : f0_(t.f0_), f1_(t.f1_) {}
8880d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
8890d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  template <GTEST_2_TYPENAMES_(U)>
8900d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  tuple(const GTEST_2_TUPLE_(U)& t) : f0_(t.f0_), f1_(t.f1_) {}
8910d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  template <typename U0, typename U1>
8920d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  tuple(const ::std::pair<U0, U1>& p) : f0_(p.first), f1_(p.second) {}
8930d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
8940d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  tuple& operator=(const tuple& t) { return CopyFrom(t); }
8950d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
8960d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  template <GTEST_2_TYPENAMES_(U)>
8970d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  tuple& operator=(const GTEST_2_TUPLE_(U)& t) {
8980d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org    return CopyFrom(t);
8990d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  }
9000d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  template <typename U0, typename U1>
9010d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  tuple& operator=(const ::std::pair<U0, U1>& p) {
9020d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org    f0_ = p.first;
9030d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org    f1_ = p.second;
9040d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org    return *this;
9050d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  }
9060d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
9070d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  GTEST_DECLARE_TUPLE_AS_FRIEND_
9080d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
9090d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  template <GTEST_2_TYPENAMES_(U)>
9100d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  tuple& CopyFrom(const GTEST_2_TUPLE_(U)& t) {
9110d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org    f0_ = t.f0_;
9120d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org    f1_ = t.f1_;
9130d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org    return *this;
9140d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  }
9150d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
9160d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  T0 f0_;
9170d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  T1 f1_;
9180d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org};
9190d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
9200d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.orgtemplate <GTEST_3_TYPENAMES_(T)>
9210d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.orgclass GTEST_3_TUPLE_(T) {
9220d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org public:
9230d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  template <int k> friend class gtest_internal::Get;
9240d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
9250d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  tuple() : f0_(), f1_(), f2_() {}
9260d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
9270d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  explicit tuple(GTEST_BY_REF_(T0) f0, GTEST_BY_REF_(T1) f1,
9280d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org      GTEST_BY_REF_(T2) f2) : f0_(f0), f1_(f1), f2_(f2) {}
9290d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
9300d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  tuple(const tuple& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_) {}
9310d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
9320d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  template <GTEST_3_TYPENAMES_(U)>
9330d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  tuple(const GTEST_3_TUPLE_(U)& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_) {}
9340d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
9350d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  tuple& operator=(const tuple& t) { return CopyFrom(t); }
9360d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
9370d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  template <GTEST_3_TYPENAMES_(U)>
9380d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  tuple& operator=(const GTEST_3_TUPLE_(U)& t) {
9390d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org    return CopyFrom(t);
9400d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  }
9410d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
9420d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  GTEST_DECLARE_TUPLE_AS_FRIEND_
9430d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
9440d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  template <GTEST_3_TYPENAMES_(U)>
9450d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  tuple& CopyFrom(const GTEST_3_TUPLE_(U)& t) {
9460d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org    f0_ = t.f0_;
9470d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org    f1_ = t.f1_;
9480d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org    f2_ = t.f2_;
9490d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org    return *this;
9500d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  }
9510d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
9520d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  T0 f0_;
9530d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  T1 f1_;
9540d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  T2 f2_;
9550d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org};
9560d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
9570d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.orgtemplate <GTEST_4_TYPENAMES_(T)>
9580d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.orgclass GTEST_4_TUPLE_(T) {
9590d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org public:
9600d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  template <int k> friend class gtest_internal::Get;
9610d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
9620d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  tuple() : f0_(), f1_(), f2_(), f3_() {}
9630d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
9640d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  explicit tuple(GTEST_BY_REF_(T0) f0, GTEST_BY_REF_(T1) f1,
9650d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org      GTEST_BY_REF_(T2) f2, GTEST_BY_REF_(T3) f3) : f0_(f0), f1_(f1), f2_(f2),
9660d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org      f3_(f3) {}
9670d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
9680d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  tuple(const tuple& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_), f3_(t.f3_) {}
9690d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
9700d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  template <GTEST_4_TYPENAMES_(U)>
9710d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  tuple(const GTEST_4_TUPLE_(U)& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_),
9720d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org      f3_(t.f3_) {}
9730d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
9740d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  tuple& operator=(const tuple& t) { return CopyFrom(t); }
9750d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
9760d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  template <GTEST_4_TYPENAMES_(U)>
9770d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  tuple& operator=(const GTEST_4_TUPLE_(U)& t) {
9780d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org    return CopyFrom(t);
9790d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  }
9800d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
9810d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  GTEST_DECLARE_TUPLE_AS_FRIEND_
9820d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
9830d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  template <GTEST_4_TYPENAMES_(U)>
9840d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  tuple& CopyFrom(const GTEST_4_TUPLE_(U)& t) {
9850d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org    f0_ = t.f0_;
9860d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org    f1_ = t.f1_;
9870d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org    f2_ = t.f2_;
9880d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org    f3_ = t.f3_;
9890d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org    return *this;
9900d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  }
9910d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
9920d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  T0 f0_;
9930d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  T1 f1_;
9940d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  T2 f2_;
9950d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  T3 f3_;
9960d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org};
9970d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
9980d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.orgtemplate <GTEST_5_TYPENAMES_(T)>
9990d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.orgclass GTEST_5_TUPLE_(T) {
10000d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org public:
10010d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  template <int k> friend class gtest_internal::Get;
10020d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
10030d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  tuple() : f0_(), f1_(), f2_(), f3_(), f4_() {}
10040d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
10050d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  explicit tuple(GTEST_BY_REF_(T0) f0, GTEST_BY_REF_(T1) f1,
10060d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org      GTEST_BY_REF_(T2) f2, GTEST_BY_REF_(T3) f3,
10070d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org      GTEST_BY_REF_(T4) f4) : f0_(f0), f1_(f1), f2_(f2), f3_(f3), f4_(f4) {}
10080d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
10090d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  tuple(const tuple& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_), f3_(t.f3_),
10100d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org      f4_(t.f4_) {}
10110d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
10120d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  template <GTEST_5_TYPENAMES_(U)>
10130d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  tuple(const GTEST_5_TUPLE_(U)& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_),
10140d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org      f3_(t.f3_), f4_(t.f4_) {}
10150d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
10160d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  tuple& operator=(const tuple& t) { return CopyFrom(t); }
10170d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
10180d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  template <GTEST_5_TYPENAMES_(U)>
10190d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  tuple& operator=(const GTEST_5_TUPLE_(U)& t) {
10200d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org    return CopyFrom(t);
10210d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  }
10220d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
10230d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  GTEST_DECLARE_TUPLE_AS_FRIEND_
10240d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
10250d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  template <GTEST_5_TYPENAMES_(U)>
10260d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  tuple& CopyFrom(const GTEST_5_TUPLE_(U)& t) {
10270d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org    f0_ = t.f0_;
10280d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org    f1_ = t.f1_;
10290d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org    f2_ = t.f2_;
10300d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org    f3_ = t.f3_;
10310d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org    f4_ = t.f4_;
10320d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org    return *this;
10330d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  }
10340d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
10350d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  T0 f0_;
10360d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  T1 f1_;
10370d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  T2 f2_;
10380d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  T3 f3_;
10390d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  T4 f4_;
10400d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org};
10410d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
10420d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.orgtemplate <GTEST_6_TYPENAMES_(T)>
10430d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.orgclass GTEST_6_TUPLE_(T) {
10440d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org public:
10450d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  template <int k> friend class gtest_internal::Get;
10460d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
10470d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  tuple() : f0_(), f1_(), f2_(), f3_(), f4_(), f5_() {}
10480d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
10490d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  explicit tuple(GTEST_BY_REF_(T0) f0, GTEST_BY_REF_(T1) f1,
10500d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org      GTEST_BY_REF_(T2) f2, GTEST_BY_REF_(T3) f3, GTEST_BY_REF_(T4) f4,
10510d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org      GTEST_BY_REF_(T5) f5) : f0_(f0), f1_(f1), f2_(f2), f3_(f3), f4_(f4),
10520d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org      f5_(f5) {}
10530d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
10540d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  tuple(const tuple& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_), f3_(t.f3_),
10550d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org      f4_(t.f4_), f5_(t.f5_) {}
10560d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
10570d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  template <GTEST_6_TYPENAMES_(U)>
10580d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  tuple(const GTEST_6_TUPLE_(U)& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_),
10590d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org      f3_(t.f3_), f4_(t.f4_), f5_(t.f5_) {}
10600d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
10610d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  tuple& operator=(const tuple& t) { return CopyFrom(t); }
10620d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
10630d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  template <GTEST_6_TYPENAMES_(U)>
10640d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  tuple& operator=(const GTEST_6_TUPLE_(U)& t) {
10650d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org    return CopyFrom(t);
10660d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  }
10670d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
10680d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  GTEST_DECLARE_TUPLE_AS_FRIEND_
10690d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
10700d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  template <GTEST_6_TYPENAMES_(U)>
10710d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  tuple& CopyFrom(const GTEST_6_TUPLE_(U)& t) {
10720d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org    f0_ = t.f0_;
10730d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org    f1_ = t.f1_;
10740d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org    f2_ = t.f2_;
10750d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org    f3_ = t.f3_;
10760d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org    f4_ = t.f4_;
10770d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org    f5_ = t.f5_;
10780d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org    return *this;
10790d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  }
10800d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
10810d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  T0 f0_;
10820d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  T1 f1_;
10830d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  T2 f2_;
10840d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  T3 f3_;
10850d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  T4 f4_;
10860d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  T5 f5_;
10870d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org};
10880d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
10890d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.orgtemplate <GTEST_7_TYPENAMES_(T)>
10900d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.orgclass GTEST_7_TUPLE_(T) {
10910d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org public:
10920d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  template <int k> friend class gtest_internal::Get;
10930d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
10940d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  tuple() : f0_(), f1_(), f2_(), f3_(), f4_(), f5_(), f6_() {}
10950d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
10960d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  explicit tuple(GTEST_BY_REF_(T0) f0, GTEST_BY_REF_(T1) f1,
10970d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org      GTEST_BY_REF_(T2) f2, GTEST_BY_REF_(T3) f3, GTEST_BY_REF_(T4) f4,
10980d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org      GTEST_BY_REF_(T5) f5, GTEST_BY_REF_(T6) f6) : f0_(f0), f1_(f1), f2_(f2),
10990d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org      f3_(f3), f4_(f4), f5_(f5), f6_(f6) {}
11000d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
11010d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  tuple(const tuple& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_), f3_(t.f3_),
11020d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org      f4_(t.f4_), f5_(t.f5_), f6_(t.f6_) {}
11030d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
11040d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  template <GTEST_7_TYPENAMES_(U)>
11050d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  tuple(const GTEST_7_TUPLE_(U)& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_),
11060d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org      f3_(t.f3_), f4_(t.f4_), f5_(t.f5_), f6_(t.f6_) {}
11070d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
11080d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  tuple& operator=(const tuple& t) { return CopyFrom(t); }
11090d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
11100d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  template <GTEST_7_TYPENAMES_(U)>
11110d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  tuple& operator=(const GTEST_7_TUPLE_(U)& t) {
11120d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org    return CopyFrom(t);
11130d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  }
11140d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
11150d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  GTEST_DECLARE_TUPLE_AS_FRIEND_
11160d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
11170d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  template <GTEST_7_TYPENAMES_(U)>
11180d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  tuple& CopyFrom(const GTEST_7_TUPLE_(U)& t) {
11190d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org    f0_ = t.f0_;
11200d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org    f1_ = t.f1_;
11210d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org    f2_ = t.f2_;
11220d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org    f3_ = t.f3_;
11230d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org    f4_ = t.f4_;
11240d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org    f5_ = t.f5_;
11250d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org    f6_ = t.f6_;
11260d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org    return *this;
11270d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  }
11280d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
11290d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  T0 f0_;
11300d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  T1 f1_;
11310d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  T2 f2_;
11320d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  T3 f3_;
11330d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  T4 f4_;
11340d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  T5 f5_;
11350d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  T6 f6_;
11360d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org};
11370d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
11380d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.orgtemplate <GTEST_8_TYPENAMES_(T)>
11390d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.orgclass GTEST_8_TUPLE_(T) {
11400d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org public:
11410d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  template <int k> friend class gtest_internal::Get;
11420d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
11430d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  tuple() : f0_(), f1_(), f2_(), f3_(), f4_(), f5_(), f6_(), f7_() {}
11440d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
11450d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  explicit tuple(GTEST_BY_REF_(T0) f0, GTEST_BY_REF_(T1) f1,
11460d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org      GTEST_BY_REF_(T2) f2, GTEST_BY_REF_(T3) f3, GTEST_BY_REF_(T4) f4,
11470d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org      GTEST_BY_REF_(T5) f5, GTEST_BY_REF_(T6) f6,
11480d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org      GTEST_BY_REF_(T7) f7) : f0_(f0), f1_(f1), f2_(f2), f3_(f3), f4_(f4),
11490d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org      f5_(f5), f6_(f6), f7_(f7) {}
11500d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
11510d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  tuple(const tuple& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_), f3_(t.f3_),
11520d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org      f4_(t.f4_), f5_(t.f5_), f6_(t.f6_), f7_(t.f7_) {}
11530d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
11540d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  template <GTEST_8_TYPENAMES_(U)>
11550d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  tuple(const GTEST_8_TUPLE_(U)& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_),
11560d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org      f3_(t.f3_), f4_(t.f4_), f5_(t.f5_), f6_(t.f6_), f7_(t.f7_) {}
11570d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
11580d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  tuple& operator=(const tuple& t) { return CopyFrom(t); }
11590d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
11600d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  template <GTEST_8_TYPENAMES_(U)>
11610d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  tuple& operator=(const GTEST_8_TUPLE_(U)& t) {
11620d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org    return CopyFrom(t);
11630d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  }
11640d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
11650d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  GTEST_DECLARE_TUPLE_AS_FRIEND_
11660d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
11670d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  template <GTEST_8_TYPENAMES_(U)>
11680d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  tuple& CopyFrom(const GTEST_8_TUPLE_(U)& t) {
11690d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org    f0_ = t.f0_;
11700d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org    f1_ = t.f1_;
11710d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org    f2_ = t.f2_;
11720d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org    f3_ = t.f3_;
11730d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org    f4_ = t.f4_;
11740d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org    f5_ = t.f5_;
11750d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org    f6_ = t.f6_;
11760d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org    f7_ = t.f7_;
11770d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org    return *this;
11780d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  }
11790d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
11800d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  T0 f0_;
11810d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  T1 f1_;
11820d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  T2 f2_;
11830d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  T3 f3_;
11840d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  T4 f4_;
11850d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  T5 f5_;
11860d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  T6 f6_;
11870d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  T7 f7_;
11880d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org};
11890d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
11900d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.orgtemplate <GTEST_9_TYPENAMES_(T)>
11910d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.orgclass GTEST_9_TUPLE_(T) {
11920d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org public:
11930d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  template <int k> friend class gtest_internal::Get;
11940d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
11950d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  tuple() : f0_(), f1_(), f2_(), f3_(), f4_(), f5_(), f6_(), f7_(), f8_() {}
11960d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
11970d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  explicit tuple(GTEST_BY_REF_(T0) f0, GTEST_BY_REF_(T1) f1,
11980d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org      GTEST_BY_REF_(T2) f2, GTEST_BY_REF_(T3) f3, GTEST_BY_REF_(T4) f4,
11990d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org      GTEST_BY_REF_(T5) f5, GTEST_BY_REF_(T6) f6, GTEST_BY_REF_(T7) f7,
12000d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org      GTEST_BY_REF_(T8) f8) : f0_(f0), f1_(f1), f2_(f2), f3_(f3), f4_(f4),
12010d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org      f5_(f5), f6_(f6), f7_(f7), f8_(f8) {}
12020d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
12030d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  tuple(const tuple& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_), f3_(t.f3_),
12040d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org      f4_(t.f4_), f5_(t.f5_), f6_(t.f6_), f7_(t.f7_), f8_(t.f8_) {}
12050d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
12060d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  template <GTEST_9_TYPENAMES_(U)>
12070d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  tuple(const GTEST_9_TUPLE_(U)& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_),
12080d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org      f3_(t.f3_), f4_(t.f4_), f5_(t.f5_), f6_(t.f6_), f7_(t.f7_), f8_(t.f8_) {}
12090d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
12100d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  tuple& operator=(const tuple& t) { return CopyFrom(t); }
12110d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
12120d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  template <GTEST_9_TYPENAMES_(U)>
12130d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  tuple& operator=(const GTEST_9_TUPLE_(U)& t) {
12140d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org    return CopyFrom(t);
12150d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  }
12160d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
12170d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  GTEST_DECLARE_TUPLE_AS_FRIEND_
12180d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
12190d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  template <GTEST_9_TYPENAMES_(U)>
12200d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  tuple& CopyFrom(const GTEST_9_TUPLE_(U)& t) {
12210d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org    f0_ = t.f0_;
12220d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org    f1_ = t.f1_;
12230d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org    f2_ = t.f2_;
12240d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org    f3_ = t.f3_;
12250d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org    f4_ = t.f4_;
12260d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org    f5_ = t.f5_;
12270d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org    f6_ = t.f6_;
12280d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org    f7_ = t.f7_;
12290d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org    f8_ = t.f8_;
12300d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org    return *this;
12310d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  }
12320d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
12330d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  T0 f0_;
12340d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  T1 f1_;
12350d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  T2 f2_;
12360d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  T3 f3_;
12370d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  T4 f4_;
12380d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  T5 f5_;
12390d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  T6 f6_;
12400d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  T7 f7_;
12410d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  T8 f8_;
12420d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org};
12430d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
12440d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.orgtemplate <GTEST_10_TYPENAMES_(T)>
12450d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.orgclass tuple {
12460d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org public:
12470d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  template <int k> friend class gtest_internal::Get;
12480d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
12490d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  tuple() : f0_(), f1_(), f2_(), f3_(), f4_(), f5_(), f6_(), f7_(), f8_(),
12500d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org      f9_() {}
12510d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
12520d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  explicit tuple(GTEST_BY_REF_(T0) f0, GTEST_BY_REF_(T1) f1,
12530d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org      GTEST_BY_REF_(T2) f2, GTEST_BY_REF_(T3) f3, GTEST_BY_REF_(T4) f4,
12540d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org      GTEST_BY_REF_(T5) f5, GTEST_BY_REF_(T6) f6, GTEST_BY_REF_(T7) f7,
12550d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org      GTEST_BY_REF_(T8) f8, GTEST_BY_REF_(T9) f9) : f0_(f0), f1_(f1), f2_(f2),
12560d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org      f3_(f3), f4_(f4), f5_(f5), f6_(f6), f7_(f7), f8_(f8), f9_(f9) {}
12570d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
12580d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  tuple(const tuple& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_), f3_(t.f3_),
12590d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org      f4_(t.f4_), f5_(t.f5_), f6_(t.f6_), f7_(t.f7_), f8_(t.f8_), f9_(t.f9_) {}
12600d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
12610d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  template <GTEST_10_TYPENAMES_(U)>
12620d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  tuple(const GTEST_10_TUPLE_(U)& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_),
12630d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org      f3_(t.f3_), f4_(t.f4_), f5_(t.f5_), f6_(t.f6_), f7_(t.f7_), f8_(t.f8_),
12640d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org      f9_(t.f9_) {}
12650d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
12660d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  tuple& operator=(const tuple& t) { return CopyFrom(t); }
12670d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
12680d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  template <GTEST_10_TYPENAMES_(U)>
12690d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  tuple& operator=(const GTEST_10_TUPLE_(U)& t) {
12700d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org    return CopyFrom(t);
12710d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  }
12720d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
12730d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  GTEST_DECLARE_TUPLE_AS_FRIEND_
12740d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
12750d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  template <GTEST_10_TYPENAMES_(U)>
12760d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  tuple& CopyFrom(const GTEST_10_TUPLE_(U)& t) {
12770d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org    f0_ = t.f0_;
12780d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org    f1_ = t.f1_;
12790d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org    f2_ = t.f2_;
12800d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org    f3_ = t.f3_;
12810d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org    f4_ = t.f4_;
12820d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org    f5_ = t.f5_;
12830d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org    f6_ = t.f6_;
12840d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org    f7_ = t.f7_;
12850d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org    f8_ = t.f8_;
12860d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org    f9_ = t.f9_;
12870d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org    return *this;
12880d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  }
12890d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
12900d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  T0 f0_;
12910d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  T1 f1_;
12920d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  T2 f2_;
12930d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  T3 f3_;
12940d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  T4 f4_;
12950d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  T5 f5_;
12960d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  T6 f6_;
12970d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  T7 f7_;
12980d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  T8 f8_;
12990d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  T9 f9_;
13000d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org};
13010d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
13020d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// 6.1.3.2 Tuple creation functions.
13030d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
13040d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// Known limitations: we don't support passing an
13050d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// std::tr1::reference_wrapper<T> to make_tuple().  And we don't
13060d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// implement tie().
13070d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
13080d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.orginline tuple<> make_tuple() { return tuple<>(); }
13090d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
13100d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.orgtemplate <GTEST_1_TYPENAMES_(T)>
13110d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.orginline GTEST_1_TUPLE_(T) make_tuple(const T0& f0) {
13120d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  return GTEST_1_TUPLE_(T)(f0);
13130d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org}
13140d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
13150d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.orgtemplate <GTEST_2_TYPENAMES_(T)>
13160d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.orginline GTEST_2_TUPLE_(T) make_tuple(const T0& f0, const T1& f1) {
13170d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  return GTEST_2_TUPLE_(T)(f0, f1);
13180d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org}
13190d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
13200d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.orgtemplate <GTEST_3_TYPENAMES_(T)>
13210d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.orginline GTEST_3_TUPLE_(T) make_tuple(const T0& f0, const T1& f1, const T2& f2) {
13220d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  return GTEST_3_TUPLE_(T)(f0, f1, f2);
13230d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org}
13240d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
13250d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.orgtemplate <GTEST_4_TYPENAMES_(T)>
13260d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.orginline GTEST_4_TUPLE_(T) make_tuple(const T0& f0, const T1& f1, const T2& f2,
13270d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org    const T3& f3) {
13280d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  return GTEST_4_TUPLE_(T)(f0, f1, f2, f3);
13290d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org}
13300d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
13310d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.orgtemplate <GTEST_5_TYPENAMES_(T)>
13320d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.orginline GTEST_5_TUPLE_(T) make_tuple(const T0& f0, const T1& f1, const T2& f2,
13330d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org    const T3& f3, const T4& f4) {
13340d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  return GTEST_5_TUPLE_(T)(f0, f1, f2, f3, f4);
13350d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org}
13360d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
13370d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.orgtemplate <GTEST_6_TYPENAMES_(T)>
13380d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.orginline GTEST_6_TUPLE_(T) make_tuple(const T0& f0, const T1& f1, const T2& f2,
13390d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org    const T3& f3, const T4& f4, const T5& f5) {
13400d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  return GTEST_6_TUPLE_(T)(f0, f1, f2, f3, f4, f5);
13410d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org}
13420d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
13430d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.orgtemplate <GTEST_7_TYPENAMES_(T)>
13440d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.orginline GTEST_7_TUPLE_(T) make_tuple(const T0& f0, const T1& f1, const T2& f2,
13450d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org    const T3& f3, const T4& f4, const T5& f5, const T6& f6) {
13460d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  return GTEST_7_TUPLE_(T)(f0, f1, f2, f3, f4, f5, f6);
13470d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org}
13480d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
13490d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.orgtemplate <GTEST_8_TYPENAMES_(T)>
13500d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.orginline GTEST_8_TUPLE_(T) make_tuple(const T0& f0, const T1& f1, const T2& f2,
13510d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org    const T3& f3, const T4& f4, const T5& f5, const T6& f6, const T7& f7) {
13520d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  return GTEST_8_TUPLE_(T)(f0, f1, f2, f3, f4, f5, f6, f7);
13530d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org}
13540d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
13550d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.orgtemplate <GTEST_9_TYPENAMES_(T)>
13560d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.orginline GTEST_9_TUPLE_(T) make_tuple(const T0& f0, const T1& f1, const T2& f2,
13570d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org    const T3& f3, const T4& f4, const T5& f5, const T6& f6, const T7& f7,
13580d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org    const T8& f8) {
13590d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  return GTEST_9_TUPLE_(T)(f0, f1, f2, f3, f4, f5, f6, f7, f8);
13600d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org}
13610d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
13620d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.orgtemplate <GTEST_10_TYPENAMES_(T)>
13630d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.orginline GTEST_10_TUPLE_(T) make_tuple(const T0& f0, const T1& f1, const T2& f2,
13640d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org    const T3& f3, const T4& f4, const T5& f5, const T6& f6, const T7& f7,
13650d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org    const T8& f8, const T9& f9) {
13660d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  return GTEST_10_TUPLE_(T)(f0, f1, f2, f3, f4, f5, f6, f7, f8, f9);
13670d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org}
13680d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
13690d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// 6.1.3.3 Tuple helper classes.
13700d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
13710d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.orgtemplate <typename Tuple> struct tuple_size;
13720d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
13730d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.orgtemplate <GTEST_0_TYPENAMES_(T)>
13740d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.orgstruct tuple_size<GTEST_0_TUPLE_(T) > {
13750d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  static const int value = 0;
13760d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org};
13770d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
13780d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.orgtemplate <GTEST_1_TYPENAMES_(T)>
13790d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.orgstruct tuple_size<GTEST_1_TUPLE_(T) > {
13800d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  static const int value = 1;
13810d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org};
13820d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
13830d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.orgtemplate <GTEST_2_TYPENAMES_(T)>
13840d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.orgstruct tuple_size<GTEST_2_TUPLE_(T) > {
13850d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  static const int value = 2;
13860d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org};
13870d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
13880d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.orgtemplate <GTEST_3_TYPENAMES_(T)>
13890d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.orgstruct tuple_size<GTEST_3_TUPLE_(T) > {
13900d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  static const int value = 3;
13910d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org};
13920d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
13930d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.orgtemplate <GTEST_4_TYPENAMES_(T)>
13940d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.orgstruct tuple_size<GTEST_4_TUPLE_(T) > {
13950d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  static const int value = 4;
13960d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org};
13970d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
13980d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.orgtemplate <GTEST_5_TYPENAMES_(T)>
13990d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.orgstruct tuple_size<GTEST_5_TUPLE_(T) > {
14000d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  static const int value = 5;
14010d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org};
14020d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
14030d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.orgtemplate <GTEST_6_TYPENAMES_(T)>
14040d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.orgstruct tuple_size<GTEST_6_TUPLE_(T) > {
14050d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  static const int value = 6;
14060d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org};
14070d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
14080d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.orgtemplate <GTEST_7_TYPENAMES_(T)>
14090d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.orgstruct tuple_size<GTEST_7_TUPLE_(T) > {
14100d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  static const int value = 7;
14110d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org};
14120d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
14130d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.orgtemplate <GTEST_8_TYPENAMES_(T)>
14140d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.orgstruct tuple_size<GTEST_8_TUPLE_(T) > {
14150d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  static const int value = 8;
14160d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org};
14170d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
14180d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.orgtemplate <GTEST_9_TYPENAMES_(T)>
14190d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.orgstruct tuple_size<GTEST_9_TUPLE_(T) > {
14200d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  static const int value = 9;
14210d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org};
14220d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
14230d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.orgtemplate <GTEST_10_TYPENAMES_(T)>
14240d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.orgstruct tuple_size<GTEST_10_TUPLE_(T) > {
14250d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  static const int value = 10;
14260d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org};
14270d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
14280d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.orgtemplate <int k, class Tuple>
14290d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.orgstruct tuple_element {
14300d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  typedef typename gtest_internal::TupleElement<
14310d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org      k < (tuple_size<Tuple>::value), k, Tuple>::type type;
14320d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org};
14330d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
14340d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org#define GTEST_TUPLE_ELEMENT_(k, Tuple) typename tuple_element<k, Tuple >::type
14350d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
14360d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// 6.1.3.4 Element access.
14370d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
14380d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.orgnamespace gtest_internal {
14390d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
14400d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.orgtemplate <>
14410d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.orgclass Get<0> {
14420d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org public:
14430d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  template <class Tuple>
14440d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  static GTEST_ADD_REF_(GTEST_TUPLE_ELEMENT_(0, Tuple))
14450d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  Field(Tuple& t) { return t.f0_; }  // NOLINT
14460d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
14470d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  template <class Tuple>
14480d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  static GTEST_BY_REF_(GTEST_TUPLE_ELEMENT_(0, Tuple))
14490d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  ConstField(const Tuple& t) { return t.f0_; }
14500d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org};
14510d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
14520d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.orgtemplate <>
14530d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.orgclass Get<1> {
14540d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org public:
14550d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  template <class Tuple>
14560d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  static GTEST_ADD_REF_(GTEST_TUPLE_ELEMENT_(1, Tuple))
14570d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  Field(Tuple& t) { return t.f1_; }  // NOLINT
14580d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
14590d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  template <class Tuple>
14600d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  static GTEST_BY_REF_(GTEST_TUPLE_ELEMENT_(1, Tuple))
14610d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  ConstField(const Tuple& t) { return t.f1_; }
14620d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org};
14630d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
14640d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.orgtemplate <>
14650d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.orgclass Get<2> {
14660d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org public:
14670d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  template <class Tuple>
14680d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  static GTEST_ADD_REF_(GTEST_TUPLE_ELEMENT_(2, Tuple))
14690d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  Field(Tuple& t) { return t.f2_; }  // NOLINT
14700d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
14710d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  template <class Tuple>
14720d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  static GTEST_BY_REF_(GTEST_TUPLE_ELEMENT_(2, Tuple))
14730d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  ConstField(const Tuple& t) { return t.f2_; }
14740d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org};
14750d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
14760d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.orgtemplate <>
14770d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.orgclass Get<3> {
14780d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org public:
14790d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  template <class Tuple>
14800d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  static GTEST_ADD_REF_(GTEST_TUPLE_ELEMENT_(3, Tuple))
14810d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  Field(Tuple& t) { return t.f3_; }  // NOLINT
14820d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
14830d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  template <class Tuple>
14840d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  static GTEST_BY_REF_(GTEST_TUPLE_ELEMENT_(3, Tuple))
14850d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  ConstField(const Tuple& t) { return t.f3_; }
14860d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org};
14870d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
14880d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.orgtemplate <>
14890d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.orgclass Get<4> {
14900d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org public:
14910d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  template <class Tuple>
14920d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  static GTEST_ADD_REF_(GTEST_TUPLE_ELEMENT_(4, Tuple))
14930d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  Field(Tuple& t) { return t.f4_; }  // NOLINT
14940d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
14950d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  template <class Tuple>
14960d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  static GTEST_BY_REF_(GTEST_TUPLE_ELEMENT_(4, Tuple))
14970d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  ConstField(const Tuple& t) { return t.f4_; }
14980d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org};
14990d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
15000d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.orgtemplate <>
15010d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.orgclass Get<5> {
15020d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org public:
15030d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  template <class Tuple>
15040d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  static GTEST_ADD_REF_(GTEST_TUPLE_ELEMENT_(5, Tuple))
15050d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  Field(Tuple& t) { return t.f5_; }  // NOLINT
15060d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
15070d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  template <class Tuple>
15080d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  static GTEST_BY_REF_(GTEST_TUPLE_ELEMENT_(5, Tuple))
15090d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  ConstField(const Tuple& t) { return t.f5_; }
15100d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org};
15110d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
15120d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.orgtemplate <>
15130d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.orgclass Get<6> {
15140d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org public:
15150d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  template <class Tuple>
15160d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  static GTEST_ADD_REF_(GTEST_TUPLE_ELEMENT_(6, Tuple))
15170d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  Field(Tuple& t) { return t.f6_; }  // NOLINT
15180d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
15190d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  template <class Tuple>
15200d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  static GTEST_BY_REF_(GTEST_TUPLE_ELEMENT_(6, Tuple))
15210d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  ConstField(const Tuple& t) { return t.f6_; }
15220d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org};
15230d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
15240d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.orgtemplate <>
15250d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.orgclass Get<7> {
15260d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org public:
15270d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  template <class Tuple>
15280d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  static GTEST_ADD_REF_(GTEST_TUPLE_ELEMENT_(7, Tuple))
15290d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  Field(Tuple& t) { return t.f7_; }  // NOLINT
15300d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
15310d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  template <class Tuple>
15320d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  static GTEST_BY_REF_(GTEST_TUPLE_ELEMENT_(7, Tuple))
15330d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  ConstField(const Tuple& t) { return t.f7_; }
15340d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org};
15350d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
15360d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.orgtemplate <>
15370d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.orgclass Get<8> {
15380d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org public:
15390d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  template <class Tuple>
15400d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  static GTEST_ADD_REF_(GTEST_TUPLE_ELEMENT_(8, Tuple))
15410d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  Field(Tuple& t) { return t.f8_; }  // NOLINT
15420d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
15430d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  template <class Tuple>
15440d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  static GTEST_BY_REF_(GTEST_TUPLE_ELEMENT_(8, Tuple))
15450d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  ConstField(const Tuple& t) { return t.f8_; }
15460d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org};
15470d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
15480d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.orgtemplate <>
15490d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.orgclass Get<9> {
15500d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org public:
15510d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  template <class Tuple>
15520d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  static GTEST_ADD_REF_(GTEST_TUPLE_ELEMENT_(9, Tuple))
15530d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  Field(Tuple& t) { return t.f9_; }  // NOLINT
15540d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
15550d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  template <class Tuple>
15560d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  static GTEST_BY_REF_(GTEST_TUPLE_ELEMENT_(9, Tuple))
15570d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  ConstField(const Tuple& t) { return t.f9_; }
15580d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org};
15590d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
15600d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org}  // namespace gtest_internal
15610d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
15620d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.orgtemplate <int k, GTEST_10_TYPENAMES_(T)>
15630d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.orgGTEST_ADD_REF_(GTEST_TUPLE_ELEMENT_(k, GTEST_10_TUPLE_(T)))
15640d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.orgget(GTEST_10_TUPLE_(T)& t) {
15650d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  return gtest_internal::Get<k>::Field(t);
15660d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org}
15670d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
15680d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.orgtemplate <int k, GTEST_10_TYPENAMES_(T)>
15690d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.orgGTEST_BY_REF_(GTEST_TUPLE_ELEMENT_(k,  GTEST_10_TUPLE_(T)))
15700d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.orgget(const GTEST_10_TUPLE_(T)& t) {
15710d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  return gtest_internal::Get<k>::ConstField(t);
15720d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org}
15730d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
15740d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// 6.1.3.5 Relational operators
15750d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
15760d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// We only implement == and !=, as we don't have a need for the rest yet.
15770d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
15780d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.orgnamespace gtest_internal {
15790d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
15800d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// SameSizeTuplePrefixComparator<k, k>::Eq(t1, t2) returns true if the
15810d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// first k fields of t1 equals the first k fields of t2.
15820d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// SameSizeTuplePrefixComparator(k1, k2) would be a compiler error if
15830d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// k1 != k2.
15840d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.orgtemplate <int kSize1, int kSize2>
15850d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.orgstruct SameSizeTuplePrefixComparator;
15860d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
15870d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.orgtemplate <>
15880d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.orgstruct SameSizeTuplePrefixComparator<0, 0> {
15890d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  template <class Tuple1, class Tuple2>
15900d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  static bool Eq(const Tuple1& /* t1 */, const Tuple2& /* t2 */) {
15910d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org    return true;
15920d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  }
15930d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org};
15940d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
15950d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.orgtemplate <int k>
15960d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.orgstruct SameSizeTuplePrefixComparator<k, k> {
15970d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  template <class Tuple1, class Tuple2>
15980d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  static bool Eq(const Tuple1& t1, const Tuple2& t2) {
15990d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org    return SameSizeTuplePrefixComparator<k - 1, k - 1>::Eq(t1, t2) &&
16000d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org        ::std::tr1::get<k - 1>(t1) == ::std::tr1::get<k - 1>(t2);
16010d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  }
16020d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org};
16030d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
16040d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org}  // namespace gtest_internal
16050d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
16060d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.orgtemplate <GTEST_10_TYPENAMES_(T), GTEST_10_TYPENAMES_(U)>
16070d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.orginline bool operator==(const GTEST_10_TUPLE_(T)& t,
16080d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org                       const GTEST_10_TUPLE_(U)& u) {
16090d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  return gtest_internal::SameSizeTuplePrefixComparator<
16100d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org      tuple_size<GTEST_10_TUPLE_(T) >::value,
16110d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org      tuple_size<GTEST_10_TUPLE_(U) >::value>::Eq(t, u);
16120d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org}
16130d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
16140d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.orgtemplate <GTEST_10_TYPENAMES_(T), GTEST_10_TYPENAMES_(U)>
16150d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.orginline bool operator!=(const GTEST_10_TUPLE_(T)& t,
16160d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org                       const GTEST_10_TUPLE_(U)& u) { return !(t == u); }
16170d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
16180d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// 6.1.4 Pairs.
16190d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// Unimplemented.
16200d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
16210d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org}  // namespace tr1
16220d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org}  // namespace std
16230d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
16240d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org#undef GTEST_0_TUPLE_
16250d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org#undef GTEST_1_TUPLE_
16260d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org#undef GTEST_2_TUPLE_
16270d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org#undef GTEST_3_TUPLE_
16280d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org#undef GTEST_4_TUPLE_
16290d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org#undef GTEST_5_TUPLE_
16300d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org#undef GTEST_6_TUPLE_
16310d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org#undef GTEST_7_TUPLE_
16320d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org#undef GTEST_8_TUPLE_
16330d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org#undef GTEST_9_TUPLE_
16340d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org#undef GTEST_10_TUPLE_
16350d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
16360d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org#undef GTEST_0_TYPENAMES_
16370d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org#undef GTEST_1_TYPENAMES_
16380d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org#undef GTEST_2_TYPENAMES_
16390d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org#undef GTEST_3_TYPENAMES_
16400d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org#undef GTEST_4_TYPENAMES_
16410d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org#undef GTEST_5_TYPENAMES_
16420d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org#undef GTEST_6_TYPENAMES_
16430d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org#undef GTEST_7_TYPENAMES_
16440d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org#undef GTEST_8_TYPENAMES_
16450d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org#undef GTEST_9_TYPENAMES_
16460d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org#undef GTEST_10_TYPENAMES_
16470d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
16480d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org#undef GTEST_DECLARE_TUPLE_AS_FRIEND_
16490d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org#undef GTEST_BY_REF_
16500d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org#undef GTEST_ADD_REF_
16510d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org#undef GTEST_TUPLE_ELEMENT_
16520d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
16530d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org#endif  // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_TUPLE_H_
16540d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org# elif GTEST_ENV_HAS_STD_TUPLE_
16550d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org#  include <tuple>
16560d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// C++11 puts its tuple into the ::std namespace rather than
16570d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// ::std::tr1.  gtest expects tuple to live in ::std::tr1, so put it there.
16580d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// This causes undefined behavior, but supported compilers react in
16590d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// the way we intend.
16600d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.orgnamespace std {
16610d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.orgnamespace tr1 {
16620d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.orgusing ::std::get;
16630d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.orgusing ::std::make_tuple;
16640d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.orgusing ::std::tuple;
16650d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.orgusing ::std::tuple_element;
16660d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.orgusing ::std::tuple_size;
16670d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org}
16680d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org}
16690d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
16700d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org# elif GTEST_OS_SYMBIAN
16710d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
16720d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// On Symbian, BOOST_HAS_TR1_TUPLE causes Boost's TR1 tuple library to
16730d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// use STLport's tuple implementation, which unfortunately doesn't
16740d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// work as the copy of STLport distributed with Symbian is incomplete.
16750d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// By making sure BOOST_HAS_TR1_TUPLE is undefined, we force Boost to
16760d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// use its own tuple implementation.
16770d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org#  ifdef BOOST_HAS_TR1_TUPLE
16780d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org#   undef BOOST_HAS_TR1_TUPLE
16790d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org#  endif  // BOOST_HAS_TR1_TUPLE
16800d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
16810d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// This prevents <boost/tr1/detail/config.hpp>, which defines
16820d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// BOOST_HAS_TR1_TUPLE, from being #included by Boost's <tuple>.
16830d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org#  define BOOST_TR1_DETAIL_CONFIG_HPP_INCLUDED
16840d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org#  include <tuple>
16850d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
16860d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org# elif defined(__GNUC__) && (GTEST_GCC_VER_ >= 40000)
16870d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// GCC 4.0+ implements tr1/tuple in the <tr1/tuple> header.  This does
16880d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// not conform to the TR1 spec, which requires the header to be <tuple>.
16890d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
16900d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org#  if !GTEST_HAS_RTTI && GTEST_GCC_VER_ < 40302
16910d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// Until version 4.3.2, gcc has a bug that causes <tr1/functional>,
16920d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// which is #included by <tr1/tuple>, to not compile when RTTI is
16930d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// disabled.  _TR1_FUNCTIONAL is the header guard for
16940d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// <tr1/functional>.  Hence the following #define is a hack to prevent
16950d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// <tr1/functional> from being included.
16960d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org#   define _TR1_FUNCTIONAL 1
16970d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org#   include <tr1/tuple>
16980d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org#   undef _TR1_FUNCTIONAL  // Allows the user to #include
16990d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org                        // <tr1/functional> if he chooses to.
17000d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org#  else
17010d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org#   include <tr1/tuple>  // NOLINT
17020d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org#  endif  // !GTEST_HAS_RTTI && GTEST_GCC_VER_ < 40302
17030d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
17040d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org# else
17050d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// If the compiler is not GCC 4.0+, we assume the user is using a
17060d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// spec-conforming TR1 implementation.
17070d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org#  include <tuple>  // NOLINT
17080d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org# endif  // GTEST_USE_OWN_TR1_TUPLE
17090d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
17100d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org#endif  // GTEST_HAS_TR1_TUPLE
17110d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
17120d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// Determines whether clone(2) is supported.
17130d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// Usually it will only be available on Linux, excluding
17140d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// Linux on the Itanium architecture.
17150d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// Also see http://linux.die.net/man/2/clone.
17160d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org#ifndef GTEST_HAS_CLONE
17170d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// The user didn't tell us, so we need to figure it out.
17180d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
17190d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org# if GTEST_OS_LINUX && !defined(__ia64__)
17200d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org#  if GTEST_OS_LINUX_ANDROID
17210d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// On Android, clone() is only available on ARM starting with Gingerbread.
17220d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org#    if defined(__arm__) && __ANDROID_API__ >= 9
17230d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org#     define GTEST_HAS_CLONE 1
17240d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org#    else
17250d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org#     define GTEST_HAS_CLONE 0
17260d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org#    endif
17270d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org#  else
17280d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org#   define GTEST_HAS_CLONE 1
17290d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org#  endif
17300d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org# else
17310d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org#  define GTEST_HAS_CLONE 0
17320d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org# endif  // GTEST_OS_LINUX && !defined(__ia64__)
17330d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
17340d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org#endif  // GTEST_HAS_CLONE
17350d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
17360d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// Determines whether to support stream redirection. This is used to test
17370d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// output correctness and to implement death tests.
17380d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org#ifndef GTEST_HAS_STREAM_REDIRECTION
17390d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// By default, we assume that stream redirection is supported on all
17400d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// platforms except known mobile ones.
17410d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org# if GTEST_OS_WINDOWS_MOBILE || GTEST_OS_SYMBIAN
17420d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org#  define GTEST_HAS_STREAM_REDIRECTION 0
17430d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org# else
17440d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org#  define GTEST_HAS_STREAM_REDIRECTION 1
17450d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org# endif  // !GTEST_OS_WINDOWS_MOBILE && !GTEST_OS_SYMBIAN
17460d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org#endif  // GTEST_HAS_STREAM_REDIRECTION
17470d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
17480d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// Determines whether to support death tests.
17490d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// Google Test does not support death tests for VC 7.1 and earlier as
17500d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// abort() in a VC 7.1 application compiled as GUI in debug config
17510d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// pops up a dialog window that cannot be suppressed programmatically.
17520d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org#if (GTEST_OS_LINUX || GTEST_OS_CYGWIN || GTEST_OS_SOLARIS || \
17530d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org     (GTEST_OS_MAC && !GTEST_OS_IOS) || GTEST_OS_IOS_SIMULATOR || \
17540d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org     (GTEST_OS_WINDOWS_DESKTOP && _MSC_VER >= 1400) || \
17550d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org     GTEST_OS_WINDOWS_MINGW || GTEST_OS_AIX || GTEST_OS_HPUX || \
17560d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org     GTEST_OS_OPENBSD || GTEST_OS_QNX)
17570d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org# define GTEST_HAS_DEATH_TEST 1
17580d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org# include <vector>  // NOLINT
17590d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org#endif
17600d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
17610d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// We don't support MSVC 7.1 with exceptions disabled now.  Therefore
17620d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// all the compilers we care about are adequate for supporting
17630d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// value-parameterized tests.
17640d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org#define GTEST_HAS_PARAM_TEST 1
17650d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
17660d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// Determines whether to support type-driven tests.
17670d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
17680d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// Typed tests need <typeinfo> and variadic macros, which GCC, VC++ 8.0,
17690d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// Sun Pro CC, IBM Visual Age, and HP aCC support.
17700d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org#if defined(__GNUC__) || (_MSC_VER >= 1400) || defined(__SUNPRO_CC) || \
17710d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org    defined(__IBMCPP__) || defined(__HP_aCC)
17720d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org# define GTEST_HAS_TYPED_TEST 1
17730d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org# define GTEST_HAS_TYPED_TEST_P 1
17740d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org#endif
17750d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
17760d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// Determines whether to support Combine(). This only makes sense when
17770d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// value-parameterized tests are enabled.  The implementation doesn't
17780d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// work on Sun Studio since it doesn't understand templated conversion
17790d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// operators.
17800d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org#if GTEST_HAS_PARAM_TEST && GTEST_HAS_TR1_TUPLE && !defined(__SUNPRO_CC)
17810d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org# define GTEST_HAS_COMBINE 1
17820d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org#endif
17830d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
17840d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// Determines whether the system compiler uses UTF-16 for encoding wide strings.
17850d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org#define GTEST_WIDE_STRING_USES_UTF16_ \
17860d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org    (GTEST_OS_WINDOWS || GTEST_OS_CYGWIN || GTEST_OS_SYMBIAN || GTEST_OS_AIX)
17870d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
17880d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// Determines whether test results can be streamed to a socket.
17890d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org#if GTEST_OS_LINUX
17900d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org# define GTEST_CAN_STREAM_RESULTS_ 1
17910d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org#endif
17920d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
17930d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// Defines some utility macros.
17940d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
17950d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// The GNU compiler emits a warning if nested "if" statements are followed by
17960d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// an "else" statement and braces are not used to explicitly disambiguate the
17970d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// "else" binding.  This leads to problems with code like:
17980d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org//
17990d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org//   if (gate)
18000d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org//     ASSERT_*(condition) << "Some message";
18010d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org//
18020d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// The "switch (0) case 0:" idiom is used to suppress this.
18030d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org#ifdef __INTEL_COMPILER
18040d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org# define GTEST_AMBIGUOUS_ELSE_BLOCKER_
18050d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org#else
18060d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org# define GTEST_AMBIGUOUS_ELSE_BLOCKER_ switch (0) case 0: default:  // NOLINT
18070d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org#endif
18080d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
18090d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// Use this annotation at the end of a struct/class definition to
18100d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// prevent the compiler from optimizing away instances that are never
18110d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// used.  This is useful when all interesting logic happens inside the
18120d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// c'tor and / or d'tor.  Example:
18130d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org//
18140d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org//   struct Foo {
18150d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org//     Foo() { ... }
18160d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org//   } GTEST_ATTRIBUTE_UNUSED_;
18170d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org//
18180d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// Also use it after a variable or parameter declaration to tell the
18190d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// compiler the variable/parameter does not have to be used.
18200d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org#if defined(__GNUC__) && !defined(COMPILER_ICC)
18210d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org# define GTEST_ATTRIBUTE_UNUSED_ __attribute__ ((unused))
18220d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org#else
18230d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org# define GTEST_ATTRIBUTE_UNUSED_
18240d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org#endif
18250d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
18260d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// A macro to disallow operator=
18270d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// This should be used in the private: declarations for a class.
18280d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org#define GTEST_DISALLOW_ASSIGN_(type)\
18290d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  void operator=(type const &)
18300d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
18310d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// A macro to disallow copy constructor and operator=
18320d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// This should be used in the private: declarations for a class.
18330d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org#define GTEST_DISALLOW_COPY_AND_ASSIGN_(type)\
18340d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  type(type const &);\
18350d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  GTEST_DISALLOW_ASSIGN_(type)
18360d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
18370d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// Tell the compiler to warn about unused return values for functions declared
18380d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// with this macro.  The macro should be used on function declarations
18390d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// following the argument list:
18400d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org//
18410d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org//   Sprocket* AllocateSprocket() GTEST_MUST_USE_RESULT_;
18420d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org#if defined(__GNUC__) && (GTEST_GCC_VER_ >= 30400) && !defined(COMPILER_ICC)
18430d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org# define GTEST_MUST_USE_RESULT_ __attribute__ ((warn_unused_result))
18440d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org#else
18450d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org# define GTEST_MUST_USE_RESULT_
18460d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org#endif  // __GNUC__ && (GTEST_GCC_VER_ >= 30400) && !COMPILER_ICC
18470d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
18480d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// Determine whether the compiler supports Microsoft's Structured Exception
18490d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// Handling.  This is supported by several Windows compilers but generally
18500d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// does not exist on any other system.
18510d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org#ifndef GTEST_HAS_SEH
18520d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// The user didn't tell us, so we need to figure it out.
18530d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
18540d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org# if defined(_MSC_VER) || defined(__BORLANDC__)
18550d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// These two compilers are known to support SEH.
18560d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org#  define GTEST_HAS_SEH 1
18570d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org# else
18580d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// Assume no SEH.
18590d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org#  define GTEST_HAS_SEH 0
18600d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org# endif
18610d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
18620d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org#endif  // GTEST_HAS_SEH
18630d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
18640d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org#ifdef _MSC_VER
18650d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
18660d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org# if GTEST_LINKED_AS_SHARED_LIBRARY
18670d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org#  define GTEST_API_ __declspec(dllimport)
18680d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org# elif GTEST_CREATE_SHARED_LIBRARY
18690d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org#  define GTEST_API_ __declspec(dllexport)
18700d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org# endif
18710d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
18720d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org#endif  // _MSC_VER
18730d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
18740d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org#ifndef GTEST_API_
18750d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org# define GTEST_API_
18760d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org#endif
18770d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
18780d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org#ifdef __GNUC__
18790d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// Ask the compiler to never inline a given function.
18800d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org# define GTEST_NO_INLINE_ __attribute__((noinline))
18810d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org#else
18820d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org# define GTEST_NO_INLINE_
18830d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org#endif
18840d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
18850d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// _LIBCPP_VERSION is defined by the libc++ library from the LLVM project.
18860d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org#if defined(__GLIBCXX__) || defined(_LIBCPP_VERSION)
18870d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org# define GTEST_HAS_CXXABI_H_ 1
18880d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org#else
18890d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org# define GTEST_HAS_CXXABI_H_ 0
18900d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org#endif
18910d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
18920d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.orgnamespace testing {
18930d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
18940d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.orgclass Message;
18950d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
18960d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.orgnamespace internal {
18970d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
18980d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// A secret type that Google Test users don't know about.  It has no
18990d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// definition on purpose.  Therefore it's impossible to create a
19000d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// Secret object, which is what we want.
19010d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.orgclass Secret;
19020d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
19030d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// The GTEST_COMPILE_ASSERT_ macro can be used to verify that a compile time
19040d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// expression is true. For example, you could use it to verify the
19050d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// size of a static array:
19060d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org//
19070d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org//   GTEST_COMPILE_ASSERT_(ARRAYSIZE(content_type_names) == CONTENT_NUM_TYPES,
19080d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org//                         content_type_names_incorrect_size);
19090d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org//
19100d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// or to make sure a struct is smaller than a certain size:
19110d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org//
19120d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org//   GTEST_COMPILE_ASSERT_(sizeof(foo) < 128, foo_too_large);
19130d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org//
19140d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// The second argument to the macro is the name of the variable. If
19150d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// the expression is false, most compilers will issue a warning/error
19160d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// containing the name of the variable.
19170d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
19180d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.orgtemplate <bool>
19190d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.orgstruct CompileAssert {
19200d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org};
19210d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
19220d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org#define GTEST_COMPILE_ASSERT_(expr, msg) \
19230d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  typedef ::testing::internal::CompileAssert<(static_cast<bool>(expr))> \
19240d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org      msg[static_cast<bool>(expr) ? 1 : -1] GTEST_ATTRIBUTE_UNUSED_
19250d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
19260d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// Implementation details of GTEST_COMPILE_ASSERT_:
19270d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org//
19280d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// - GTEST_COMPILE_ASSERT_ works by defining an array type that has -1
19290d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org//   elements (and thus is invalid) when the expression is false.
19300d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org//
19310d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// - The simpler definition
19320d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org//
19330d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org//    #define GTEST_COMPILE_ASSERT_(expr, msg) typedef char msg[(expr) ? 1 : -1]
19340d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org//
19350d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org//   does not work, as gcc supports variable-length arrays whose sizes
19360d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org//   are determined at run-time (this is gcc's extension and not part
19370d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org//   of the C++ standard).  As a result, gcc fails to reject the
19380d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org//   following code with the simple definition:
19390d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org//
19400d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org//     int foo;
19410d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org//     GTEST_COMPILE_ASSERT_(foo, msg); // not supposed to compile as foo is
19420d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org//                                      // not a compile-time constant.
19430d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org//
19440d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// - By using the type CompileAssert<(bool(expr))>, we ensures that
19450d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org//   expr is a compile-time constant.  (Template arguments must be
19460d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org//   determined at compile-time.)
19470d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org//
19480d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// - The outter parentheses in CompileAssert<(bool(expr))> are necessary
19490d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org//   to work around a bug in gcc 3.4.4 and 4.0.1.  If we had written
19500d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org//
19510d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org//     CompileAssert<bool(expr)>
19520d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org//
19530d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org//   instead, these compilers will refuse to compile
19540d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org//
19550d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org//     GTEST_COMPILE_ASSERT_(5 > 0, some_message);
19560d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org//
19570d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org//   (They seem to think the ">" in "5 > 0" marks the end of the
19580d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org//   template argument list.)
19590d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org//
19600d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// - The array size is (bool(expr) ? 1 : -1), instead of simply
19610d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org//
19620d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org//     ((expr) ? 1 : -1).
19630d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org//
19640d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org//   This is to avoid running into a bug in MS VC 7.1, which
19650d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org//   causes ((0.0) ? 1 : -1) to incorrectly evaluate to 1.
19660d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
19670d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// StaticAssertTypeEqHelper is used by StaticAssertTypeEq defined in gtest.h.
19680d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org//
19690d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// This template is declared, but intentionally undefined.
19700d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.orgtemplate <typename T1, typename T2>
19710d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.orgstruct StaticAssertTypeEqHelper;
19720d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
19730d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.orgtemplate <typename T>
19740d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.orgstruct StaticAssertTypeEqHelper<T, T> {};
19750d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
19760d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org#if GTEST_HAS_GLOBAL_STRING
19770d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.orgtypedef ::string string;
19780d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org#else
19790d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.orgtypedef ::std::string string;
19800d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org#endif  // GTEST_HAS_GLOBAL_STRING
19810d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
19820d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org#if GTEST_HAS_GLOBAL_WSTRING
19830d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.orgtypedef ::wstring wstring;
19840d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org#elif GTEST_HAS_STD_WSTRING
19850d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.orgtypedef ::std::wstring wstring;
19860d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org#endif  // GTEST_HAS_GLOBAL_WSTRING
19870d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
19880d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// A helper for suppressing warnings on constant condition.  It just
19890d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// returns 'condition'.
19900d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.orgGTEST_API_ bool IsTrue(bool condition);
19910d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
19920d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// Defines scoped_ptr.
19930d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
19940d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// This implementation of scoped_ptr is PARTIAL - it only contains
19950d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// enough stuff to satisfy Google Test's need.
19960d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.orgtemplate <typename T>
19970d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.orgclass scoped_ptr {
19980d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org public:
19990d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  typedef T element_type;
20000d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
20010d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  explicit scoped_ptr(T* p = NULL) : ptr_(p) {}
20020d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  ~scoped_ptr() { reset(); }
20030d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
20040d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  T& operator*() const { return *ptr_; }
20050d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  T* operator->() const { return ptr_; }
20060d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  T* get() const { return ptr_; }
20070d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
20080d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  T* release() {
20090d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org    T* const ptr = ptr_;
20100d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org    ptr_ = NULL;
20110d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org    return ptr;
20120d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  }
20130d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
20140d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  void reset(T* p = NULL) {
20150d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org    if (p != ptr_) {
20160d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org      if (IsTrue(sizeof(T) > 0)) {  // Makes sure T is a complete type.
20170d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org        delete ptr_;
20180d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org      }
20190d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org      ptr_ = p;
20200d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org    }
20210d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  }
20220d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
20230d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org private:
20240d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  T* ptr_;
20250d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
20260d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  GTEST_DISALLOW_COPY_AND_ASSIGN_(scoped_ptr);
20270d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org};
20280d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
20290d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// Defines RE.
20300d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
20310d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// A simple C++ wrapper for <regex.h>.  It uses the POSIX Extended
20320d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// Regular Expression syntax.
20330d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.orgclass GTEST_API_ RE {
20340d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org public:
20350d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  // A copy constructor is required by the Standard to initialize object
20360d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  // references from r-values.
20370d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  RE(const RE& other) { Init(other.pattern()); }
20380d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
20390d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  // Constructs an RE from a string.
20400d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  RE(const ::std::string& regex) { Init(regex.c_str()); }  // NOLINT
20410d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
20420d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org#if GTEST_HAS_GLOBAL_STRING
20430d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
20440d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  RE(const ::string& regex) { Init(regex.c_str()); }  // NOLINT
20450d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
20460d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org#endif  // GTEST_HAS_GLOBAL_STRING
20470d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
20480d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  RE(const char* regex) { Init(regex); }  // NOLINT
20490d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  ~RE();
20500d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
20510d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  // Returns the string representation of the regex.
20520d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  const char* pattern() const { return pattern_; }
20530d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
20540d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  // FullMatch(str, re) returns true iff regular expression re matches
20550d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  // the entire str.
20560d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  // PartialMatch(str, re) returns true iff regular expression re
20570d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  // matches a substring of str (including str itself).
20580d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  //
20590d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  // TODO(wan@google.com): make FullMatch() and PartialMatch() work
20600d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  // when str contains NUL characters.
20610d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  static bool FullMatch(const ::std::string& str, const RE& re) {
20620d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org    return FullMatch(str.c_str(), re);
20630d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  }
20640d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  static bool PartialMatch(const ::std::string& str, const RE& re) {
20650d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org    return PartialMatch(str.c_str(), re);
20660d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  }
20670d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
20680d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org#if GTEST_HAS_GLOBAL_STRING
20690d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
20700d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  static bool FullMatch(const ::string& str, const RE& re) {
20710d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org    return FullMatch(str.c_str(), re);
20720d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  }
20730d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  static bool PartialMatch(const ::string& str, const RE& re) {
20740d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org    return PartialMatch(str.c_str(), re);
20750d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  }
20760d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
20770d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org#endif  // GTEST_HAS_GLOBAL_STRING
20780d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
20790d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  static bool FullMatch(const char* str, const RE& re);
20800d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  static bool PartialMatch(const char* str, const RE& re);
20810d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
20820d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org private:
20830d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  void Init(const char* regex);
20840d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
20850d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  // We use a const char* instead of an std::string, as Google Test used to be
20860d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  // used where std::string is not available.  TODO(wan@google.com): change to
20870d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  // std::string.
20880d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  const char* pattern_;
20890d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  bool is_valid_;
20900d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
20910d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org#if GTEST_USES_POSIX_RE
20920d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
20930d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  regex_t full_regex_;     // For FullMatch().
20940d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  regex_t partial_regex_;  // For PartialMatch().
20950d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
20960d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org#else  // GTEST_USES_SIMPLE_RE
20970d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
20980d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  const char* full_pattern_;  // For FullMatch();
20990d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
21000d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org#endif
21010d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
21020d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  GTEST_DISALLOW_ASSIGN_(RE);
21030d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org};
21040d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
21050d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// Formats a source file path and a line number as they would appear
21060d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// in an error message from the compiler used to compile this code.
21070d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.orgGTEST_API_ ::std::string FormatFileLocation(const char* file, int line);
21080d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
21090d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// Formats a file location for compiler-independent XML output.
21100d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// Although this function is not platform dependent, we put it next to
21110d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// FormatFileLocation in order to contrast the two functions.
21120d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.orgGTEST_API_ ::std::string FormatCompilerIndependentFileLocation(const char* file,
21130d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org                                                               int line);
21140d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
21150d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// Defines logging utilities:
21160d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org//   GTEST_LOG_(severity) - logs messages at the specified severity level. The
21170d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org//                          message itself is streamed into the macro.
21180d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org//   LogToStderr()  - directs all log messages to stderr.
21190d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org//   FlushInfoLog() - flushes informational log messages.
21200d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
21210d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.orgenum GTestLogSeverity {
21220d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  GTEST_INFO,
21230d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  GTEST_WARNING,
21240d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  GTEST_ERROR,
21250d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  GTEST_FATAL
21260d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org};
21270d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
21280d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// Formats log entry severity, provides a stream object for streaming the
21290d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// log message, and terminates the message with a newline when going out of
21300d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// scope.
21310d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.orgclass GTEST_API_ GTestLog {
21320d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org public:
21330d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  GTestLog(GTestLogSeverity severity, const char* file, int line);
21340d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
21350d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  // Flushes the buffers and, if severity is GTEST_FATAL, aborts the program.
21360d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  ~GTestLog();
21370d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
21380d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  ::std::ostream& GetStream() { return ::std::cerr; }
21390d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
21400d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org private:
21410d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  const GTestLogSeverity severity_;
21420d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
21430d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  GTEST_DISALLOW_COPY_AND_ASSIGN_(GTestLog);
21440d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org};
21450d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
21460d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org#define GTEST_LOG_(severity) \
21470d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org    ::testing::internal::GTestLog(::testing::internal::GTEST_##severity, \
21480d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org                                  __FILE__, __LINE__).GetStream()
21490d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
21500d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.orginline void LogToStderr() {}
21510d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.orginline void FlushInfoLog() { fflush(NULL); }
21520d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
21530d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// INTERNAL IMPLEMENTATION - DO NOT USE.
21540d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org//
21550d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// GTEST_CHECK_ is an all-mode assert. It aborts the program if the condition
21560d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// is not satisfied.
21570d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org//  Synopsys:
21580d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org//    GTEST_CHECK_(boolean_condition);
21590d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org//     or
21600d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org//    GTEST_CHECK_(boolean_condition) << "Additional message";
21610d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org//
21620d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org//    This checks the condition and if the condition is not satisfied
21630d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org//    it prints message about the condition violation, including the
21640d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org//    condition itself, plus additional message streamed into it, if any,
21650d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org//    and then it aborts the program. It aborts the program irrespective of
21660d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org//    whether it is built in the debug mode or not.
21670d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org#define GTEST_CHECK_(condition) \
21680d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org    GTEST_AMBIGUOUS_ELSE_BLOCKER_ \
21690d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org    if (::testing::internal::IsTrue(condition)) \
21700d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org      ; \
21710d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org    else \
21720d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org      GTEST_LOG_(FATAL) << "Condition " #condition " failed. "
21730d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
21740d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// An all-mode assert to verify that the given POSIX-style function
21750d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// call returns 0 (indicating success).  Known limitation: this
21760d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// doesn't expand to a balanced 'if' statement, so enclose the macro
21770d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// in {} if you need to use it as the only statement in an 'if'
21780d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// branch.
21790d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org#define GTEST_CHECK_POSIX_SUCCESS_(posix_call) \
21800d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org  if (const int gtest_error = (posix_call)) \
21810d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org    GTEST_LOG_(FATAL) << #posix_call << "failed with error " \
21820d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org                      << gtest_error
21830d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org
21840d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.
21850d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org//
21860d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// Use ImplicitCast_ as a safe version of static_cast for upcasting in
21870d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// the type hierarchy (e.g. casting a Foo* to a SuperclassOfFoo* or a
21880d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// const Foo*).  When you use ImplicitCast_, the compiler checks that
21890d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// the cast is safe.  Such explicit ImplicitCast_s are necessary in
21900d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// surprisingly many situations where C++ demands an exact type match
21910d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// instead of an argument type convertable to a target type.
21920d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org//
21930d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// The syntax for using ImplicitCast_ is the same as for static_cast:
21940d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org//
21950d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org//   ImplicitCast_<ToType>(expr)
21960d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org//
21970d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// ImplicitCast_ would have been part of the C++ standard library,
21980d106b34dc08439a7c6887d1316a3e1a35f8f0cajohannkoenig@chromium.org// but the proposal was submitted too late.  It will probably make