File tree Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -336,6 +336,10 @@ namespace jsoncons {
336336 case staj_event_type::begin_array:
337337 {
338338 T v;
339+ if (cursor.current ().size () > 0 )
340+ {
341+ v.capacity (cursor.current ().size ());
342+ }
339343 typed_array_visitor<T> visitor (v);
340344 cursor.read_to (visitor, ec);
341345 return v;
@@ -375,6 +379,10 @@ namespace jsoncons {
375379 case staj_event_type::begin_array:
376380 {
377381 T v;
382+ if (cursor.current ().size () > 0 )
383+ {
384+ v.capacity (cursor.current ().size ());
385+ }
378386 typed_array_visitor<T> visitor (v);
379387 cursor.read_to (visitor, ec);
380388 return v;
@@ -489,6 +497,10 @@ namespace jsoncons {
489497 ec = conv_errc::not_map;
490498 return val;
491499 }
500+ if (cursor.current ().size () > 0 )
501+ {
502+ val.capacity (cursor.current ().size ());
503+ }
492504 cursor.next (ec);
493505
494506 while (cursor.current ().event_type () != staj_event_type::end_object && !ec)
@@ -533,6 +545,10 @@ namespace jsoncons {
533545 ec = conv_errc::not_map;
534546 return val;
535547 }
548+ if (cursor.current ().size () > 0 )
549+ {
550+ val.capacity (cursor.current ().size ());
551+ }
536552 cursor.next (ec);
537553
538554 while (cursor.current ().event_type () != staj_event_type::end_object && !ec)
You can’t perform that action at this time.
0 commit comments