diff options
| author | frsyuki <frsyuki@users.sourceforge.jp> | 2009-05-13 17:53:27 +0900 |
|---|---|---|
| committer | frsyuki <frsyuki@users.sourceforge.jp> | 2009-05-13 17:53:27 +0900 |
| commit | 6a0729ea9151dc54014028e1b3e28dfc6c17e4d0 (patch) | |
| tree | ec5dac847f78b4e6ea1d248fa183bbe54bd8f1e3 /cpp | |
| parent | b0062a7f6f47b9a4340d14c6fb0a3ae0f60c8259 (diff) | |
| download | msgpack-python-6a0729ea9151dc54014028e1b3e28dfc6c17e4d0.tar.gz | |
cpp: const
Diffstat (limited to 'cpp')
| -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; } |
