diff options
author | Naoki INADA <inada-n@klab.jp> | 2009-06-08 04:43:25 +0900 |
---|---|---|
committer | Naoki INADA <inada-n@klab.jp> | 2009-06-08 04:43:25 +0900 |
commit | 114ef92d42899ce323f603d6c584b2ba9f279e16 (patch) | |
tree | 3561d2a15aae958e5d5c71cb2d33a289c8d629ea /cpp/object.hpp | |
parent | 3628ea22d4079fa0a235a938eadf7b24943e326c (diff) | |
parent | 7cd359c1fdab21adb0fd5760741a6b1b0e4a806a (diff) | |
download | msgpack-python-114ef92d42899ce323f603d6c584b2ba9f279e16.tar.gz |
Merge branch 'master' of git://git.sourceforge.jp/gitroot/msgpack/msgpack
Diffstat (limited to 'cpp/object.hpp')
-rw-r--r-- | cpp/object.hpp | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/cpp/object.hpp b/cpp/object.hpp index 09ddb89..07917c2 100644 --- a/cpp/object.hpp +++ b/cpp/object.hpp @@ -80,13 +80,13 @@ struct object { type::object_type type; union_type via; - bool is_nil() { return type == type::NIL; } + bool is_nil() const { return type == type::NIL; } template <typename T> - T as(); + T as() const; template <typename T> - void convert(T* v); + void convert(T* v) const; object(); object(msgpack_object obj); @@ -96,7 +96,7 @@ private: struct implicit_type; public: - implicit_type convert(); + implicit_type convert() const; }; struct object_kv { @@ -201,23 +201,23 @@ inline object::operator msgpack_object() } -inline object::implicit_type object::convert() +inline object::implicit_type object::convert() const { return implicit_type(*this); } template <typename T> -inline T object::as() +inline void object::convert(T* v) const { - T v; - convert(&v); - return v; + *this >> *v; } template <typename T> -inline void object::convert(T* v) +inline T object::as() const { - *this >> *v; + T v; + convert(&v); + return v; } |