Skip to content

Commit 7191a3b

Browse files
author
Martin C Drohmann
committed
enable as<map<...> > implementation when the key OR the value have as()
1 parent b82b58f commit 7191a3b

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

include/msgpack/v1/adaptor/map.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ namespace adaptor {
4848
template <typename K, typename V, typename Compare, typename Alloc>
4949
struct as<
5050
type::assoc_vector<K, V, Compare, Alloc>,
51-
typename std::enable_if<msgpack::has_as<K>::value && msgpack::has_as<V>::value>::type> {
51+
typename std::enable_if<msgpack::has_as<K>::value || msgpack::has_as<V>::value>::type> {
5252
type::assoc_vector<K, V, Compare, Alloc> operator()(msgpack::object const& o) const {
5353
if (o.type != msgpack::type::MAP) { throw msgpack::type_error(); }
5454
type::assoc_vector<K, V, Compare, Alloc> v;
@@ -129,7 +129,7 @@ struct object_with_zone<type::assoc_vector<K, V, Compare, Alloc> > {
129129
template <typename K, typename V, typename Compare, typename Alloc>
130130
struct as<
131131
std::map<K, V, Compare, Alloc>,
132-
typename std::enable_if<msgpack::has_as<K>::value && msgpack::has_as<V>::value>::type> {
132+
typename std::enable_if<msgpack::has_as<K>::value || msgpack::has_as<V>::value>::type> {
133133
std::map<K, V, Compare, Alloc> operator()(msgpack::object const& o) const {
134134
if (o.type != msgpack::type::MAP) { throw msgpack::type_error(); }
135135
msgpack::object_kv* p(o.via.map.ptr);
@@ -222,7 +222,7 @@ struct object_with_zone<std::map<K, V, Compare, Alloc> > {
222222
template <typename K, typename V, typename Compare, typename Alloc>
223223
struct as<
224224
std::multimap<K, V, Compare, Alloc>,
225-
typename std::enable_if<msgpack::has_as<K>::value && msgpack::has_as<V>::value>::type> {
225+
typename std::enable_if<msgpack::has_as<K>::value || msgpack::has_as<V>::value>::type> {
226226
std::multimap<K, V, Compare, Alloc> operator()(msgpack::object const& o) const {
227227
if (o.type != msgpack::type::MAP) { throw msgpack::type_error(); }
228228
msgpack::object_kv* p(o.via.map.ptr);

0 commit comments

Comments
 (0)