diff options
Diffstat (limited to 'libtransport/includes/hicn/transport/core/endpoint.h')
-rw-r--r-- | libtransport/includes/hicn/transport/core/endpoint.h | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/libtransport/includes/hicn/transport/core/endpoint.h b/libtransport/includes/hicn/transport/core/endpoint.h index cb6b0f562..2278a1759 100644 --- a/libtransport/includes/hicn/transport/core/endpoint.h +++ b/libtransport/includes/hicn/transport/core/endpoint.h @@ -42,22 +42,28 @@ class Endpoint { ~Endpoint() = default; Endpoint &operator=(const Endpoint &other) { - address_ = other.address_; - port_ = other.port_; + if (this != &other) { + address_ = other.address_; + port_ = other.port_; + } + return *this; } Endpoint &operator=(Endpoint &&other) { - address_ = std::move(other.address_); - port_ = std::move(other.port_); + if (this != &other) { + address_ = std::move(other.address_); + port_ = std::move(other.port_); + } + return *this; } #if 0 template <typename Ip, typename Port> Endpoint(Ip &&ip_address, Port &&port) - : address_(std::forward<Ip &&>(ip_address)), - port_(std::forward<Port &&>(port)) {} + : address_(std::forward<Ip>(ip_address)), + port_(std::forward<Port>(port)) {} #endif asio::ip::address getAddress() { return address_; } |