@@ -712,14 +712,16 @@ struct recv_buffer_size
712712 }
713713};
714714
715- namespace detail
716- {
717-
718715#if defined(ZMQ_HAS_OPTIONAL) && (ZMQ_HAS_OPTIONAL > 0)
716+
719717using send_result_t = std::optional<size_t >;
720718using recv_result_t = std::optional<size_t >;
721719using recv_buffer_result_t = std::optional<recv_buffer_size>;
720+
722721#else
722+
723+ namespace detail
724+ {
723725// A C++11 type emulating the most basic
724726// operations of std::optional for trivial types
725727template <class T > class trivial_optional
@@ -773,12 +775,17 @@ template<class T> class trivial_optional
773775 T _value{};
774776 bool _has_value{false };
775777};
778+ } // namespace detail
779+
780+ using send_result_t = detail::trivial_optional<size_t >;
781+ using recv_result_t = detail::trivial_optional<size_t >;
782+ using recv_buffer_result_t = detail::trivial_optional<recv_buffer_size>;
776783
777- using send_result_t = trivial_optional<size_t >;
778- using recv_result_t = trivial_optional<size_t >;
779- using recv_buffer_result_t = trivial_optional<recv_buffer_size>;
780784#endif
781785
786+ namespace detail
787+ {
788+
782789template <class T >
783790constexpr T enum_bit_or (T a, T b) noexcept
784791{
@@ -1303,7 +1310,7 @@ class socket_base
13031310#endif
13041311
13051312#ifdef ZMQ_CPP11
1306- detail:: send_result_t send (const_buffer buf, send_flags flags = send_flags::none)
1313+ send_result_t send (const_buffer buf, send_flags flags = send_flags::none)
13071314 {
13081315 const int nbytes =
13091316 zmq_send (_handle, buf.data (), buf.size (), static_cast <int >(flags));
@@ -1314,7 +1321,7 @@ class socket_base
13141321 throw error_t ();
13151322 }
13161323
1317- detail:: send_result_t send (message_t &msg, send_flags flags)
1324+ send_result_t send (message_t &msg, send_flags flags)
13181325 {
13191326 int nbytes = zmq_msg_send (msg.handle (), _handle, static_cast <int >(flags));
13201327 if (nbytes >= 0 )
@@ -1324,7 +1331,7 @@ class socket_base
13241331 throw error_t ();
13251332 }
13261333
1327- detail:: send_result_t send (message_t &&msg, send_flags flags)
1334+ send_result_t send (message_t &&msg, send_flags flags)
13281335 {
13291336 return send (msg, flags);
13301337 }
@@ -1357,8 +1364,9 @@ class socket_base
13571364 }
13581365
13591366#ifdef ZMQ_CPP11
1360- ZMQ_NODISCARD detail::recv_buffer_result_t recv (mutable_buffer buf,
1361- recv_flags flags = recv_flags::none)
1367+ ZMQ_NODISCARD
1368+ recv_buffer_result_t recv (mutable_buffer buf,
1369+ recv_flags flags = recv_flags::none)
13621370 {
13631371 const int nbytes =
13641372 zmq_recv (_handle, buf.data (), buf.size (), static_cast <int >(flags));
@@ -1371,7 +1379,8 @@ class socket_base
13711379 throw error_t ();
13721380 }
13731381
1374- ZMQ_NODISCARD detail::recv_result_t recv (message_t &msg, recv_flags flags = recv_flags::none)
1382+ ZMQ_NODISCARD
1383+ recv_result_t recv (message_t &msg, recv_flags flags = recv_flags::none)
13751384 {
13761385 const int nbytes = zmq_msg_recv (msg.handle (), _handle, static_cast <int >(flags));
13771386 if (nbytes >= 0 ) {
0 commit comments