diff options
| author | Gennadiy Civil <gennadiycivil@users.noreply.github.com> | 2018-02-13 16:04:47 -0500 | 
|---|---|---|
| committer | GitHub <noreply@github.com> | 2018-02-13 16:04:47 -0500 | 
| commit | 42140509b6fc2337f8cffe913f6ce1dbf489513b (patch) | |
| tree | 3b6053bd3cb619e345daf8e701cc59d09e9994d6 | |
| parent | 0d6a674f6102de3fd5ab3d3250afa1f505794315 (diff) | |
| parent | 8248169287b9c6e4a371e2d16923ded173a8b3e7 (diff) | |
| download | googletest-42140509b6fc2337f8cffe913f6ce1dbf489513b.tar.gz googletest-42140509b6fc2337f8cffe913f6ce1dbf489513b.tar.bz2 googletest-42140509b6fc2337f8cffe913f6ce1dbf489513b.zip  | |
Merge pull request #1459 from gennadiycivil/master
cleanup, merges
| -rw-r--r-- | googletest/include/gtest/internal/gtest-filepath.h | 2 | ||||
| -rw-r--r-- | googletest/include/gtest/internal/gtest-internal.h | 25 | ||||
| -rw-r--r-- | googletest/include/gtest/internal/gtest-port.h | 33 | 
3 files changed, 34 insertions, 26 deletions
diff --git a/googletest/include/gtest/internal/gtest-filepath.h b/googletest/include/gtest/internal/gtest-filepath.h index bce50dc6..406597a4 100644 --- a/googletest/include/gtest/internal/gtest-filepath.h +++ b/googletest/include/gtest/internal/gtest-filepath.h @@ -191,7 +191,7 @@ class GTEST_API_ FilePath {    void Normalize(); -  // Returns a pointer to the last ioccurrence of a valid path separator in +  // Returns a pointer to the last occurence of a valid path separator in    // the FilePath. On Windows, for example, both '/' and '\' are valid path    // separators. Returns NULL if no path separator was found.    const char* FindLastPathSeparator() const; diff --git a/googletest/include/gtest/internal/gtest-internal.h b/googletest/include/gtest/internal/gtest-internal.h index 843058f3..a8a9a8c1 100644 --- a/googletest/include/gtest/internal/gtest-internal.h +++ b/googletest/include/gtest/internal/gtest-internal.h @@ -803,31 +803,6 @@ struct RemoveConst<T[N]> {  #define GTEST_REMOVE_REFERENCE_AND_CONST_(T) \      GTEST_REMOVE_CONST_(GTEST_REMOVE_REFERENCE_(T)) -// Adds reference to a type if it is not a reference type, -// otherwise leaves it unchanged.  This is the same as -// tr1::add_reference, which is not widely available yet. -template <typename T> -struct AddReference { typedef T& type; };  // NOLINT -template <typename T> -struct AddReference<T&> { typedef T& type; };  // NOLINT - -// A handy wrapper around AddReference that works when the argument T -// depends on template parameters. -#define GTEST_ADD_REFERENCE_(T) \ -    typename ::testing::internal::AddReference<T>::type - -// Adds a reference to const on top of T as necessary.  For example, -// it transforms -// -//   char         ==> const char& -//   const char   ==> const char& -//   char&        ==> const char& -//   const char&  ==> const char& -// -// The argument T must depend on some template parameters. -#define GTEST_REFERENCE_TO_CONST_(T) \ -    GTEST_ADD_REFERENCE_(const GTEST_REMOVE_REFERENCE_(T)) -  // ImplicitlyConvertible<From, To>::value is a compile-time bool  // constant that's true iff type From can be implicitly converted to  // type To. diff --git a/googletest/include/gtest/internal/gtest-port.h b/googletest/include/gtest/internal/gtest-port.h index c5416935..81f047bf 100644 --- a/googletest/include/gtest/internal/gtest-port.h +++ b/googletest/include/gtest/internal/gtest-port.h @@ -1366,6 +1366,39 @@ inline void FlushInfoLog() { fflush(NULL); }      GTEST_LOG_(FATAL) << #posix_call << "failed with error " \                        << gtest_error +// Adds reference to a type if it is not a reference type, +// otherwise leaves it unchanged.  This is the same as +// tr1::add_reference, which is not widely available yet. +template <typename T> +struct AddReference { typedef T& type; };  // NOLINT +template <typename T> +struct AddReference<T&> { typedef T& type; };  // NOLINT + +// A handy wrapper around AddReference that works when the argument T +// depends on template parameters. +#define GTEST_ADD_REFERENCE_(T) \ +    typename ::testing::internal::AddReference<T>::type + +// Transforms "T" into "const T&" according to standard reference collapsing +// rules (this is only needed as a backport for C++98 compilers that do not +// support reference collapsing). Specifically, it transforms: +// +//   char         ==> const char& +//   const char   ==> const char& +//   char&        ==> char& +//   const char&  ==> const char& +// +// Note that the non-const reference will not have "const" added. This is +// standard, and necessary so that "T" can always bind to "const T&". +template <typename T> +struct ConstRef { typedef const T& type; }; +template <typename T> +struct ConstRef<T&> { typedef T& type; }; + +// The argument T must depend on some template parameters. +#define GTEST_REFERENCE_TO_CONST_(T) \ +  typename ::testing::internal::ConstRef<T>::type +  #if GTEST_HAS_STD_MOVE_  using std::forward;  using std::move;  | 
