mirror of
https://github.com/msgpack/msgpack-c.git
synced 2025-03-29 10:59:29 +01:00
Fixed a compile error caused by MSGPACK_ADD_ENUM with msgpack::packer
This commit is contained in:
parent
85b5e1088f
commit
b5a7b5e277
@ -212,11 +212,20 @@ inline T& operator>> (object o, T& v)
|
||||
return v;
|
||||
}
|
||||
|
||||
namespace detail {
|
||||
template <typename Stream, typename T>
|
||||
struct packer_serializer {
|
||||
static packer<Stream>& pack(packer<Stream>& o, const T& v) {
|
||||
v.msgpack_pack(o);
|
||||
return o;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
template <typename Stream, typename T>
|
||||
inline packer<Stream>& operator<< (packer<Stream>& o, const T& v)
|
||||
{
|
||||
v.msgpack_pack(o);
|
||||
return o;
|
||||
return detail::packer_serializer<Stream, T>::pack(o, v);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
|
@ -48,8 +48,15 @@
|
||||
template <> \
|
||||
void operator<< (object::with_zone& o, const enum& v) \
|
||||
{ \
|
||||
int tmp = static_cast<enum>(v); \
|
||||
o << tmp; \
|
||||
o << static_cast<int>(v); \
|
||||
} \
|
||||
namespace detail { \
|
||||
template <typename Stream> \
|
||||
struct packer_serializer<Stream, enum> { \
|
||||
static packer<Stream>& pack(packer<Stream>& o, const enum& v) { \
|
||||
return o << static_cast<int>(v); \
|
||||
} \
|
||||
}; \
|
||||
} \
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user