Copy _type in assignment operators

This commit is contained in:
Atlante45 2015-07-09 14:20:04 -07:00
parent a2a60f253c
commit aaafa7acd2

View file

@ -68,6 +68,8 @@ Packet::Packet(const Packet& other) {
}
Packet& Packet::operator=(const Packet& other) {
_type = other._type;
_packetSize = other._packetSize;
_packet = std::unique_ptr<char>(new char(_packetSize));
memcpy(_packet.get(), other._packet.get(), _packetSize);
@ -85,6 +87,8 @@ Packet::Packet(Packet&& other) {
}
Packet& Packet::operator=(Packet&& other) {
_type = other._type;
_packetSize = other._packetSize;
_packet = std::move(other._packet);