diff options
Diffstat (limited to 'googlemock/include/gmock/gmock-spec-builders.h')
-rw-r--r-- | googlemock/include/gmock/gmock-spec-builders.h | 45 |
1 files changed, 21 insertions, 24 deletions
diff --git a/googlemock/include/gmock/gmock-spec-builders.h b/googlemock/include/gmock/gmock-spec-builders.h index d085df34..5d4b73ba 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" @@ -398,13 +399,13 @@ class GTEST_API_ Mock { static bool VerifyAndClear(void* mock_obj) GTEST_LOCK_EXCLUDED_(internal::g_gmock_mutex); - // Returns wether the mock was created as a naggy mock (default) + // Returns whether the mock was created as a naggy mock (default) static bool IsNaggy(void* mock_obj) GTEST_LOCK_EXCLUDED_(internal::g_gmock_mutex); - // Returns wether the mock was created as a nice mock + // Returns whether the mock was created as a nice mock static bool IsNice(void* mock_obj) GTEST_LOCK_EXCLUDED_(internal::g_gmock_mutex); - // Returns wether the mock was created as a strict mock + // Returns whether the mock was created as a strict mock static bool IsStrict(void* mock_obj) GTEST_LOCK_EXCLUDED_(internal::g_gmock_mutex); @@ -1330,13 +1331,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, @@ -1411,27 +1412,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_; @@ -1452,9 +1452,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; } @@ -1462,9 +1462,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; } @@ -1519,13 +1518,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 + @@ -1550,7 +1548,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); } @@ -1564,7 +1562,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(): @@ -1604,8 +1602,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. |