3 #ifndef __ZMQ_BLOB_HPP_INCLUDED__
4 #define __ZMQ_BLOB_HPP_INCLUDED__
14 #if __cplusplus >= 201103L || defined(_MSC_VER) && _MSC_VER > 1700
15 #define ZMQ_HAS_MOVE_SEMANTICS
16 #define ZMQ_MAP_INSERT_OR_EMPLACE(k, v) emplace (k, v)
17 #define ZMQ_PUSH_OR_EMPLACE_BACK emplace_back
18 #define ZMQ_MOVE(x) std::move (x)
20 #if defined __SUNPRO_CC
21 template <
typename K,
typename V>
22 std::pair<const K, V> make_pair_fix_const (
const K &k,
const V &
v)
24 return std::pair<const K, V> (k,
v);
27 #define ZMQ_MAP_INSERT_OR_EMPLACE(k, v) insert (make_pair_fix_const (k, v))
29 #define ZMQ_MAP_INSERT_OR_EMPLACE(k, v) insert (std::make_pair (k, v))
32 #define ZMQ_PUSH_OR_EMPLACE_BACK push_back
33 #define ZMQ_MOVE(x) (x)
52 explicit blob_t (
const size_t size_) :
53 _data (static_cast<unsigned char *> (malloc (size_))),
62 blob_t (
const unsigned char *
const data_,
const size_t size_) :
63 _data (static_cast<unsigned char *> (malloc (size_))),
86 const unsigned char *
data ()
const {
return _data; }
96 return cmpres < 0 || (cmpres == 0 &&
_size < other_.
_size);
103 _data =
static_cast<unsigned char *
> (malloc (other_.
_size));
113 void set (
const unsigned char *
const data_,
const size_t size_)
116 _data =
static_cast<unsigned char *
> (malloc (size_));
120 if (size_ &&
_data) {
142 #ifdef ZMQ_HAS_MOVE_SEMANTICS
147 _size (other_._size),
150 other_._owned =
false;
154 if (
this != &other_) {
156 _data = other_._data;
157 _size = other_._size;
159 other_._owned =
false;
170 if (
this != &other) {