mirror of
https://github.com/zeromq/cppzmq.git
synced 2025-04-28 02:33:32 +02:00
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:
parent
bad35bdbfe
commit
c1e8ac0f19
4
zmq.hpp
4
zmq.hpp
@ -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);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user