mirror of
https://github.com/zeromq/cppzmq.git
synced 2025-05-02 15:41:40 +02: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 ();
|
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 ()
|
inline ~message_t ()
|
||||||
{
|
{
|
||||||
int rc = zmq_msg_close (&msg);
|
int rc = zmq_msg_close (&msg);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user