mirror of
https://github.com/zeromq/cppzmq.git
synced 2025-05-20 13:05:34 +02:00
Merge pull request #371 from gummif/gfa/move-ctors
Problem: Move assigned objects still alive
This commit is contained in:
commit
0f8601c9eb
2
zmq.hpp
2
zmq.hpp
@ -644,6 +644,7 @@ class context_t
|
|||||||
context_t(context_t &&rhs) ZMQ_NOTHROW : ptr(rhs.ptr) { rhs.ptr = ZMQ_NULLPTR; }
|
context_t(context_t &&rhs) ZMQ_NOTHROW : ptr(rhs.ptr) { rhs.ptr = ZMQ_NULLPTR; }
|
||||||
context_t &operator=(context_t &&rhs) ZMQ_NOTHROW
|
context_t &operator=(context_t &&rhs) ZMQ_NOTHROW
|
||||||
{
|
{
|
||||||
|
close();
|
||||||
std::swap(ptr, rhs.ptr);
|
std::swap(ptr, rhs.ptr);
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
@ -1566,6 +1567,7 @@ class socket_t : public detail::socket_base
|
|||||||
}
|
}
|
||||||
socket_t &operator=(socket_t &&rhs) ZMQ_NOTHROW
|
socket_t &operator=(socket_t &&rhs) ZMQ_NOTHROW
|
||||||
{
|
{
|
||||||
|
close();
|
||||||
std::swap(_handle, rhs._handle);
|
std::swap(_handle, rhs._handle);
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user