\brief Ensure that there is enough space allocated to append the indicated number of elements without any further reallocation. Overallocation is used in order to minimize the impact of incremental Reserve() calls. Note that additional_capacity is relative to the current number of elements rather than to the current capacity, so calls to Reserve() which are not interspersed with addition of new el
| 136 | /// \param[in] additional_capacity the number of additional array values |
| 137 | /// \return Status |
| 138 | Status Reserve(int64_t additional_capacity) { |
| 139 | auto current_capacity = capacity(); |
| 140 | auto min_capacity = length() + additional_capacity; |
| 141 | if (min_capacity <= current_capacity) return Status::OK(); |
| 142 | |
| 143 | // leave growth factor up to BufferBuilder |
| 144 | auto new_capacity = BufferBuilder::GrowByFactor(current_capacity, min_capacity); |
| 145 | return Resize(new_capacity); |
| 146 | } |
| 147 | |
| 148 | /// Reset the builder. |
| 149 | virtual void Reset(); |
no test coverage detected