10 #ifndef MSGPACK_V1_TYPE_MAP_HPP 11 #define MSGPACK_V1_TYPE_MAP_HPP 27 template <
typename K,
typename V,
typename Compare,
typename Alloc>
28 class assoc_vector :
public std::vector< std::pair<K, V>, Alloc > {
29 #if !defined(MSGPACK_USE_CPP03) 30 using std::vector<std::pair<K, V>, Alloc>::vector;
31 #endif // !defined(MSGPACK_USE_CPP03) 35 template <
typename K,
typename V,
typename Compare,
typename Alloc>
37 bool operator() (
const std::pair<K, V>& x,
const std::pair<K, V>& y)
const 38 {
return Compare()(x.first, y.first); }
46 #if !defined(MSGPACK_USE_CPP03) 48 template <
typename K,
typename V,
typename Compare,
typename Alloc>
50 type::assoc_vector<K, V, Compare, Alloc>,
51 typename std::enable_if<msgpack::has_as<K>::value && msgpack::has_as<V>::value>::type> {
58 for (; p < pend; ++p) {
59 v.emplace_back(p->
key.
as<K>(), p->
val.
as<V>());
66 #endif // !defined(MSGPACK_USE_CPP03) 68 template <
typename K,
typename V,
typename Compare,
typename Alloc>
69 struct convert<type::assoc_vector<K, V, Compare, Alloc> > {
76 std::pair<K, V>* it(&v.front());
77 for (; p < pend; ++p, ++it) {
87 template <
typename K,
typename V,
typename Compare,
typename Alloc>
88 struct pack<type::assoc_vector<K, V, Compare, Alloc> > {
89 template <
typename Stream>
102 template <
typename K,
typename V,
typename Compare,
typename Alloc>
127 #if !defined(MSGPACK_USE_CPP03) 129 template <
typename K,
typename V,
typename Compare,
typename Alloc>
131 std::map<K, V, Compare, Alloc>,
132 typename std::enable_if<msgpack::has_as<K>::value && msgpack::has_as<V>::value>::type> {
137 std::map<K, V, Compare, Alloc> v;
138 for (; p != pend; ++p) {
145 #endif // !defined(MSGPACK_USE_CPP03) 147 template <
typename K,
typename V,
typename Compare,
typename Alloc>
148 struct convert<std::map<K, V, Compare, Alloc> > {
153 std::map<K, V, Compare, Alloc> tmp;
154 for (; p != pend; ++p) {
157 #if __cplusplus >= 201103L 163 #if __cplusplus >= 201103L 172 template <
typename K,
typename V,
typename Compare,
typename Alloc>
173 struct pack<std::map<K, V, Compare, Alloc> > {
174 template <
typename Stream>
178 for (
typename std::map<K, V, Compare, Alloc>::const_iterator it(v.begin()), it_end(v.end());
179 it != it_end; ++it) {
187 template <
typename K,
typename V,
typename Compare,
typename Alloc>
202 typename std::map<K, V, Compare, Alloc>::const_iterator it(v.begin());
204 #if (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)) && !defined(__clang__) 205 #pragma GCC diagnostic push 206 #pragma GCC diagnostic ignored "-Wmaybe-uninitialized" 207 #endif // (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)) && !defined(__clang__) 210 #if (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)) && !defined(__clang__) 211 #pragma GCC diagnostic pop 212 #endif // (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)) && !defined(__clang__) 220 #if !defined(MSGPACK_USE_CPP03) 222 template <
typename K,
typename V,
typename Compare,
typename Alloc>
224 std::multimap<K, V, Compare, Alloc>,
225 typename std::enable_if<msgpack::has_as<K>::value && msgpack::has_as<V>::value>::type> {
230 std::multimap<K, V, Compare, Alloc> v;
231 for (; p != pend; ++p) {
238 #endif // !defined(MSGPACK_USE_CPP03) 240 template <
typename K,
typename V,
typename Compare,
typename Alloc>
241 struct convert<std::multimap<K, V, Compare, Alloc> > {
246 std::multimap<K, V, Compare, Alloc> tmp;
247 for (; p != pend; ++p) {
248 std::pair<K, V> value;
251 #if __cplusplus >= 201103L 257 #if __cplusplus >= 201103L 266 template <
typename K,
typename V,
typename Compare,
typename Alloc>
267 struct pack<std::multimap<K, V, Compare, Alloc> > {
268 template <
typename Stream>
272 for (
typename std::multimap<K, V, Compare, Alloc>::const_iterator it(v.begin()), it_end(v.end());
273 it != it_end; ++it) {
281 template <
typename K,
typename V,
typename Compare,
typename Alloc>
295 typename std::multimap<K, V, Compare, Alloc>::const_iterator it(v.begin());
314 #endif // MSGPACK_V1_TYPE_MAP_HPP msgpack::object_kv * ptr
Definition: object_fwd.hpp:29
void * allocate_align(size_t size, size_t align=MSGPACK_ZONE_ALIGN)
Definition: cpp03_zone.hpp:236
uint32_t checked_get_container_size(T size)
Definition: check_container_size.hpp:55
msgpack::object const & operator()(msgpack::object const &o, type::assoc_vector< K, V, Compare, Alloc > &v) const
Definition: map.hpp:70
Definition: object_fwd_decl.hpp:60
union_type via
Definition: object_fwd.hpp:92
msgpack::zone & zone
Definition: object.hpp:36
std::multimap< K, V, Compare, Alloc > operator()(msgpack::object const &o) const
Definition: map.hpp:226
msgpack::object val
Definition: object.hpp:31
Definition: adaptor_base.hpp:15
Definition: object.hpp:34
packer< Stream > & pack(const T &v)
Packing function template.
Definition: object.hpp:29
std::enable_if< msgpack::has_as< T >::value, T >::type as() const
Get value as T.
Definition: object.hpp:567
Definition: adaptor_base.hpp:43
Definition: object_fwd.hpp:222
Definition: adaptor_base.hpp:32
void operator()(msgpack::object::with_zone &o, const std::multimap< K, V, Compare, Alloc > &v) const
Definition: map.hpp:283
msgpack::packer< Stream > & operator()(msgpack::packer< Stream > &o, const type::assoc_vector< K, V, Compare, Alloc > &v) const
Definition: map.hpp:90
packer< Stream > & pack_map(uint32_t n)
Packing map header and size.
Definition: pack.hpp:1178
msgpack::object_map map
Definition: object_fwd.hpp:85
T & convert(T &v) const
Convert the object.
Definition: object.hpp:529
Object class that corresponding to MessagePack format object.
Definition: object_fwd.hpp:75
void operator()(msgpack::object::with_zone &o, const type::assoc_vector< K, V, Compare, Alloc > &v) const
Definition: map.hpp:104
type::assoc_vector< K, V, Compare, Alloc > operator()(msgpack::object const &o) const
Definition: map.hpp:52
msgpack::type::object_type type
Definition: object_fwd.hpp:91
void operator()(msgpack::object::with_zone &o, const std::map< K, V, Compare, Alloc > &v) const
Definition: map.hpp:189
#define MSGPACK_API_VERSION_NAMESPACE(ns)
Definition: versioning.hpp:58
msgpack::packer< Stream > & operator()(msgpack::packer< Stream > &o, const std::multimap< K, V, Compare, Alloc > &v) const
Definition: map.hpp:269
msgpack::object key
Definition: object.hpp:30
std::map< K, V, Compare, Alloc > operator()(msgpack::object const &o) const
Definition: map.hpp:133
uint32_t size
Definition: object_fwd.hpp:28
Definition: object_fwd_decl.hpp:40
The class template that supports continuous packing.
Definition: adaptor_base_decl.hpp:23
msgpack::packer< Stream > & operator()(msgpack::packer< Stream > &o, const std::map< K, V, Compare, Alloc > &v) const
Definition: map.hpp:175
msgpack::object const & operator()(msgpack::object const &o, std::map< K, V, Compare, Alloc > &v) const
Definition: map.hpp:149
msgpack::object const & operator()(msgpack::object const &o, std::multimap< K, V, Compare, Alloc > &v) const
Definition: map.hpp:242
Definition: adaptor_base.hpp:27