mirror of
https://github.com/msgpack/msgpack-c.git
synced 2025-05-31 00:04:38 +02: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;
|
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>
|
template <typename Stream, typename T>
|
||||||
inline packer<Stream>& operator<< (packer<Stream>& o, const T& v)
|
inline packer<Stream>& operator<< (packer<Stream>& o, const T& v)
|
||||||
{
|
{
|
||||||
v.msgpack_pack(o);
|
return detail::packer_serializer<Stream, T>::pack(o, v);
|
||||||
return o;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
|
@ -48,8 +48,15 @@
|
|||||||
template <> \
|
template <> \
|
||||||
void operator<< (object::with_zone& o, const enum& v) \
|
void operator<< (object::with_zone& o, const enum& v) \
|
||||||
{ \
|
{ \
|
||||||
int tmp = static_cast<enum>(v); \
|
o << static_cast<int>(v); \
|
||||||
o << tmp; \
|
} \
|
||||||
|
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