Added a conversion member function to msgpack::object.
If msgpack::object is nil then returns false else returns true and sets a value.
This commit is contained in:
Takatoshi Kondo
2015-08-31 09:05:09 +09:00
parent 9ee1168cc4
commit 33de24239a
3 changed files with 29 additions and 0 deletions

View File

@@ -511,6 +511,15 @@ inline T* object::convert(T* v) const
return v;
}
template <typename T>
inline bool object::convert_if_not_nil(T& v) const {
if (is_nil()) {
return false;
}
convert(v);
return true;
}
#if defined(MSGPACK_USE_CPP03)
template <typename T>