mirror of
https://github.com/msgpack/msgpack-c.git
synced 2025-10-24 09:12:30 +02:00
Use OR instead of AND for all classes that have multiple types.
Revert example. Combination of has_as and not has_as are move to tests.
This commit is contained in:
@@ -109,7 +109,7 @@ struct StdTupleConverter<Tuple, 0> {
|
||||
namespace adaptor {
|
||||
|
||||
template <typename... Args>
|
||||
struct as<std::tuple<Args...>, typename std::enable_if<msgpack::all_of<msgpack::has_as, Args...>::value>::type> {
|
||||
struct as<std::tuple<Args...>, typename std::enable_if<msgpack::any_of<msgpack::has_as, Args...>::value>::type> {
|
||||
std::tuple<Args...> operator()(
|
||||
msgpack::object const& o) const {
|
||||
if (o.type != msgpack::type::ARRAY) { throw msgpack::type_error(); }
|
||||
|
||||
@@ -27,7 +27,7 @@ namespace adaptor {
|
||||
template <typename K, typename V, typename Hash, typename Compare, typename Alloc>
|
||||
struct as<
|
||||
std::unordered_map<K, V, Hash, 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::unordered_map<K, V, Hash, 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);
|
||||
@@ -100,7 +100,7 @@ struct object_with_zone<std::unordered_map<K, V, Hash, Compare, Alloc>> {
|
||||
template <typename K, typename V, typename Hash, typename Compare, typename Alloc>
|
||||
struct as<
|
||||
std::unordered_multimap<K, V, Hash, 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::unordered_multimap<K, V, Hash, 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);
|
||||
|
||||
Reference in New Issue
Block a user