MCPcopy Create free account
hub / github.com/ashvardanian/StringZilla / reserve

Method reserve

include/stringzilla/stringzilla.hpp:3627–3630  ·  view source on GitHub ↗

* @brief Informs the string object of a planned change in size, so that it pre-allocate once. * @throw `std::length_error` if the string is too long. */

Source from the content-addressed store, hash-verified

3625 * @throw `std::length_error` if the string is too long.
3626 */
3627 void reserve(size_type capacity) noexcept(false) {
3628 if (capacity > max_size()) throw std::length_error("sz::basic_string::reserve");
3629 if (!try_reserve(capacity)) throw std::bad_alloc();
3630 }
3631
3632 /**
3633 * @brief Inserts @b (in-place) a ::character multiple times at the given offset.

Callers 4

test_utf8_case_fold_fuzzFunction · 0.80
test_utf8_ci_find_fuzzFunction · 0.80

Calls

no outgoing calls

Tested by 3

test_utf8_case_fold_fuzzFunction · 0.64
test_utf8_ci_find_fuzzFunction · 0.64