@@ -712,14 +712,16 @@ struct recv_buffer_size
712
712
}
713
713
};
714
714
715
- namespace detail
716
- {
717
-
718
715
#if defined(ZMQ_HAS_OPTIONAL) && (ZMQ_HAS_OPTIONAL > 0)
716
+
719
717
using send_result_t = std::optional<size_t >;
720
718
using recv_result_t = std::optional<size_t >;
721
719
using recv_buffer_result_t = std::optional<recv_buffer_size>;
720
+
722
721
#else
722
+
723
+ namespace detail
724
+ {
723
725
// A C++11 type emulating the most basic
724
726
// operations of std::optional for trivial types
725
727
template <class T > class trivial_optional
@@ -773,12 +775,17 @@ template<class T> class trivial_optional
773
775
T _value{};
774
776
bool _has_value{false };
775
777
};
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>;
776
783
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>;
780
784
#endif
781
785
786
+ namespace detail
787
+ {
788
+
782
789
template <class T >
783
790
constexpr T enum_bit_or (T a, T b) noexcept
784
791
{
@@ -1303,7 +1310,7 @@ class socket_base
1303
1310
#endif
1304
1311
1305
1312
#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)
1307
1314
{
1308
1315
const int nbytes =
1309
1316
zmq_send (_handle, buf.data (), buf.size (), static_cast <int >(flags));
@@ -1314,7 +1321,7 @@ class socket_base
1314
1321
throw error_t ();
1315
1322
}
1316
1323
1317
- detail:: send_result_t send (message_t &msg, send_flags flags)
1324
+ send_result_t send (message_t &msg, send_flags flags)
1318
1325
{
1319
1326
int nbytes = zmq_msg_send (msg.handle (), _handle, static_cast <int >(flags));
1320
1327
if (nbytes >= 0 )
@@ -1324,7 +1331,7 @@ class socket_base
1324
1331
throw error_t ();
1325
1332
}
1326
1333
1327
- detail:: send_result_t send (message_t &&msg, send_flags flags)
1334
+ send_result_t send (message_t &&msg, send_flags flags)
1328
1335
{
1329
1336
return send (msg, flags);
1330
1337
}
@@ -1357,8 +1364,9 @@ class socket_base
1357
1364
}
1358
1365
1359
1366
#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)
1362
1370
{
1363
1371
const int nbytes =
1364
1372
zmq_recv (_handle, buf.data (), buf.size (), static_cast <int >(flags));
@@ -1371,7 +1379,8 @@ class socket_base
1371
1379
throw error_t ();
1372
1380
}
1373
1381
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)
1375
1384
{
1376
1385
const int nbytes = zmq_msg_recv (msg.handle (), _handle, static_cast <int >(flags));
1377
1386
if (nbytes >= 0 ) {
0 commit comments