Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
yangql
googletest
Commits
c6d88409
Commit
c6d88409
authored
Aug 23, 2019
by
Xiaoyi Zhang
Browse files
Merge pull request #2401 from kuzkry:custom-type-traits-add_lvalue_reference
PiperOrigin-RevId: 264842713
parents
9bf34ace
2c2c9e33
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
0 additions
and
38 deletions
+0
-38
googletest/include/gtest/internal/gtest-port.h
googletest/include/gtest/internal/gtest-port.h
+0
-13
googletest/test/gtest_unittest.cc
googletest/test/gtest_unittest.cc
+0
-25
No files found.
googletest/include/gtest/internal/gtest-port.h
View file @
c6d88409
...
@@ -1019,19 +1019,6 @@ inline void FlushInfoLog() { fflush(nullptr); }
...
@@ -1019,19 +1019,6 @@ inline void FlushInfoLog() { fflush(nullptr); }
GTEST_LOG_(FATAL) << #posix_call << "failed with error " \
GTEST_LOG_(FATAL) << #posix_call << "failed with error " \
<< gtest_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
// 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
// rules (this is only needed as a backport for C++98 compilers that do not
// support reference collapsing). Specifically, it transforms:
// support reference collapsing). Specifically, it transforms:
...
...
googletest/test/gtest_unittest.cc
View file @
c6d88409
...
@@ -227,7 +227,6 @@ using testing::TestProperty;
...
@@ -227,7 +227,6 @@ using testing::TestProperty;
using
testing
::
TestResult
;
using
testing
::
TestResult
;
using
testing
::
TimeInMillis
;
using
testing
::
TimeInMillis
;
using
testing
::
UnitTest
;
using
testing
::
UnitTest
;
using
testing
::
internal
::
AddReference
;
using
testing
::
internal
::
AlwaysFalse
;
using
testing
::
internal
::
AlwaysFalse
;
using
testing
::
internal
::
AlwaysTrue
;
using
testing
::
internal
::
AlwaysTrue
;
using
testing
::
internal
::
AppendUserMessage
;
using
testing
::
internal
::
AppendUserMessage
;
...
@@ -7150,30 +7149,6 @@ TEST(RemoveReferenceToConstTest, Works) {
...
@@ -7150,30 +7149,6 @@ TEST(RemoveReferenceToConstTest, Works) {
TestGTestRemoveReferenceAndConst
<
const
char
*
,
const
char
*>
();
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_.
// Tests GTEST_REFERENCE_TO_CONST_.
template
<
typename
T1
,
typename
T2
>
template
<
typename
T1
,
typename
T2
>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment