diff options
author | Jerry Turcios <jerryturcios08@gmail.com> | 2018-10-29 21:09:25 -0400 |
---|---|---|
committer | Jerry Turcios <jerryturcios08@gmail.com> | 2018-10-29 21:09:25 -0400 |
commit | 3896e3b593c332087564a767b3d8f2e7c8dbbd25 (patch) | |
tree | 1bac50c1afdb97db255a4fbef0b33941c8025f12 /googlemock/include/gmock/gmock-actions.h | |
parent | b8a03c80ad59a4735f852ab13725f2d14ead424f (diff) | |
parent | b9347b31c338851879d0105f0fe32d09007f0433 (diff) | |
download | googletest-3896e3b593c332087564a767b3d8f2e7c8dbbd25.tar.gz googletest-3896e3b593c332087564a767b3d8f2e7c8dbbd25.tar.bz2 googletest-3896e3b593c332087564a767b3d8f2e7c8dbbd25.zip |
Merge branch 'master' of https://github.com/google/googletest
Diffstat (limited to 'googlemock/include/gmock/gmock-actions.h')
-rw-r--r-- | googlemock/include/gmock/gmock-actions.h | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/googlemock/include/gmock/gmock-actions.h b/googlemock/include/gmock/gmock-actions.h index d4af9490..e4af9d2d 100644 --- a/googlemock/include/gmock/gmock-actions.h +++ b/googlemock/include/gmock/gmock-actions.h @@ -42,6 +42,7 @@ #endif #include <algorithm> +#include <memory> #include <string> #include <utility> @@ -346,9 +347,7 @@ class ActionInterface { // An Action<F> is a copyable and IMMUTABLE (except by assignment) // object that represents an action to be taken when a mock function // of type F is called. The implementation of Action<T> is just a -// linked_ptr to const ActionInterface<T>, so copying is fairly cheap. -// Don't inherit from Action! -// +// std::shared_ptr to const ActionInterface<T>. Don't inherit from Action! // You can view an object implementing ActionInterface<F> as a // concrete action (including its current state), and an Action<F> // object as a handle to it. @@ -425,7 +424,7 @@ class Action { #if GTEST_LANG_CXX11 ::std::function<F> fun_; #endif - internal::linked_ptr<ActionInterface<F> > impl_; + std::shared_ptr<ActionInterface<F>> impl_; }; // The PolymorphicAction class template makes it easy to implement a @@ -519,7 +518,7 @@ class ActionAdaptor : public ActionInterface<F1> { } private: - const internal::linked_ptr<ActionInterface<F2> > impl_; + const std::shared_ptr<ActionInterface<F2>> impl_; GTEST_DISALLOW_ASSIGN_(ActionAdaptor); }; @@ -601,7 +600,7 @@ class ReturnAction { // Result to call. ImplicitCast_ forces the compiler to convert R to // Result without considering explicit constructors, thus resolving the // ambiguity. value_ is then initialized using its copy constructor. - explicit Impl(const linked_ptr<R>& value) + explicit Impl(const std::shared_ptr<R>& value) : value_before_cast_(*value), value_(ImplicitCast_<Result>(value_before_cast_)) {} @@ -626,7 +625,7 @@ class ReturnAction { typedef typename Function<F>::Result Result; typedef typename Function<F>::ArgumentTuple ArgumentTuple; - explicit Impl(const linked_ptr<R>& wrapper) + explicit Impl(const std::shared_ptr<R>& wrapper) : performed_(false), wrapper_(wrapper) {} virtual Result Perform(const ArgumentTuple&) { @@ -638,12 +637,12 @@ class ReturnAction { private: bool performed_; - const linked_ptr<R> wrapper_; + const std::shared_ptr<R> wrapper_; GTEST_DISALLOW_ASSIGN_(Impl); }; - const linked_ptr<R> value_; + const std::shared_ptr<R> value_; GTEST_DISALLOW_ASSIGN_(ReturnAction); }; @@ -866,7 +865,7 @@ class SetArgumentPointeeAction<N, Proto, true> { } private: - const internal::linked_ptr<Proto> proto_; + const std::shared_ptr<Proto> proto_; GTEST_DISALLOW_ASSIGN_(SetArgumentPointeeAction); }; @@ -931,7 +930,7 @@ class InvokeCallbackWithoutArgsAction { Result Perform(const ArgumentTuple&) const { return callback_->Run(); } private: - const internal::linked_ptr<CallbackType> callback_; + const std::shared_ptr<CallbackType> callback_; GTEST_DISALLOW_ASSIGN_(InvokeCallbackWithoutArgsAction); }; |