From 5bed3502ef16d3955d3167fc26f81cca482ed593 Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Wed, 22 Jul 2015 14:15:17 -0700 Subject: [PATCH] fix order of ctors and assignment operators --- libraries/networking/src/NLPacket.cpp | 16 ++++++++-------- libraries/networking/src/NLPacket.h | 3 ++- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/libraries/networking/src/NLPacket.cpp b/libraries/networking/src/NLPacket.cpp index fb2561486a..39dc296f85 100644 --- a/libraries/networking/src/NLPacket.cpp +++ b/libraries/networking/src/NLPacket.cpp @@ -101,14 +101,6 @@ NLPacket::NLPacket(const NLPacket& other) : Packet(other) { _sourceID = other._sourceID; } -NLPacket& NLPacket::operator=(const NLPacket& other) { - Packet::operator=(other); - - _sourceID = other._sourceID; - - return *this; -} - NLPacket::NLPacket(std::unique_ptr data, qint64 size, const HifiSockAddr& senderSockAddr) : Packet(std::move(data), size, senderSockAddr) { @@ -126,6 +118,14 @@ NLPacket::NLPacket(NLPacket&& other) : _sourceID = std::move(other._sourceID); } +NLPacket& NLPacket::operator=(const NLPacket& other) { + Packet::operator=(other); + + _sourceID = other._sourceID; + + return *this; +} + NLPacket& NLPacket::operator=(NLPacket&& other) { Packet::operator=(std::move(other)); diff --git a/libraries/networking/src/NLPacket.h b/libraries/networking/src/NLPacket.h index aad6e6d072..57c099764a 100644 --- a/libraries/networking/src/NLPacket.h +++ b/libraries/networking/src/NLPacket.h @@ -51,8 +51,9 @@ protected: NLPacket(std::unique_ptr data, qint64 size, const HifiSockAddr& senderSockAddr); NLPacket(std::unique_ptr packet); NLPacket(const NLPacket& other); - NLPacket& operator=(const NLPacket& other); NLPacket(NLPacket&& other); + + NLPacket& operator=(const NLPacket& other); NLPacket& operator=(NLPacket&& other); void readSourceID();