cpp11_convert_helper.hpp
Go to the documentation of this file.
//
// MessagePack for C++ static resolution routine
//
// Copyright (C) 2017 KONDO Takatoshi
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
#ifndef MSGPACK_V1_CPP11_CONVERT_HELPER_HPP
#define MSGPACK_V1_CPP11_CONVERT_HELPER_HPP
#include <tuple>
#include <msgpack/object_fwd.hpp>
namespace msgpack {
MSGPACK_API_VERSION_NAMESPACE(v1) {
namespace type {
template <typename T>
inline typename std::enable_if<
has_as<T>::value
>::type
convert_helper(msgpack::object const& o, T& t) {
t = o.as<T>();
}
template <typename T>
inline typename std::enable_if<
!has_as<T>::value
>::type
convert_helper(msgpack::object const& o, T& t) {
o.convert(t);
}
} // namespace type
} // MSGPACK_API_VERSION_NAMESPACE(v1)
} // namespace msgpack
#endif // MSGPACK_V1_CPP11_CONVERT_HELPER_HPP
object_fwd.hpp
msgpack::object::as
std::enable_if< msgpack::has_as< T >::value, T >::type as() const
Get value as T.
Definition: object.hpp:1121
msgpack
Definition: adaptor_base.hpp:15
msgpack::object
Object class that corresponding to MessagePack format object.
Definition: object_fwd.hpp:75
msgpack::type::convert_helper
std::enable_if< has_as< T >::value >::type convert_helper(msgpack::object const &o, T &t)
Definition: cpp11_convert_helper.hpp:27
MSGPACK_API_VERSION_NAMESPACE
#define MSGPACK_API_VERSION_NAMESPACE(ns)
Definition: versioning.hpp:58
msgpack::has_as::value
static constexpr bool value
Definition: object_fwd.hpp:66
msgpack::has_as
Definition: object_fwd.hpp:53
msgpack::object::convert
msgpack::enable_if< !msgpack::is_array< T >::value &&!msgpack::is_pointer< T >::value, T &>::type convert(T &v) const
Convert the object.
Definition: object.hpp:1071