Make getsockopt() functions const

Make the socket_t::getsockopt() functions (which wrap zmq_getsockopt() ) const because they should only access and not modify socket state.
This commit is contained in:
gdfast 2015-11-19 12:37:07 -05:00
parent bad35bdbfe
commit c1e8ac0f19

View File

@ -497,14 +497,14 @@ namespace zmq
} }
inline void getsockopt (int option_, void *optval_, inline void getsockopt (int option_, void *optval_,
size_t *optvallen_) size_t *optvallen_) const
{ {
int rc = zmq_getsockopt (ptr, option_, optval_, optvallen_); int rc = zmq_getsockopt (ptr, option_, optval_, optvallen_);
if (rc != 0) if (rc != 0)
throw error_t (); throw error_t ();
} }
template<typename T> T getsockopt(int option_) template<typename T> T getsockopt(int option_) const
{ {
T optval; T optval;
size_t optlen = sizeof(T); size_t optlen = sizeof(T);