summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Lebedev <lebdron@gmail.com>2018-05-11 08:22:09 +0300
committerKirk Shoop <kirk.shoop@gmail.com>2018-05-11 08:59:21 -0700
commitc7de35be5dc31785984f9b3c6b21f7bf46a05034 (patch)
treec68337853da060160fa921455c508a0f24eccbf8
parentabaf9881831d3adf52625443611aa1c3ea5e5dbf (diff)
downloadRxCpp-c7de35be5dc31785984f9b3c6b21f7bf46a05034.tar.gz
Replace shared_ptr with move ctor
-rw-r--r--Rx/v2/src/rxcpp/rx-scheduler.hpp11
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;