diff --git a/include/msgpack/v1/object.hpp b/include/msgpack/v1/object.hpp index fda54be9f..4fe1dca9a 100644 --- a/include/msgpack/v1/object.hpp +++ b/include/msgpack/v1/object.hpp @@ -1134,6 +1134,13 @@ inline typename std::enable_if::value, T>::type object::as() return v; } +template +inline typename std::enable_if::value, T>::type object::as(const C & param) const { + T v; + convert(v, param); + return v; +} + #endif // defined(MSGPACK_USE_CPP03) inline object::object() diff --git a/include/msgpack/v1/object_fwd.hpp b/include/msgpack/v1/object_fwd.hpp index 2562b4164..051bb8e59 100644 --- a/include/msgpack/v1/object_fwd.hpp +++ b/include/msgpack/v1/object_fwd.hpp @@ -129,6 +129,9 @@ struct object { template typename std::enable_if::value, T>::type as() const; + template + typename std::enable_if::value, T>::type as(const C & param) const; + #endif // defined(MSGPACK_USE_CPP03) /// Convert the object @@ -145,6 +148,13 @@ struct object { >::type convert(T& v) const; + template + typename msgpack::enable_if< + !msgpack::is_array::value && !msgpack::is_pointer::value, + T& + >::type + convert(T& v, const C& param) const; + template T (&convert(T(&v)[N]) const)[N];