[zeromq-dev] c++ api issues
Burak Arslan
burak.arslan at arskom.com.tr
Wed Oct 20 13:05:57 CEST 2010
hi,
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.
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);
}
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);
}
what do you think?
best regards,
burak
More information about the zeromq-dev
mailing list