mirror of
https://github.com/zeromq/cppzmq.git
synced 2025-01-19 08:46:45 +01:00
Add move constructor to message_t
Add move constructor and assignment operator to message_t (but only if compiler supports it).
This commit is contained in:
parent
f1640d2c9d
commit
952c382575
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