folly::dynamic::reserve

Pre-allocate size.

Synopsis

Declared in <folly/json/dynamic.h>

void
reserve(std::size_t capacity);

Description

If this is an array, an object, or a string, reserves the requested capacity in the underlying container. Otherwise throws TypeError.

May invalidate iterators, and does not give any additional guarantees on iterator invalidation on subsequent insertions; the only purpose is for optimization.

methodset Container

Parameters

NameDescription
capacityThe number of elements to reserve capacity for.