mirror of
https://github.com/msgpack/msgpack-c.git
synced 2025-06-21 04:32:34 +02:00
enable as<map<...> > implementation when the key OR the value have as()
This commit is contained in:
parent
b82b58f184
commit
7191a3b014
@ -48,7 +48,7 @@ namespace adaptor {
|
||||
template <typename K, typename V, typename Compare, typename Alloc>
|
||||
struct as<
|
||||
type::assoc_vector<K, V, Compare, Alloc>,
|
||||
typename std::enable_if<msgpack::has_as<K>::value && msgpack::has_as<V>::value>::type> {
|
||||
typename std::enable_if<msgpack::has_as<K>::value || msgpack::has_as<V>::value>::type> {
|
||||
type::assoc_vector<K, V, Compare, Alloc> operator()(msgpack::object const& o) const {
|
||||
if (o.type != msgpack::type::MAP) { throw msgpack::type_error(); }
|
||||
type::assoc_vector<K, V, Compare, Alloc> v;
|
||||
@ -129,7 +129,7 @@ struct object_with_zone<type::assoc_vector<K, V, Compare, Alloc> > {
|
||||
template <typename K, typename V, typename Compare, typename Alloc>
|
||||
struct as<
|
||||
std::map<K, V, Compare, Alloc>,
|
||||
typename std::enable_if<msgpack::has_as<K>::value && msgpack::has_as<V>::value>::type> {
|
||||
typename std::enable_if<msgpack::has_as<K>::value || msgpack::has_as<V>::value>::type> {
|
||||
std::map<K, V, Compare, Alloc> operator()(msgpack::object const& o) const {
|
||||
if (o.type != msgpack::type::MAP) { throw msgpack::type_error(); }
|
||||
msgpack::object_kv* p(o.via.map.ptr);
|
||||
@ -222,7 +222,7 @@ struct object_with_zone<std::map<K, V, Compare, Alloc> > {
|
||||
template <typename K, typename V, typename Compare, typename Alloc>
|
||||
struct as<
|
||||
std::multimap<K, V, Compare, Alloc>,
|
||||
typename std::enable_if<msgpack::has_as<K>::value && msgpack::has_as<V>::value>::type> {
|
||||
typename std::enable_if<msgpack::has_as<K>::value || msgpack::has_as<V>::value>::type> {
|
||||
std::multimap<K, V, Compare, Alloc> operator()(msgpack::object const& o) const {
|
||||
if (o.type != msgpack::type::MAP) { throw msgpack::type_error(); }
|
||||
msgpack::object_kv* p(o.via.map.ptr);
|
||||
|
Loading…
x
Reference in New Issue
Block a user