Skip to content

Commit 67b2166

Browse files
committed
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.
1 parent f141cf5 commit 67b2166

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

zmq.hpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -441,6 +441,13 @@ namespace zmq
441441
throw error_t ();
442442
}
443443

444+
#ifdef ZMQ_HAS_RVALUE_REFS
445+
inline bool send (message_t &&msg_, int flags_ = 0)
446+
{
447+
return send(msg_, flags_);
448+
}
449+
#endif
450+
444451
inline size_t recv (void *buf_, size_t len_, int flags_ = 0)
445452
{
446453
int nbytes = zmq_recv (ptr, buf_, len_, flags_);

0 commit comments

Comments
 (0)