diff options
author | David Robillard <d@drobilla.net> | 2020-11-27 17:58:07 +0100 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2020-11-27 21:42:52 +0100 |
commit | 5015c289a5c4bcc88b5849d6c137f7f2bd2fde4e (patch) | |
tree | 06933449418fd65147b7761002a60afeb560b6fd /src | |
parent | 72c86edaecea3d80f5e46c0124db16a020a4343e (diff) | |
download | patchage-5015c289a5c4bcc88b5849d6c137f7f2bd2fde4e.tar.gz patchage-5015c289a5c4bcc88b5849d6c137f7f2bd2fde4e.tar.bz2 patchage-5015c289a5c4bcc88b5849d6c137f7f2bd2fde4e.zip |
Remove reliance on deprecated implicit assignment operator
Diffstat (limited to 'src')
-rw-r--r-- | src/PortID.hpp | 22 |
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, ©.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, ©.id, sizeof(id)); + } + + PortID& operator=(const PortID& copy) + { + if (© != this) { + type = copy.type; + memcpy(&id, ©.id, sizeof(id)); + } + + return *this; + } + Type type = Type::nothing; union |