Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
googletest
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Chen Yisong
googletest
Commits
d370f85b
Commit
d370f85b
authored
Nov 17, 2014
by
kosak
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Call move() by qualified name (::testing::internal::move() or just internal::move()).
Pull in gtest 696.
parent
389bad61
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
6 deletions
+10
-6
gmock-actions.h
include/gmock/gmock-actions.h
+3
-3
gmock-spec-builders.h
include/gmock/gmock-spec-builders.h
+7
-3
No files found.
include/gmock/gmock-actions.h
View file @
d370f85b
...
@@ -463,7 +463,7 @@ class ActionAdaptor : public ActionInterface<F1> {
...
@@ -463,7 +463,7 @@ class ActionAdaptor : public ActionInterface<F1> {
// on return. Useful for move-only types, but could be used on any type.
// on return. Useful for move-only types, but could be used on any type.
template
<
typename
T
>
template
<
typename
T
>
struct
ByMoveWrapper
{
struct
ByMoveWrapper
{
explicit
ByMoveWrapper
(
T
value
)
:
payload
(
move
(
value
))
{}
explicit
ByMoveWrapper
(
T
value
)
:
payload
(
internal
::
move
(
value
))
{}
T
payload
;
T
payload
;
};
};
...
@@ -497,7 +497,7 @@ class ReturnAction {
...
@@ -497,7 +497,7 @@ class ReturnAction {
// Constructs a ReturnAction object from the value to be returned.
// Constructs a ReturnAction object from the value to be returned.
// 'value' is passed by value instead of by const reference in order
// 'value' is passed by value instead of by const reference in order
// to allow Return("string literal") to compile.
// to allow Return("string literal") to compile.
explicit
ReturnAction
(
R
value
)
:
value_
(
new
R
(
move
(
value
)))
{}
explicit
ReturnAction
(
R
value
)
:
value_
(
new
R
(
internal
::
move
(
value
)))
{}
// This template type conversion operator allows Return(x) to be
// This template type conversion operator allows Return(x) to be
// used in ANY function that returns x's type.
// used in ANY function that returns x's type.
...
@@ -561,7 +561,7 @@ class ReturnAction {
...
@@ -561,7 +561,7 @@ class ReturnAction {
GTEST_CHECK_
(
!
performed_
)
GTEST_CHECK_
(
!
performed_
)
<<
"A ByMove() action should only be performed once."
;
<<
"A ByMove() action should only be performed once."
;
performed_
=
true
;
performed_
=
true
;
return
move
(
wrapper_
->
payload
);
return
internal
::
move
(
wrapper_
->
payload
);
}
}
private
:
private
:
...
...
include/gmock/gmock-spec-builders.h
View file @
d370f85b
...
@@ -1302,12 +1302,14 @@ template <typename T>
...
@@ -1302,12 +1302,14 @@ template <typename T>
class
ReferenceOrValueWrapper
{
class
ReferenceOrValueWrapper
{
public
:
public
:
// Constructs a wrapper from the given value/reference.
// Constructs a wrapper from the given value/reference.
explicit
ReferenceOrValueWrapper
(
T
value
)
:
value_
(
move
(
value
))
{}
explicit
ReferenceOrValueWrapper
(
T
value
)
:
value_
(
::
testing
::
internal
::
move
(
value
))
{
}
// Unwraps and returns the underlying value/reference, exactly as
// Unwraps and returns the underlying value/reference, exactly as
// originally passed. The behavior of calling this more than once on
// originally passed. The behavior of calling this more than once on
// the same object is unspecified.
// the same object is unspecified.
T
Unwrap
()
{
return
move
(
value_
);
}
T
Unwrap
()
{
return
::
testing
::
internal
::
move
(
value_
);
}
// Provides nondestructive access to the underlying value/reference.
// Provides nondestructive access to the underlying value/reference.
// Always returns a const reference (more precisely,
// Always returns a const reference (more precisely,
...
@@ -1404,7 +1406,9 @@ class ActionResultHolder : public UntypedActionResultHolderBase {
...
@@ -1404,7 +1406,9 @@ class ActionResultHolder : public UntypedActionResultHolderBase {
private
:
private
:
typedef
ReferenceOrValueWrapper
<
T
>
Wrapper
;
typedef
ReferenceOrValueWrapper
<
T
>
Wrapper
;
explicit
ActionResultHolder
(
Wrapper
result
)
:
result_
(
move
(
result
))
{}
explicit
ActionResultHolder
(
Wrapper
result
)
:
result_
(
::
testing
::
internal
::
move
(
result
))
{
}
Wrapper
result_
;
Wrapper
result_
;
...
...
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