Skip to content

Commit 8b348cc

Browse files
committed
Update poller_t::wait to return std::optional since the trivial optional implementation can only handle trivial types
1 parent c615553 commit 8b348cc

1 file changed

Lines changed: 4 additions & 7 deletions

File tree

zmq.hpp

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2698,11 +2698,6 @@ template<typename T = no_user_data> class poller_t
26982698
{
26992699
public:
27002700
using event_type = poller_event<T>;
2701-
#if CPPZMQ_HAS_OPTIONAL
2702-
using wait_result_t = std::optional<event_type>;
2703-
#else
2704-
using wait_result_t = detail::trivial_optional<event_type>;
2705-
#endif
27062701

27072702
poller_t() : poller_ptr(zmq_poller_new())
27082703
{
@@ -2767,8 +2762,9 @@ template<typename T = no_user_data> class poller_t
27672762
}
27682763
}
27692764

2770-
wait_result_t wait(std::chrono::milliseconds timeout = std::chrono::milliseconds{
2771-
-1})
2765+
#if CPPZMQ_HAS_OPTIONAL
2766+
std::optional<event_type>
2767+
wait(std::chrono::milliseconds timeout = std::chrono::milliseconds{-1})
27722768
{
27732769
event_type event;
27742770
int rc = zmq_poller_wait(poller_ptr.get(),
@@ -2782,6 +2778,7 @@ template<typename T = no_user_data> class poller_t
27822778
}
27832779
return event;
27842780
}
2781+
#endif
27852782

27862783
template<typename Sequence>
27872784
size_t wait_all(Sequence &poller_events, const std::chrono::milliseconds timeout)

0 commit comments

Comments
 (0)