mirror of
https://github.com/zeromq/cppzmq.git
synced 2025-03-01 10:57:59 +01:00
Merge pull request #3 from ricnewton/message_move_constructor
Add move constructor to message_t
This commit is contained in:
commit
f957e25a3f
15
zmq.hpp
15
zmq.hpp
@ -123,6 +123,21 @@ namespace zmq
|
||||
throw error_t ();
|
||||
}
|
||||
|
||||
#ifdef ZMQ_HAS_RVALUE_REFS
|
||||
inline message_t (message_t &&rhs) : msg (rhs.msg)
|
||||
{
|
||||
int rc = zmq_msg_init (&rhs.msg);
|
||||
if (rc != 0)
|
||||
throw error_t ();
|
||||
}
|
||||
|
||||
inline message_t &operator = (message_t &&rhs)
|
||||
{
|
||||
std::swap (msg, rhs.msg);
|
||||
return *this;
|
||||
}
|
||||
#endif
|
||||
|
||||
inline ~message_t ()
|
||||
{
|
||||
int rc = zmq_msg_close (&msg);
|
||||
|
Loading…
x
Reference in New Issue
Block a user