From 67b216681dd4dbc151c3efdc2ce729c0a2d56e26 Mon Sep 17 00:00:00 2001 From: Todd Neal Date: Thu, 5 Mar 2015 11:15:08 -0600 Subject: [PATCH] Add an rvalue overload for socket_t::send This lets you create functions that return message_t's by value, and pass them to send() with no copy. --- zmq.hpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/zmq.hpp b/zmq.hpp index 3337429..eb5416e 100644 --- a/zmq.hpp +++ b/zmq.hpp @@ -441,6 +441,13 @@ namespace zmq throw error_t (); } +#ifdef ZMQ_HAS_RVALUE_REFS + inline bool send (message_t &&msg_, int flags_ = 0) + { + return send(msg_, flags_); + } +#endif + inline size_t recv (void *buf_, size_t len_, int flags_ = 0) { int nbytes = zmq_recv (ptr, buf_, len_, flags_);