Merge pull request #3 from ricnewton/message_move_constructor

Add move constructor to message_t
This commit is contained in:
Ian Barber 2012-07-31 09:32:53 -07:00
commit f957e25a3f

15
zmq.hpp
View File

@ -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);