aboutsummaryrefslogtreecommitdiffstats
path: root/googlemock/include/gmock/gmock-spec-builders.h
diff options
context:
space:
mode:
Diffstat (limited to 'googlemock/include/gmock/gmock-spec-builders.h')
-rw-r--r--googlemock/include/gmock/gmock-spec-builders.h39
1 files changed, 18 insertions, 21 deletions
diff --git a/googlemock/include/gmock/gmock-spec-builders.h b/googlemock/include/gmock/gmock-spec-builders.h
index b98e48b4..849bc92a 100644
--- a/googlemock/include/gmock/gmock-spec-builders.h
+++ b/googlemock/include/gmock/gmock-spec-builders.h
@@ -65,6 +65,7 @@
#include <set>
#include <sstream>
#include <string>
+#include <utility>
#include <vector>
#include "gmock/gmock-actions.h"
#include "gmock/gmock-cardinalities.h"
@@ -1320,13 +1321,13 @@ class ReferenceOrValueWrapper {
public:
// Constructs a wrapper from the given value/reference.
explicit ReferenceOrValueWrapper(T value)
- : value_(::testing::internal::move(value)) {
+ : value_(std::move(value)) {
}
// Unwraps and returns the underlying value/reference, exactly as
// originally passed. The behavior of calling this more than once on
// the same object is unspecified.
- T Unwrap() { return ::testing::internal::move(value_); }
+ T Unwrap() { return std::move(value_); }
// Provides nondestructive access to the underlying value/reference.
// Always returns a const reference (more precisely,
@@ -1401,27 +1402,26 @@ class ActionResultHolder : public UntypedActionResultHolderBase {
template <typename F>
static ActionResultHolder* PerformDefaultAction(
const FunctionMockerBase<F>* func_mocker,
- typename RvalueRef<typename Function<F>::ArgumentTuple>::type args,
+ typename Function<F>::ArgumentTuple&& args,
const std::string& call_description) {
return new ActionResultHolder(Wrapper(func_mocker->PerformDefaultAction(
- internal::move(args), call_description)));
+ std::move(args), call_description)));
}
// Performs the given action and returns the result in a new-ed
// ActionResultHolder.
template <typename F>
static ActionResultHolder* PerformAction(
- const Action<F>& action,
- typename RvalueRef<typename Function<F>::ArgumentTuple>::type args) {
+ const Action<F>& action, typename Function<F>::ArgumentTuple&& args) {
return new ActionResultHolder(
- Wrapper(action.Perform(internal::move(args))));
+ Wrapper(action.Perform(std::move(args))));
}
private:
typedef ReferenceOrValueWrapper<T> Wrapper;
explicit ActionResultHolder(Wrapper result)
- : result_(::testing::internal::move(result)) {
+ : result_(std::move(result)) {
}
Wrapper result_;
@@ -1442,9 +1442,9 @@ class ActionResultHolder<void> : public UntypedActionResultHolderBase {
template <typename F>
static ActionResultHolder* PerformDefaultAction(
const FunctionMockerBase<F>* func_mocker,
- typename RvalueRef<typename Function<F>::ArgumentTuple>::type args,
+ typename Function<F>::ArgumentTuple&& args,
const std::string& call_description) {
- func_mocker->PerformDefaultAction(internal::move(args), call_description);
+ func_mocker->PerformDefaultAction(std::move(args), call_description);
return new ActionResultHolder;
}
@@ -1452,9 +1452,8 @@ class ActionResultHolder<void> : public UntypedActionResultHolderBase {
// ActionResultHolder*.
template <typename F>
static ActionResultHolder* PerformAction(
- const Action<F>& action,
- typename RvalueRef<typename Function<F>::ArgumentTuple>::type args) {
- action.Perform(internal::move(args));
+ const Action<F>& action, typename Function<F>::ArgumentTuple&& args) {
+ action.Perform(std::move(args));
return new ActionResultHolder;
}
@@ -1509,13 +1508,12 @@ class FunctionMockerBase : public UntypedFunctionMockerBase {
// mutable state of this object, and thus can be called concurrently
// without locking.
// L = *
- Result PerformDefaultAction(
- typename RvalueRef<typename Function<F>::ArgumentTuple>::type args,
- const std::string& call_description) const {
+ Result PerformDefaultAction(typename Function<F>::ArgumentTuple&& args,
+ const std::string& call_description) const {
const OnCallSpec<F>* const spec =
this->FindOnCallSpec(args);
if (spec != nullptr) {
- return spec->GetAction().Perform(internal::move(args));
+ return spec->GetAction().Perform(std::move(args));
}
const std::string message =
call_description +
@@ -1540,7 +1538,7 @@ class FunctionMockerBase : public UntypedFunctionMockerBase {
void* untyped_args, // must point to an ArgumentTuple
const std::string& call_description) const {
ArgumentTuple* args = static_cast<ArgumentTuple*>(untyped_args);
- return ResultHolder::PerformDefaultAction(this, internal::move(*args),
+ return ResultHolder::PerformDefaultAction(this, std::move(*args),
call_description);
}
@@ -1554,7 +1552,7 @@ class FunctionMockerBase : public UntypedFunctionMockerBase {
// action deletes the mock object (and thus deletes itself).
const Action<F> action = *static_cast<const Action<F>*>(untyped_action);
ArgumentTuple* args = static_cast<ArgumentTuple*>(untyped_args);
- return ResultHolder::PerformAction(action, internal::move(*args));
+ return ResultHolder::PerformAction(action, std::move(*args));
}
// Implements UntypedFunctionMockerBase::ClearDefaultActionsLocked():
@@ -1594,8 +1592,7 @@ class FunctionMockerBase : public UntypedFunctionMockerBase {
// Returns the result of invoking this mock function with the given
// arguments. This function can be safely called from multiple
// threads concurrently.
- Result InvokeWith(
- typename RvalueRef<typename Function<F>::ArgumentTuple>::type args)
+ Result InvokeWith(typename Function<F>::ArgumentTuple&& args)
GTEST_LOCK_EXCLUDED_(g_gmock_mutex) {
// const_cast is required since in C++98 we still pass ArgumentTuple around
// by const& instead of rvalue reference.