From e893dde57e60e8e75b30b0e6a539ec233e112a4a Mon Sep 17 00:00:00 2001 From: frsyuki Date: Sun, 15 Feb 2009 09:10:01 +0000 Subject: C++ binding: efficient serializing interface git-svn-id: file:///Users/frsyuki/project/msgpack-git/svn/x@95 5a5092ae-2292-43ba-b2d5-dcab9c1a2731 --- cpp/object.hpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'cpp/object.hpp') diff --git a/cpp/object.hpp b/cpp/object.hpp index 5f77d3e..1f0dcdf 100644 --- a/cpp/object.hpp +++ b/cpp/object.hpp @@ -135,14 +135,14 @@ inline void pack_copy(packer& o, T v) template inline T& operator>> (object o, T& v) { - v.msgpack_unpack(o); + v.msgpack_unpack(o.convert()); return v; } template inline packer& operator<< (packer& o, const T& v) { - o << v.msgpack_pack(); + v.msgpack_pack(o); return o; } @@ -156,14 +156,15 @@ public: define() {} define(msgpack_type v) : msgpack_type(v) {} - msgpack_type msgpack_pack() const + template + void msgpack_pack(Packer& o) const { - return *this; + o << static_cast(*this); } void msgpack_unpack(object o) { - convert(static_cast(*this), o); + o >> static_cast(*this); } }; -- cgit v1.2.1