Modified the parameter of object::convert() from pointer to reference.

This commit is contained in:
Takatoshi Kondo
2013-09-05 10:17:45 +09:00
parent 1fb707f93f
commit 415b14335f
16 changed files with 78 additions and 69 deletions
+11 -2
View File
@@ -85,9 +85,12 @@ struct object {
template <typename T>
T as() const;
template <typename T>
void convert(T& v) const;
template <typename T>
void convert(T* v) const;
object();
object(msgpack_object o);
@@ -302,17 +305,23 @@ inline object::implicit_type object::convert() const
return implicit_type(*this);
}
template <typename T>
inline void object::convert(T& v) const
{
*this >> v;
}
template <typename T>
inline void object::convert(T* v) const
{
*this >> *v;
convert(*v);
}
template <typename T>
inline T object::as() const
{
T v;
convert(&v);
convert(v);
return v;
}