mirror of
https://github.com/zeromq/cppzmq.git
synced 2025-05-02 15:41:40 +02:00
Add const data access to message_t
Add a const version of data() and make size() const so we can pass messages around by const refeference when we only need read-only data access.
This commit is contained in:
parent
f1640d2c9d
commit
2efcdccace
9
zmq.hpp
9
zmq.hpp
@ -179,9 +179,14 @@ namespace zmq
|
|||||||
return zmq_msg_data (&msg);
|
return zmq_msg_data (&msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline size_t size ()
|
inline const void* data () const
|
||||||
{
|
{
|
||||||
return zmq_msg_size (&msg);
|
return zmq_msg_data (const_cast<zmq_msg_t*>(&msg));
|
||||||
|
}
|
||||||
|
|
||||||
|
inline size_t size () const
|
||||||
|
{
|
||||||
|
return zmq_msg_size (const_cast<zmq_msg_t*>(&msg));
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user