mirror of
https://github.com/google/googletest.git
synced 2024-12-28 19:15:24 +08:00
remove a custom implementation of std::add_lvalue_reference
This commit is contained in:
parent
90a443f9c2
commit
2c2c9e3357
@ -1029,19 +1029,6 @@ inline void FlushInfoLog() { fflush(nullptr); }
|
||||
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:
|
||||
|
@ -226,7 +226,6 @@ using testing::TestProperty;
|
||||
using testing::TestResult;
|
||||
using testing::TimeInMillis;
|
||||
using testing::UnitTest;
|
||||
using testing::internal::AddReference;
|
||||
using testing::internal::AlwaysFalse;
|
||||
using testing::internal::AlwaysTrue;
|
||||
using testing::internal::AppendUserMessage;
|
||||
@ -7177,30 +7176,6 @@ TEST(RemoveReferenceToConstTest, Works) {
|
||||
TestGTestRemoveReferenceAndConst<const char*, const char*>();
|
||||
}
|
||||
|
||||
// Tests that AddReference does not affect reference types.
|
||||
TEST(AddReferenceTest, DoesNotAffectReferenceType) {
|
||||
CompileAssertTypesEqual<int&, AddReference<int&>::type>();
|
||||
CompileAssertTypesEqual<const char&, AddReference<const char&>::type>();
|
||||
}
|
||||
|
||||
// Tests that AddReference adds reference to non-reference types.
|
||||
TEST(AddReferenceTest, AddsReference) {
|
||||
CompileAssertTypesEqual<int&, AddReference<int>::type>();
|
||||
CompileAssertTypesEqual<const char&, AddReference<const char>::type>();
|
||||
}
|
||||
|
||||
// Tests GTEST_ADD_REFERENCE_.
|
||||
|
||||
template <typename T1, typename T2>
|
||||
void TestGTestAddReference() {
|
||||
CompileAssertTypesEqual<T1, GTEST_ADD_REFERENCE_(T2)>();
|
||||
}
|
||||
|
||||
TEST(AddReferenceTest, MacroVersion) {
|
||||
TestGTestAddReference<int&, int>();
|
||||
TestGTestAddReference<const char&, const char&>();
|
||||
}
|
||||
|
||||
// Tests GTEST_REFERENCE_TO_CONST_.
|
||||
|
||||
template <typename T1, typename T2>
|
||||
|
Loading…
x
Reference in New Issue
Block a user