mirror of
https://github.com/zeromq/cppzmq.git
synced 2024-12-12 10:33:52 +01:00
Problem: poller's constructor is not default
Solution: Constructor logic moved to the same place where cleanup is and marking constructor `default`. Init/cleanup code is in one pleace making it easier to read/maintain.
This commit is contained in:
parent
2aba0bb3ac
commit
c03fb35173
14
zmq.hpp
14
zmq.hpp
@ -1018,12 +1018,7 @@ namespace zmq
|
||||
class poller_t
|
||||
{
|
||||
public:
|
||||
poller_t ()
|
||||
{
|
||||
if (!poller_ptr)
|
||||
throw error_t ();
|
||||
}
|
||||
|
||||
poller_t () = default;
|
||||
~poller_t () = default;
|
||||
|
||||
poller_t(const poller_t&) = delete;
|
||||
@ -1112,7 +1107,12 @@ namespace zmq
|
||||
private:
|
||||
std::unique_ptr<void, std::function<void(void*)>> poller_ptr
|
||||
{
|
||||
zmq_poller_new (),
|
||||
[]() {
|
||||
auto poller_new = zmq_poller_new ();
|
||||
if (poller_new)
|
||||
return poller_new;
|
||||
throw error_t ();
|
||||
}(),
|
||||
[](void *ptr) {
|
||||
int rc = zmq_poller_destroy (&ptr);
|
||||
ZMQ_ASSERT (rc == 0);
|
||||
|
Loading…
Reference in New Issue
Block a user