Added converting support for different size tuples.

This commit is contained in:
Takatoshi Kondo
2016-06-20 17:12:53 +09:00
parent 1b87018a0a
commit 4ffdc01135
7 changed files with 1175 additions and 566 deletions

View File

@@ -148,10 +148,10 @@ struct convert<type::tuple<A0<%1.upto(i) {|j|%>, A<%=j%><%}%>> > {
msgpack::object const& o,
type::tuple<A0<%1.upto(i) {|j|%>, A<%=j%><%}%>>& v) const {
if(o.type != msgpack::type::ARRAY) { throw msgpack::type_error(); }
if(o.via.array.size < <%=i+1%>) { throw msgpack::type_error(); }
<%0.upto(i) {|j|%>
// In order to avoid clang++'s invalid warning, msgpack::object:: has been added.
o.via.array.ptr[<%=j%>].msgpack::object::convert<typename type::tuple_type<A<%=j%>>::type>(v.template get<<%=j%>>());<%}%>
if(o.via.array.size > <%=j%>)
o.via.array.ptr[<%=j%>].msgpack::object::convert<typename type::tuple_type<A<%=j%>>::type>(v.template get<<%=j%>>());<%}%>
return o;
}
};