diff options
author | Andrei Lebedev <lebdron@gmail.com> | 2018-05-11 08:22:09 +0300 |
---|---|---|
committer | Kirk Shoop <kirk.shoop@gmail.com> | 2018-05-11 08:59:21 -0700 |
commit | c7de35be5dc31785984f9b3c6b21f7bf46a05034 (patch) | |
tree | c68337853da060160fa921455c508a0f24eccbf8 /Rx | |
parent | abaf9881831d3adf52625443611aa1c3ea5e5dbf (diff) | |
download | RxCpp-c7de35be5dc31785984f9b3c6b21f7bf46a05034.tar.gz |
Replace shared_ptr with move ctor
Diffstat (limited to 'Rx')
-rw-r--r-- | Rx/v2/src/rxcpp/rx-scheduler.hpp | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/Rx/v2/src/rxcpp/rx-scheduler.hpp b/Rx/v2/src/rxcpp/rx-scheduler.hpp index 8bdb4dd..dbf6cb2 100644 --- a/Rx/v2/src/rxcpp/rx-scheduler.hpp +++ b/Rx/v2/src/rxcpp/rx-scheduler.hpp @@ -458,12 +458,19 @@ class schedulable : public schedulable_base public: ~exit_recursed_scope_type() { + if (that != nullptr) { that->requestor = nullptr; + } } exit_recursed_scope_type(const recursed_scope_type* that) : that(that) { } + exit_recursed_scope_type(exit_recursed_scope_type && other) /*noexcept*/ + : that(other.that) + { + other.that = nullptr; + } }; public: recursed_scope_type() @@ -480,9 +487,9 @@ class schedulable : public schedulable_base // no change in recursion scope return *this; } - std::shared_ptr<exit_recursed_scope_type> reset(const recurse& r) const { + exit_recursed_scope_type reset(const recurse& r) const { requestor = std::addressof(r.get_recursed()); - return std::make_shared<exit_recursed_scope_type>(this); + return exit_recursed_scope_type(this); } bool is_recursed() const { return !!requestor; |