Commit 01344b6c authored by gabi's avatar gabi

mpcs_q removed default copy ctor and assignment

parent b943265b
...@@ -71,7 +71,7 @@ class mpsc_q ...@@ -71,7 +71,7 @@ class mpsc_q
public: public:
using item_type = T; using item_type = T;
mpsc_q(size_t max_size) : explicit mpsc_q(size_t max_size) :
_max_size(max_size), _max_size(max_size),
_size(0), _size(0),
_stub(), _stub(),
...@@ -80,6 +80,9 @@ public: ...@@ -80,6 +80,9 @@ public:
{ {
} }
mpsc_q(const mpsc_q&) = delete;
mpsc_q& operator=(const mpsc_q&) = delete;
~mpsc_q() ~mpsc_q()
{ {
clear(); clear();
...@@ -116,12 +119,10 @@ public: ...@@ -116,12 +119,10 @@ public:
// Empty the queue by popping all its elements // Empty the queue by popping all its elements
void clear() void clear()
{ {
while (mpscq_node_t* node = pop_node()) while (mpscq_node_t* node = pop_node())
{ {
--_size; --_size;
delete(node); delete(node);
} }
} }
...@@ -139,6 +140,9 @@ private: ...@@ -139,6 +140,9 @@ private:
T value; T value;
mpscq_node_t() :next(nullptr) {} mpscq_node_t() :next(nullptr) {}
mpscq_node_t(const mpscq_node_t&) = delete;
mpscq_node_t& operator=(const mpscq_node_t&) = delete;
explicit mpscq_node_t(const T& value): explicit mpscq_node_t(const T& value):
next(nullptr), next(nullptr),
value(value) {} value(value) {}
......
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