mirror of
https://github.com/zeromq/cppzmq.git
synced 2025-10-16 18:56:56 +02:00
Problem: sock.get(zmq::sockopt::type)
is not typesafe
Solution: Add `zmq::sockopt::socket_type` that is used to `get()` an enumerator from `zmq::socket_type` instead of plain `int`. It makes code like this compile: #include <zmq.hpp> #include <cassert> int main() { zmq::context_t ctx; zmq::socket_t sock(ctx, zmq::socket_type::push); assert(sock.get(zmq::sockopt::socket_type) == zmq::socket_type::push); return 0; }
This commit is contained in:
@@ -406,7 +406,10 @@ TEST_CASE("socket check integral options", "[socket]")
|
||||
#endif
|
||||
#ifdef ZMQ_TYPE
|
||||
check_integral_opt_get<int>(zmq::sockopt::type, router, "type");
|
||||
#endif
|
||||
#ifdef ZMQ_CPP11
|
||||
check_integral_opt_get<zmq::socket_type>(zmq::sockopt::socket_type, router, "socket_type");
|
||||
#endif // ZMQ_CPP11
|
||||
#endif // ZMQ_TYPE
|
||||
|
||||
#ifdef ZMQ_HAVE_VMCI
|
||||
#ifdef ZMQ_VMCI_BUFFER_SIZE
|
||||
|
Reference in New Issue
Block a user