mirror of
https://github.com/msgpack/msgpack-c
synced 2026-06-08 16:11:40 +00:00
Modified the parameter of object::convert() from pointer to reference.
This commit is contained in:
+11
-2
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user