Commit 457fff7a authored by Dominik Charousset's avatar Dominik Charousset

Allow resetting resource via '= nullptr'

parent e06f1a6c
...@@ -368,11 +368,20 @@ public: ...@@ -368,11 +368,20 @@ public:
} }
consumer_resource() = default; consumer_resource() = default;
consumer_resource(consumer_resource&&) = default; consumer_resource(consumer_resource&&) = default;
consumer_resource(const consumer_resource&) = default; consumer_resource(const consumer_resource&) = default;
consumer_resource& operator=(consumer_resource&&) = default; consumer_resource& operator=(consumer_resource&&) = default;
consumer_resource& operator=(const consumer_resource&) = default; consumer_resource& operator=(const consumer_resource&) = default;
consumer_resource& operator=(std::nullptr_t) {
ctrl_ = nullptr;
return *this;
}
/// Tries to open the resource for reading from the buffer. The first `open` /// Tries to open the resource for reading from the buffer. The first `open`
/// wins on concurrent access. /// wins on concurrent access.
/// @returns a pointer to the buffer on success, `nullptr` otherwise. /// @returns a pointer to the buffer on success, `nullptr` otherwise.
...@@ -416,11 +425,21 @@ public: ...@@ -416,11 +425,21 @@ public:
} }
producer_resource() = default; producer_resource() = default;
producer_resource(producer_resource&&) = default; producer_resource(producer_resource&&) = default;
producer_resource(const producer_resource&) = default; producer_resource(const producer_resource&) = default;
producer_resource& operator=(producer_resource&&) = default; producer_resource& operator=(producer_resource&&) = default;
producer_resource& operator=(const producer_resource&) = default; producer_resource& operator=(const producer_resource&) = default;
producer_resource& operator=(std::nullptr_t) {
ctrl_ = nullptr;
return *this;
}
/// Tries to open the resource for writing to the buffer. The first `open` /// Tries to open the resource for writing to the buffer. The first `open`
/// wins on concurrent access. /// wins on concurrent access.
/// @returns a pointer to the buffer on success, `nullptr` otherwise. /// @returns a pointer to the buffer on success, `nullptr` otherwise.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment