\brief Ensure that builder can accommodate the additional number of bytes without the need to perform allocations \param[in] additional_bytes number of additional bytes to make space for \return Status
| 91 | /// \param[in] additional_bytes number of additional bytes to make space for |
| 92 | /// \return Status |
| 93 | Status Reserve(const int64_t additional_bytes) { |
| 94 | auto min_capacity = size_ + additional_bytes; |
| 95 | if (min_capacity <= capacity_) { |
| 96 | return Status::OK(); |
| 97 | } |
| 98 | return Resize(GrowByFactor(capacity_, min_capacity), false); |
| 99 | } |
| 100 | |
| 101 | /// \brief Return a capacity expanded by the desired growth factor |
| 102 | static int64_t GrowByFactor(int64_t current_capacity, int64_t new_capacity) { |