mirror of
https://github.com/zeromq/cppzmq.git
synced 2025-04-27 18:30:54 +02:00
Merge pull request #313 from gummif/gfa/socket-ctor
Problem: socket_t can not be default constructed
This commit is contained in:
commit
961bb4fb46
@ -9,6 +9,11 @@ static_assert(std::is_nothrow_swappable<zmq::socket_t>::value,
|
|||||||
"socket_t should be nothrow swappable");
|
"socket_t should be nothrow swappable");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
TEST_CASE("socket default ctor", "[socket]")
|
||||||
|
{
|
||||||
|
zmq::socket_t socket;
|
||||||
|
}
|
||||||
|
|
||||||
TEST_CASE("socket create destroy", "[socket]")
|
TEST_CASE("socket create destroy", "[socket]")
|
||||||
{
|
{
|
||||||
zmq::context_t context;
|
zmq::context_t context;
|
||||||
@ -16,6 +21,15 @@ TEST_CASE("socket create destroy", "[socket]")
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef ZMQ_CPP11
|
#ifdef ZMQ_CPP11
|
||||||
|
TEST_CASE("socket create assign", "[socket]")
|
||||||
|
{
|
||||||
|
zmq::context_t context;
|
||||||
|
zmq::socket_t socket(context, ZMQ_ROUTER);
|
||||||
|
CHECK(static_cast<void*>(socket));
|
||||||
|
socket = {};
|
||||||
|
CHECK(!static_cast<void*>(socket));
|
||||||
|
}
|
||||||
|
|
||||||
TEST_CASE("socket create by enum and destroy", "[socket]")
|
TEST_CASE("socket create by enum and destroy", "[socket]")
|
||||||
{
|
{
|
||||||
zmq::context_t context;
|
zmq::context_t context;
|
||||||
|
6
zmq.hpp
6
zmq.hpp
@ -646,6 +646,12 @@ class socket_t
|
|||||||
friend class monitor_t;
|
friend class monitor_t;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
socket_t() ZMQ_NOTHROW
|
||||||
|
: ptr(ZMQ_NULLPTR)
|
||||||
|
, ctxptr(ZMQ_NULLPTR)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
socket_t(context_t &context_, int type_)
|
socket_t(context_t &context_, int type_)
|
||||||
: ptr(zmq_socket(static_cast<void*>(context_), type_))
|
: ptr(zmq_socket(static_cast<void*>(context_), type_))
|
||||||
, ctxptr(static_cast<void*>(context_))
|
, ctxptr(static_cast<void*>(context_))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user