From: Adrian Bondrescu Date: Thu, 31 May 2012 23:31:31 +0000 (+0300) Subject: Override the assignment operator for the Address class. X-Git-Url: http://p2p-next.cs.pub.ro/gitweb/?a=commitdiff_plain;h=14bddef67019b28f0bf0e0afc95d4f97caafd242;p=swifty.git Override the assignment operator for the Address class. --- diff --git a/src/libswift/swift.h b/src/libswift/swift.h index 2a9f68a..d44b882 100644 --- a/src/libswift/swift.h +++ b/src/libswift/swift.h @@ -134,6 +134,15 @@ namespace swift { } uint32_t ipv4 () const { return ntohl(addr->dests[0].addr); } uint16_t port () const { return ntohs(addr->dests[0].port); } + Address& operator = (const Address& b) { + if (this != &b) { + free(addr); + clear(); + addr->dests[0].addr = b.addr->dests[0].addr; + addr->dests[0].port = b.addr->dests[0].port; + } + return *this; + } bool operator == (const Address& b) const { return addr->count == b.addr->count && addr->dests[0].port==b.addr->dests[0].port &&