summaryrefslogtreecommitdiffstats
path: root/googletest
diff options
context:
space:
mode:
authorKrystian Kuzniarek <krystian.kuzniarek@gmail.com>2019-08-13 20:30:12 (GMT)
committerKrystian Kuzniarek <krystian.kuzniarek@gmail.com>2019-08-14 12:00:44 (GMT)
commitec49fbca4cb84651fb2eae5d093d0342f356cf29 (patch)
tree24bdf499c55ba728098614c143232c8f5d863be0 /googletest
parent90a443f9c2437ca8a682a1ac625eba64e1d74a8a (diff)
downloadgoogletest-ec49fbca4cb84651fb2eae5d093d0342f356cf29.zip
googletest-ec49fbca4cb84651fb2eae5d093d0342f356cf29.tar.gz
googletest-ec49fbca4cb84651fb2eae5d093d0342f356cf29.tar.bz2
remove custom implementations of std::is_samerefs/pull/2399/head
Diffstat (limited to 'googletest')
-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
-rw-r--r--googletest/test/googletest-output-test_.cc8
-rw-r--r--googletest/test/gtest-typed-test_test.cc17
5 files changed, 23 insertions, 36 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;
diff --git a/googletest/test/googletest-output-test_.cc b/googletest/test/googletest-output-test_.cc
index 83be568..4f716d8 100644
--- a/googletest/test/googletest-output-test_.cc
+++ b/googletest/test/googletest-output-test_.cc
@@ -816,9 +816,9 @@ class TypedTestNames {
public:
template <typename T>
static std::string GetName(int i) {
- if (testing::internal::IsSame<T, char>::value)
+ if (std::is_same<T, char>::value)
return std::string("char") + ::testing::PrintToString(i);
- if (testing::internal::IsSame<T, int>::value)
+ if (std::is_same<T, int>::value)
return std::string("int") + ::testing::PrintToString(i);
}
};
@@ -857,10 +857,10 @@ class TypedTestPNames {
public:
template <typename T>
static std::string GetName(int i) {
- if (testing::internal::IsSame<T, unsigned char>::value) {
+ if (std::is_same<T, unsigned char>::value) {
return std::string("unsignedChar") + ::testing::PrintToString(i);
}
- if (testing::internal::IsSame<T, unsigned int>::value) {
+ if (std::is_same<T, unsigned int>::value) {
return std::string("unsignedInt") + ::testing::PrintToString(i);
}
}
diff --git a/googletest/test/gtest-typed-test_test.cc b/googletest/test/gtest-typed-test_test.cc
index f1ca937..5411832 100644
--- a/googletest/test/gtest-typed-test_test.cc
+++ b/googletest/test/gtest-typed-test_test.cc
@@ -31,6 +31,7 @@
#include "test/gtest-typed-test_test.h"
#include <set>
+#include <type_traits>
#include <vector>
#include "gtest/gtest.h"
@@ -177,10 +178,10 @@ class TypedTestNames {
public:
template <typename T>
static std::string GetName(int i) {
- if (testing::internal::IsSame<T, char>::value) {
+ if (std::is_same<T, char>::value) {
return std::string("char") + ::testing::PrintToString(i);
}
- if (testing::internal::IsSame<T, int>::value) {
+ if (std::is_same<T, int>::value) {
return std::string("int") + ::testing::PrintToString(i);
}
}
@@ -189,13 +190,13 @@ class TypedTestNames {
TYPED_TEST_SUITE(TypedTestWithNames, TwoTypes, TypedTestNames);
TYPED_TEST(TypedTestWithNames, TestSuiteName) {
- if (testing::internal::IsSame<TypeParam, char>::value) {
+ if (std::is_same<TypeParam, char>::value) {
EXPECT_STREQ(::testing::UnitTest::GetInstance()
->current_test_info()
->test_case_name(),
"TypedTestWithNames/char0");
}
- if (testing::internal::IsSame<TypeParam, int>::value) {
+ if (std::is_same<TypeParam, int>::value) {
EXPECT_STREQ(::testing::UnitTest::GetInstance()
->current_test_info()
->test_case_name(),
@@ -311,13 +312,13 @@ class TypeParametrizedTestWithNames : public Test {};
TYPED_TEST_SUITE_P(TypeParametrizedTestWithNames);
TYPED_TEST_P(TypeParametrizedTestWithNames, TestSuiteName) {
- if (testing::internal::IsSame<TypeParam, char>::value) {
+ if (std::is_same<TypeParam, char>::value) {
EXPECT_STREQ(::testing::UnitTest::GetInstance()
->current_test_info()
->test_case_name(),
"CustomName/TypeParametrizedTestWithNames/parChar0");
}
- if (testing::internal::IsSame<TypeParam, int>::value) {
+ if (std::is_same<TypeParam, int>::value) {
EXPECT_STREQ(::testing::UnitTest::GetInstance()
->current_test_info()
->test_case_name(),
@@ -331,10 +332,10 @@ class TypeParametrizedTestNames {
public:
template <typename T>
static std::string GetName(int i) {
- if (testing::internal::IsSame<T, char>::value) {
+ if (std::is_same<T, char>::value) {
return std::string("parChar") + ::testing::PrintToString(i);
}
- if (testing::internal::IsSame<T, int>::value) {
+ if (std::is_same<T, int>::value) {
return std::string("parInt") + ::testing::PrintToString(i);
}
}