Open jasujm opened 2 years ago
Yes it looks like we overlook that case. It would be easy to add a new socket_type case to the sockopt enum that would return socket_type on get.
That sounds good :). I created a PR which would do that: https://github.com/zeromq/cppzmq/pull/523
The new
sock.get(zmq::sockopt::option)
API does a good job in retrieving socket options in a typesafe manner, and is definitely an improvement over the oldsock.getsockopt()
API.But I think that
sock.get(zmq::sockopt::type)
in particular works illogically. Currently, this won't compile:Would it make more sense that in C++11 and above
sock.get(zmq::sockopt::type)
would return enumerator fromzmq::socket_type
instead of anint
?int
is neither typesafe nor used to represent socket types elsewhere in the library. This change would break backward compatibility slightly, but in a way that I'm sure any user ofzmq::sockopt::type
would accept.What do you think?