File tree Expand file tree Collapse file tree 1 file changed +32
-0
lines changed
Expand file tree Collapse file tree 1 file changed +32
-0
lines changed Original file line number Diff line number Diff line change @@ -30,4 +30,36 @@ namespace msgpackcpp
3030 });
3131 }
3232 }
33+
34+ template <
35+ class Source ,
36+ class T ,
37+ class D1 = boost::describe::describe_members<T, boost::describe::mod_any_access>
38+ >
39+ inline void deserialize (Source& in, T& obj, bool as_map = false )
40+ {
41+ if (as_map)
42+ {
43+ uint32_t size{};
44+ deserialize_map_size (in, size);
45+ if (size != boost::mp11::mp_size<D1>::value)
46+ throw std::system_error (BAD_SIZE);
47+
48+ boost::mp11::mp_for_each<D1>([&](auto D) {
49+ deserialize (in, D.name );
50+ deserialize (in, obj.*D.pointer );
51+ });
52+ }
53+ else
54+ {
55+ uint32_t size{};
56+ deserialize_array_size (in, size);
57+ if (size != boost::mp11::mp_size<D1>::value)
58+ throw std::system_error (BAD_SIZE);
59+
60+ boost::mp11::mp_for_each<D1>([&](auto D) {
61+ deserialize (in, obj.*D.pointer );
62+ });
63+ }
64+ }
3365}
You can’t perform that action at this time.
0 commit comments