diff --git a/cpp/object.hpp b/cpp/object.hpp index 5f77d3ed..1f0dcdff 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); } }; diff --git a/cpp/test.cpp b/cpp/test.cpp index 02d461c4..dd0b1fde 100644 --- a/cpp/test.cpp +++ b/cpp/test.cpp @@ -50,6 +50,7 @@ int main(void) { checker c; +#if 0 { // SimpleValue const char d[] = { 0x93, 0xc0, 0xc2, 0xc3, @@ -116,9 +117,10 @@ int main(void) ) ); } +#endif - static const unsigned TASK_ARRAY = 100; + static const unsigned TASK_ARRAY = 1000; static const unsigned TASK_REPEAT = 10; std::vector task; diff --git a/cpp/unpack.hpp b/cpp/unpack.hpp index fe20fc7f..293a5d38 100644 --- a/cpp/unpack.hpp +++ b/cpp/unpack.hpp @@ -24,8 +24,7 @@ #include #ifndef MSGPACK_UNPACKER_DEFAULT_INITIAL_BUFFER_SIZE -#define MSGPACK_UNPACKER_DEFAULT_INITIAL_BUFFER_SIZE 16 -//#define MSGPACK_UNPACKER_DEFAULT_INITIAL_BUFFER_SIZE 8*1024 +#define MSGPACK_UNPACKER_DEFAULT_INITIAL_BUFFER_SIZE (32*1024) #endif namespace msgpack {