mirror of
https://github.com/zeromq/cppzmq.git
synced 2024-12-12 10:33:52 +01:00
Merge pull request #323 from gummif/gfa/msg-iter-ctor
Problem: message_t ctor for iterators double initializes the message
This commit is contained in:
commit
7f9da8d49b
7
zmq.hpp
7
zmq.hpp
@ -250,12 +250,13 @@ class message_t
|
||||
throw error_t();
|
||||
}
|
||||
|
||||
template<typename T> message_t(T first, T last) : msg()
|
||||
template<class ForwardIter> message_t(ForwardIter first, ForwardIter last)
|
||||
{
|
||||
typedef typename std::iterator_traits<T>::value_type value_t;
|
||||
typedef typename std::iterator_traits<ForwardIter>::value_type value_t;
|
||||
|
||||
assert(std::distance(first, last) >= 0);
|
||||
size_t const size_ = static_cast<size_t>(std::distance(first, last)) * sizeof(value_t);
|
||||
size_t const size_ =
|
||||
static_cast<size_t>(std::distance(first, last)) * sizeof(value_t);
|
||||
int const rc = zmq_msg_init_size(&msg, size_);
|
||||
if (rc != 0)
|
||||
throw error_t();
|
||||
|
Loading…
Reference in New Issue
Block a user