summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/syncedsettings.h24
1 files changed, 22 insertions, 2 deletions
diff --git a/src/syncedsettings.h b/src/syncedsettings.h
index e60eb78..4991627 100644
--- a/src/syncedsettings.h
+++ b/src/syncedsettings.h
@@ -76,7 +76,6 @@ public:
: mutex{}
, data{}
{
- std::lock_guard<std::mutex> lock{mutex};
std::lock_guard<std::mutex> lock{other.mutex};
data = other.data;
}
@@ -85,11 +84,32 @@ public:
: mutex{}
, data{}
{
- std::lock_guard<std::mutex> lock{mutex};
std::lock_guard<std::mutex> lock{other.mutex};
std::swap(data, other.data);
}
+ Group<T>& operator=(const Group<T>& other)
+ {
+ if (*this != &other)
+ {
+ std::lock_guard<std::mutex> lock{mutex};
+ std::lock_guard<std::mutex> lock{other.mutex};
+ data = other.data;
+ }
+ return *this;
+ }
+
+ Group<T>& operator=(Group<T>&& other)
+ {
+ if (*this != &other)
+ {
+ std::lock_guard<std::mutex> lock{mutex};
+ std::lock_guard<std::mutex> lock{other.mutex};
+ std::swap(data, tmp.data);
+ }
+ return *this;
+ }
+
operator T() const
{
std::lock_guard<std::mutex> lock{mutex};