[zeromq-dev] c++ api issues
Martin Sustrik
sustrik at 250bpm.com
Wed Oct 20 13:30:25 CEST 2010
Burak,
> 1) having the copy constructor private prevents zmq::message_t objects
> from being part of a standard containers like std::list. is it possible
> to change this, or should i resort to storing pointers to messages?
>
> i'm in favor of making the message_t copy ctor public. the documentation
> makes it very clear that messages should not be re-used once sent.
>
> // Disable implicit message copying, so that users won't use shared
> // messages (less efficient) without being aware of the fact.
>
> you can prepend the ctor with explicit to prevent implicit calls to the
> ctor.
How would you implement the copy constructor?
> 2) there are const correctness issues. for example,
> zmq::message_t::size() call can safely be marked const like so:
>
> inline size_t size () const
> {
> return zmq_msg_size (this);
> }
Fair enough.
> as for the data() call, i think it should have a version that returns
> const void * like so:
>
> inline const void *const_data () const
> {
> return zmq_msg_data (this);
> }
Good idea.
Martin
More information about the zeromq-dev
mailing list