From 5015c289a5c4bcc88b5849d6c137f7f2bd2fde4e Mon Sep 17 00:00:00 2001 From: David Robillard Date: Fri, 27 Nov 2020 17:58:07 +0100 Subject: Remove reliance on deprecated implicit assignment operator --- src/PortID.hpp | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) (limited to 'src/PortID.hpp') 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 -- cgit v1.2.1