From 952c38257523653ec43fe3838d9bf6f2f8b5d057 Mon Sep 17 00:00:00 2001
From: Richard Newton <richard_newton@waters.com>
Date: Wed, 25 Jul 2012 12:06:53 +0100
Subject: [PATCH] Add move constructor to message_t

Add move constructor and assignment operator to message_t (but only if compiler supports it).
---
 zmq.hpp |   15 +++++++++++++++
 1 files changed, 15 insertions(+), 0 deletions(-)

diff --git a/zmq.hpp b/zmq.hpp
index 041abb2..1b7c8a6 100644
--- a/zmq.hpp
+++ b/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);
-- 
1.7.9

