summaryrefslogtreecommitdiffstats
path: root/src/PortID.hpp
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2020-11-27 17:58:07 +0100
committerDavid Robillard <d@drobilla.net>2020-11-27 21:42:52 +0100
commit5015c289a5c4bcc88b5849d6c137f7f2bd2fde4e (patch)
tree06933449418fd65147b7761002a60afeb560b6fd /src/PortID.hpp
parent72c86edaecea3d80f5e46c0124db16a020a4343e (diff)
downloadpatchage-5015c289a5c4bcc88b5849d6c137f7f2bd2fde4e.tar.gz
patchage-5015c289a5c4bcc88b5849d6c137f7f2bd2fde4e.tar.bz2
patchage-5015c289a5c4bcc88b5849d6c137f7f2bd2fde4e.zip
Remove reliance on deprecated implicit assignment operator
Diffstat (limited to 'src/PortID.hpp')
-rw-r--r--src/PortID.hpp22
1 files changed, 16 insertions, 6 deletions
diff --git a/src/PortID.hpp b/src/PortID.hpp
index 054008f..8132639 100644
--- a/src/PortID.hpp
+++ b/src/PortID.hpp
@@ -42,12 +42,6 @@ struct PortID
PortID() = default;
- PortID(const PortID& copy)
- : type(copy.type)
- {
- memcpy(&id, &copy.id, sizeof(id));
- }
-
#ifdef PATCHAGE_LIBJACK
explicit PortID(jack_port_id_t jack_id, bool = false)
: type(Type::jack_id)
@@ -65,6 +59,22 @@ struct PortID
}
#endif
+ PortID(const PortID& copy)
+ : type(copy.type)
+ {
+ memcpy(&id, &copy.id, sizeof(id));
+ }
+
+ PortID& operator=(const PortID& copy)
+ {
+ if (&copy != this) {
+ type = copy.type;
+ memcpy(&id, &copy.id, sizeof(id));
+ }
+
+ return *this;
+ }
+
Type type = Type::nothing;
union