From 85b3a945d4332d9e84411b29d5bef2518d1791fc Mon Sep 17 00:00:00 2001 From: Gudmundur Adalsteinsson Date: Wed, 14 Aug 2019 20:42:36 +0000 Subject: [PATCH] Problem: Warnings about send being deprecated Solution: Refactoring and addition deprecation of a send function taking int flags --- zmq.hpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/zmq.hpp b/zmq.hpp index 58c688f..ead9ce0 100644 --- a/zmq.hpp +++ b/zmq.hpp @@ -1146,10 +1146,19 @@ public: throw error_t(); } - template bool send(T first, T last, int flags_ = 0) + template +#ifdef ZMQ_CPP11 + ZMQ_DEPRECATED("from 4.4.1, use send taking message_t or buffer (for contiguous ranges), and send_flags") +#endif + bool send(T first, T last, int flags_ = 0) { zmq::message_t msg(first, last); - return send(msg, flags_); + int nbytes = zmq_msg_send(msg.handle(), _handle, flags_); + if (nbytes >= 0) + return true; + if (zmq_errno() == EAGAIN) + return false; + throw error_t(); } #ifdef ZMQ_HAS_RVALUE_REFS