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 | 8903e2dea9f7f719897ca2420fae9376982c2c3b (patch) | |
tree | ec5dac847f78b4e6ea1d248fa183bbe54bd8f1e3 /cpp/object.hpp | |
parent | 62231983d7580231bf1e622d9e6a39c708a0a48c (diff) | |
download | msgpack-python-8903e2dea9f7f719897ca2420fae9376982c2c3b.tar.gz |
cpp: const
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; } |