| 216 | |
| 217 | template<class Handler> |
| 218 | void |
| 219 | basic_parser<Handler>:: |
| 220 | reserve() |
| 221 | { |
| 222 | if(BOOST_JSON_LIKELY( |
| 223 | ! st_.empty())) |
| 224 | return; |
| 225 | // Reserve the largest stack we need, |
| 226 | // to avoid reallocation during suspend. |
| 227 | st_.reserve( |
| 228 | sizeof(state) + // document parsing state |
| 229 | (sizeof(state) + |
| 230 | sizeof(std::size_t)) * depth() + // array and object state + size |
| 231 | sizeof(state) + // value parsing state |
| 232 | sizeof(std::size_t) + // string size |
| 233 | sizeof(state)); // comment state |
| 234 | } |
| 235 | |
| 236 | //---------------------------------------------------------- |
| 237 | // |