10#ifndef MSGPACK_V1_TYPE_BOOST_FUSION_HPP
11#define MSGPACK_V1_TYPE_BOOST_FUSION_HPP
21#if !defined (MSGPACK_USE_CPP03)
26#pragma GCC diagnostic push
27#pragma GCC diagnostic ignored "-Wconversion"
30#include <boost/fusion/support/is_sequence.hpp>
31#include <boost/fusion/sequence/intrinsic/size.hpp>
32#include <boost/fusion/algorithm/iteration/for_each.hpp>
33#include <boost/fusion/sequence/intrinsic/at.hpp>
34#include <boost/fusion/include/mpl.hpp>
38#pragma GCC diagnostic pop
42#include <boost/mpl/size.hpp>
56 static bool const value =
false;
59template <
typename T,
typename U>
64#if !defined(MSGPACK_USE_CPP03)
68 static bool const value =
false;
71template <
typename... Args>
81 boost::fusion::traits::is_sequence<T>::value
84#if !defined (MSGPACK_USE_CPP03)
93#if !defined (MSGPACK_USE_CPP03)
99 detail::is_seq_no_pair_no_tuple<T>::value &&
102 boost::mpl::bool_<true>,
106 msgpack::has_as<boost::mpl::_2>
108 boost::mpl::bool_<true>,
109 boost::mpl::bool_<false>
119 using tuple_t =
decltype(to_tuple(std::declval<T>(),
gen_seq<boost::mpl::size<T>::value>()));
124 template<std::size_t... Is,
typename U>
126 typename std::remove_reference<
127 typename boost::fusion::result_of::at_c<T, static_cast<int>(Is)>::type
130 return std::make_tuple(boost::fusion::at_c<Is>(u)...);
132 template<std::size_t... Is,
typename U>
134 return T(std::get<Is>(u)...);
141struct convert<T, typename
msgpack::enable_if<detail::is_seq_no_pair_no_tuple<T>::value>::type > {
148 boost::fusion::for_each(v, convert_imp(o, index));
153 convert_imp(
msgpack::object const& obj, uint32_t& index):obj_(obj), index_(index) {}
154 template <
typename U>
155 void operator()(U& v)
const {
165struct pack<T, typename
msgpack::enable_if<detail::is_seq_no_pair_no_tuple<T>::value>::type > {
166 template <
typename Stream>
170 boost::fusion::for_each(v, pack_imp<Stream>(o));
174 template <
typename Stream>
177 template <
typename U>
178 void operator()(U
const& v)
const {
190 o.
type = msgpack::type::ARRAY;
194 boost::fusion::for_each(v, with_zone_imp(o, count));
197 struct with_zone_imp {
199 template <
typename U>
200 void operator()(U
const& v)
const {
The class template that supports continuous packing.
Definition pack.hpp:33
packer< Stream > & pack_array(uint32_t n)
Packing array header and size.
Definition pack.hpp:1195
Definition object_fwd.hpp:231
void * allocate_align(size_t size, size_t align=MSGPACK_ZONE_ALIGN)
Definition cpp03_zone.hpp:255
Definition adaptor_base.hpp:15
uint32_t checked_get_container_size(T size)
Definition check_container_size.hpp:55
static std::tuple< typename std::remove_reference< typename boost::fusion::result_of::at_c< T, static_cast< int >(Is)>::type >::type... > to_tuple(U const &u, seq< Is... >)
Definition fusion.hpp:129
T operator()(msgpack::object const &o) const
Definition fusion.hpp:114
static T to_t(U const &u, seq< Is... >)
Definition fusion.hpp:133
Definition object_fwd_decl.hpp:61
msgpack::object const & operator()(msgpack::object const &o, T &v) const
Definition fusion.hpp:142
Definition adaptor_base.hpp:27
static bool const value
Definition fusion.hpp:80
static bool const value
Definition fusion.hpp:56
static bool const value
Definition fusion.hpp:68
void operator()(msgpack::object::with_zone &o, const T &v) const
Definition fusion.hpp:188
Definition adaptor_base.hpp:43
msgpack::packer< Stream > & operator()(msgpack::packer< Stream > &o, const T &v) const
Definition fusion.hpp:167
Definition adaptor_base.hpp:32
msgpack::zone & zone
Definition object.hpp:37
uint32_t size
Definition object_fwd.hpp:23
msgpack::object * ptr
Definition object_fwd.hpp:24
Object class that corresponding to MessagePack format object.
Definition object_fwd.hpp:75
std::enable_if< msgpack::has_as< T >::value, T >::type as() const
Get value as T.
Definition object.hpp:1126
union_type via
Definition object_fwd.hpp:93
msgpack::type::object_type type
Definition object_fwd.hpp:92
msgpack::object_array array
Definition object_fwd.hpp:85
#define MSGPACK_ZONE_ALIGNOF(type)
Definition cpp03_zone_decl.hpp:30
#define MSGPACK_API_VERSION_NAMESPACE(ns)
Definition versioning.hpp:66