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 {
336
336
case staj_event_type::begin_array:
337
337
{
338
338
T v;
339
+ if (cursor.current ().size () > 0 )
340
+ {
341
+ v.capacity (cursor.current ().size ());
342
+ }
339
343
typed_array_visitor<T> visitor (v);
340
344
cursor.read_to (visitor, ec);
341
345
return v;
@@ -375,6 +379,10 @@ namespace jsoncons {
375
379
case staj_event_type::begin_array:
376
380
{
377
381
T v;
382
+ if (cursor.current ().size () > 0 )
383
+ {
384
+ v.capacity (cursor.current ().size ());
385
+ }
378
386
typed_array_visitor<T> visitor (v);
379
387
cursor.read_to (visitor, ec);
380
388
return v;
@@ -489,6 +497,10 @@ namespace jsoncons {
489
497
ec = conv_errc::not_map;
490
498
return val;
491
499
}
500
+ if (cursor.current ().size () > 0 )
501
+ {
502
+ val.capacity (cursor.current ().size ());
503
+ }
492
504
cursor.next (ec);
493
505
494
506
while (cursor.current ().event_type () != staj_event_type::end_object && !ec)
@@ -533,6 +545,10 @@ namespace jsoncons {
533
545
ec = conv_errc::not_map;
534
546
return val;
535
547
}
548
+ if (cursor.current ().size () > 0 )
549
+ {
550
+ val.capacity (cursor.current ().size ());
551
+ }
536
552
cursor.next (ec);
537
553
538
554
while (cursor.current ().event_type () != staj_event_type::end_object && !ec)
You can’t perform that action at this time.
0 commit comments