summaryrefslogtreecommitdiffstats
path: root/googletest/include/gtest
diff options
context:
space:
mode:
authorGennadiy Civil <misterg@google.com>2019-08-15 21:34:18 (GMT)
committerGennadiy Civil <misterg@google.com>2019-08-15 21:34:18 (GMT)
commit9b70406919faddd764cb73b9d0ebb118c0a386ea (patch)
treeeaa9cd450a7729b5c867221dbff8fdc1243f7e1b /googletest/include/gtest
parent6aba4a5c45c03c2367c3390708c049fa8bc14487 (diff)
parentec49fbca4cb84651fb2eae5d093d0342f356cf29 (diff)
downloadgoogletest-9b70406919faddd764cb73b9d0ebb118c0a386ea.zip
googletest-9b70406919faddd764cb73b9d0ebb118c0a386ea.tar.gz
googletest-9b70406919faddd764cb73b9d0ebb118c0a386ea.tar.bz2
Merge pull request #2399 from kuzkry:custom-type-traits-is_same
PiperOrigin-RevId: 263568712
Diffstat (limited to 'googletest/include/gtest')
-rw-r--r--googletest/include/gtest/gtest-matchers.h12
-rw-r--r--googletest/include/gtest/internal/gtest-internal.h6
-rw-r--r--googletest/include/gtest/internal/gtest-port.h16
3 files changed, 10 insertions, 24 deletions
diff --git a/googletest/include/gtest/gtest-matchers.h b/googletest/include/gtest/gtest-matchers.h
index 7711178..0548806 100644
--- a/googletest/include/gtest/gtest-matchers.h
+++ b/googletest/include/gtest/gtest-matchers.h
@@ -42,6 +42,7 @@
#include <memory>
#include <ostream>
#include <string>
+#include <type_traits>
#include "gtest/gtest-printers.h"
#include "gtest/internal/gtest-internal.h"
@@ -299,8 +300,8 @@ class MatcherBase {
template <typename U>
explicit MatcherBase(
const MatcherInterface<U>* impl,
- typename internal::EnableIf<
- !internal::IsSame<U, const U&>::value>::type* = nullptr)
+ typename internal::EnableIf<!std::is_same<U, const U&>::value>::type* =
+ nullptr)
: impl_(new internal::MatcherInterfaceAdapter<U>(impl)) {}
MatcherBase(const MatcherBase&) = default;
@@ -333,9 +334,10 @@ class Matcher : public internal::MatcherBase<T> {
: internal::MatcherBase<T>(impl) {}
template <typename U>
- explicit Matcher(const MatcherInterface<U>* impl,
- typename internal::EnableIf<
- !internal::IsSame<U, const U&>::value>::type* = nullptr)
+ explicit Matcher(
+ const MatcherInterface<U>* impl,
+ typename internal::EnableIf<!std::is_same<U, const U&>::value>::type* =
+ nullptr)
: internal::MatcherBase<T>(impl) {}
// Implicit constructor here allows people to write
diff --git a/googletest/include/gtest/internal/gtest-internal.h b/googletest/include/gtest/internal/gtest-internal.h
index 08531d8..240d791 100644
--- a/googletest/include/gtest/internal/gtest-internal.h
+++ b/googletest/include/gtest/internal/gtest-internal.h
@@ -977,9 +977,9 @@ template <typename C>
struct IsRecursiveContainerImpl<C, true> {
using value_type = decltype(*std::declval<typename C::const_iterator>());
using type =
- is_same<typename std::remove_const<
- typename std::remove_reference<value_type>::type>::type,
- C>;
+ std::is_same<typename std::remove_const<
+ typename std::remove_reference<value_type>::type>::type,
+ C>;
};
// IsRecursiveContainer<Type> is a unary compile-time predicate that
diff --git a/googletest/include/gtest/internal/gtest-port.h b/googletest/include/gtest/internal/gtest-port.h
index 4f887c5..7f00fe7 100644
--- a/googletest/include/gtest/internal/gtest-port.h
+++ b/googletest/include/gtest/internal/gtest-port.h
@@ -869,16 +869,6 @@ struct StaticAssertTypeEqHelper<T, T> {
enum { value = true };
};
-// Same as std::is_same<>.
-template <typename T, typename U>
-struct IsSame {
- enum { value = false };
-};
-template <typename T>
-struct IsSame<T, T> {
- enum { value = true };
-};
-
// Evaluates to the number of elements in 'array'.
#define GTEST_ARRAY_SIZE_(array) (sizeof(array) / sizeof(array[0]))
@@ -1931,12 +1921,6 @@ template <bool bool_value> const bool bool_constant<bool_value>::value;
typedef bool_constant<false> false_type;
typedef bool_constant<true> true_type;
-template <typename T, typename U>
-struct is_same : public false_type {};
-
-template <typename T>
-struct is_same<T, T> : public true_type {};
-
template <typename Iterator>
struct IteratorTraits {
typedef typename Iterator::value_type value_type;