From 18b5870caacf4d7b49ce8809fcc43c44277d6092 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Harald=20N=C3=B8kland?= Date: Thu, 3 Dec 2015 08:23:39 +0100 Subject: [PATCH] Fix warning 4996 in msvc debug build When making a debug build with msvc, the range constructor of message_t caused warning 4996: 'std::_Copy_impl': Function call with parameters that may be unsafe. It is actually safe to do what's done in the constructor, so the workaround is to mimic what std::copy does, whitout the range check. --- zmq.hpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/zmq.hpp b/zmq.hpp index 42d85da..f514b54 100644 --- a/zmq.hpp +++ b/zmq.hpp @@ -219,7 +219,12 @@ namespace zmq int const rc = zmq_msg_init_size (&msg, size_); if (rc != 0) throw error_t (); - std::copy(first, last, static_cast(zmq_msg_data (&msg)) ); + value_t* dest = data(); + while (first != last) + { + *dest = *first; + ++dest; ++first; + } } inline message_t (void *data_, size_t size_, free_fn *ffn_,