你需要提供一个
pack()
Content
结构:
namespace msgpack
{
MSGPACK_API_VERSION_NAMESPACE(MSGPACK_DEFAULT_API_NS)
{
namespace adaptor
{
template <>
struct pack<Content> {
template <typename Stream>
msgpack::packer<Stream>& operator()(
msgpack::packer<Stream>& out, Content const& obj) const
{
out.pack(obj.image);
out.pack(obj.msg);
return out;
}
};
}
}
}
包()
示例
函数(与
template <>
struct convert<Content> {
msgpack::object const& operator()(
msgpack::object const& o, Content& v) const
{
// unpack data in the same format as it was packed. see above!
return o;
}
};