10 #ifndef MSGPACK_TYPE_TR1_UNORDERED_MAP_HPP
11 #define MSGPACK_TYPE_TR1_UNORDERED_MAP_HPP
17 #if defined(_LIBCPP_VERSION) || (_MSC_VER >= 1700)
19 #define MSGPACK_HAS_STD_UNORDERED_MAP
20 #include <unordered_map>
21 #define MSGPACK_STD_TR1 std
23 #else // defined(_LIBCPP_VERSION) || (_MSC_VER >= 1700)
27 #define MSGPACK_HAS_STD_TR1_UNORDERED_MAP
29 #include <tr1/unordered_map>
30 #define MSGPACK_STD_TR1 std::tr1
32 #endif // __GNUC__ >= 4
34 #endif // defined(_LIBCPP_VERSION) || (_MSC_VER >= 1700)
36 #if defined(MSGPACK_STD_TR1)
46 template <
typename K,
typename V,
typename Hash,
typename Pred,
typename Alloc>
47 struct convert<MSGPACK_STD_TR1::unordered_map<K, V, Hash, Pred, Alloc> > {
52 MSGPACK_STD_TR1::unordered_map<K, V, Hash, Pred, Alloc> tmp;
53 for(; p != pend; ++p) {
56 p->val.convert(tmp[key]);
63 template <
typename K,
typename V,
typename Hash,
typename Pred,
typename Alloc>
64 struct pack<MSGPACK_STD_TR1::unordered_map<K, V, Hash, Pred, Alloc> > {
65 template <
typename Stream>
69 for(
typename MSGPACK_STD_TR1::unordered_map<K, V, Hash, Pred, Alloc>::const_iterator it(v.begin()), it_end(v.end());
78 template <
typename K,
typename V,
typename Hash,
typename Pred,
typename Alloc>
79 struct object_with_zone<MSGPACK_STD_TR1::unordered_map<K, V, Hash, Pred, Alloc> > {
91 typename MSGPACK_STD_TR1::unordered_map<K, V, Hash, Pred, Alloc>::const_iterator it(v.begin());
102 template <
typename K,
typename V,
typename Hash,
typename Pred,
typename Alloc>
103 struct convert<MSGPACK_STD_TR1::unordered_multimap<K, V, Hash, Pred, Alloc> > {
108 MSGPACK_STD_TR1::unordered_multimap<K, V, Hash, Pred, Alloc> tmp;
109 for(; p != pend; ++p) {
110 std::pair<K, V> value;
120 template <
typename K,
typename V,
typename Hash,
typename Pred,
typename Alloc>
121 struct pack<MSGPACK_STD_TR1::unordered_multimap<K, V, Hash, Pred, Alloc> > {
122 template <
typename Stream>
126 for(
typename MSGPACK_STD_TR1::unordered_multimap<K, V, Hash, Pred, Alloc>::const_iterator it(v.begin()), it_end(v.end());
127 it != it_end; ++it) {
135 template <
typename K,
typename V,
typename Hash,
typename Pred,
typename Alloc>
136 struct object_with_zone<MSGPACK_STD_TR1::unordered_multimap<K, V, Hash, Pred, Alloc> > {
148 typename MSGPACK_STD_TR1::unordered_multimap<K, V, Hash, Pred, Alloc>::const_iterator it(v.begin());
167 #undef MSGPACK_STD_TR1
169 #endif // MSGPACK_STD_TR1
171 #endif // MSGPACK_TYPE_TR1_UNORDERED_MAP_HPP