1
0
mirror of https://github.com/mfontanini/libtins synced 2026-01-23 02:35:57 +01:00

Added move constructor/assignment operator to PDU.

This commit is contained in:
Matias Fontanini
2013-04-10 18:43:24 -03:00
parent ae1e1c2ce2
commit fee938b46d
2 changed files with 34 additions and 2 deletions

View File

@@ -38,6 +38,19 @@ PDU::PDU(PDU *next_pdu) : _inner_pdu(next_pdu) {
}
#if TINS_IS_CXX11
PDU::PDU(PDU &&rhs)
: _inner_pdu(0)
{
std::swap(_inner_pdu, rhs._inner_pdu);
}
PDU& PDU::operator=(PDU &&rhs) {
std::swap(_inner_pdu, rhs._inner_pdu);
return *this;
}
#endif
PDU::PDU(const PDU &other) : _inner_pdu(0) {
copy_inner_pdu(other);
}