File tree Expand file tree Collapse file tree 1 file changed +19
-0
lines changed
Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -32,6 +32,25 @@ MSGPACK_API_VERSION_NAMESPACE(v1) {
3232
3333namespace adaptor {
3434
35+ #if !defined(MSGPACK_USE_CPP03)
36+ template <typename T>
37+ struct as <std::vector<T>> {
38+ std::vector<T> operator ()(const msgpack::object& o) const {
39+ if (o.type != msgpack::type::ARRAY) { throw msgpack::type_error (); }
40+ std::vector<T> v;
41+ if (o.via .array .size > 0 ) {
42+ msgpack::object* p = o.via .array .ptr ;
43+ msgpack::object* const pend = o.via .array .ptr + o.via .array .size ;
44+ do {
45+ v.emplace_back (p->as <T>());
46+ ++p;
47+ } while (p < pend);
48+ }
49+ return v;
50+ }
51+ };
52+ #endif
53+
3554template <typename T>
3655struct convert <std::vector<T> > {
3756 msgpack::object const & operator ()(msgpack::object const & o, std::vector<T>& v) const {
You can’t perform that action at this time.
0 commit comments