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

Method try_push_back

include/stringzilla/stringzilla.hpp:4335–4344  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4333
4334template <typename char_type_, typename allocator_>
4335bool basic_string<char_type_, allocator_>::try_push_back(char_type c) noexcept {
4336 auto result = _with_alloc([&](sz_alloc_type &alloc) {
4337 auto old_size = size();
4338 sz_ptr_t start = sz_string_expand(&string_, SZ_SIZE_MAX, 1, &alloc);
4339 if (!start) return sz_bad_alloc_k;
4340 start[old_size] = c;
4341 return sz_success_k;
4342 });
4343 return result == status_t::success_k;
4344}
4345
4346template <typename char_type_, typename allocator_>
4347bool basic_string<char_type_, allocator_>::try_append(const_pointer str, size_type length) noexcept {

Callers 3

try_insertMethod · 0.45
try_buildMethod · 0.45

Calls 2

_with_allocFunction · 0.85
sz_string_expandFunction · 0.85

Tested by

no test coverage detected