mirror of
https://github.com/msgpack/msgpack-c.git
synced 2025-10-17 03:03:24 +02:00
Merge pull request #345 from redboltz/added_has_as_to_pair
Added has_as SFINAE.
This commit is contained in:
@@ -20,6 +20,8 @@
|
||||
|
||||
#include "msgpack/versioning.hpp"
|
||||
#include "msgpack/adaptor/adaptor_base.hpp"
|
||||
#include "msgpack/meta.hpp"
|
||||
|
||||
#include <utility>
|
||||
|
||||
namespace msgpack {
|
||||
@@ -33,7 +35,8 @@ namespace adaptor {
|
||||
#if !defined(MSGPACK_USE_CPP03)
|
||||
|
||||
template <typename T1, typename T2>
|
||||
struct as<std::pair<T1, T2>> {
|
||||
struct as<std::pair<T1, T2>,
|
||||
typename std::enable_if<msgpack::all_of<msgpack::has_as, T1, T2>::value>::type> {
|
||||
std::pair<T1, T2> operator()(msgpack::object const& o) const {
|
||||
if (o.type != msgpack::type::ARRAY) { throw msgpack::type_error(); }
|
||||
if (o.via.array.size != 2) { throw msgpack::type_error(); }
|
||||
|
Reference in New Issue
Block a user