Skip to content

Commit 722143c

Browse files
committed
Merge pull request #345 from redboltz/added_has_as_to_pair
Added has_as SFINAE.
2 parents 57b030a + 062864a commit 722143c

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

include/msgpack/adaptor/pair.hpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@
2020

2121
#include "msgpack/versioning.hpp"
2222
#include "msgpack/adaptor/adaptor_base.hpp"
23+
#include "msgpack/meta.hpp"
24+
2325
#include <utility>
2426

2527
namespace msgpack {
@@ -33,7 +35,8 @@ namespace adaptor {
3335
#if !defined(MSGPACK_USE_CPP03)
3436

3537
template <typename T1, typename T2>
36-
struct as<std::pair<T1, T2>> {
38+
struct as<std::pair<T1, T2>,
39+
typename std::enable_if<msgpack::all_of<msgpack::has_as, T1, T2>::value>::type> {
3740
std::pair<T1, T2> operator()(msgpack::object const& o) const {
3841
if (o.type != msgpack::type::ARRAY) { throw msgpack::type_error(); }
3942
if (o.via.array.size != 2) { throw msgpack::type_error(); }

0 commit comments

Comments
 (0)