* @brief Inserts @b (in-place) a range of characters at a given signed offset. * @return `true` if the insertion was successful, `false` otherwise. */
| 3487 | * @return `true` if the insertion was successful, `false` otherwise. |
| 3488 | */ |
| 3489 | bool try_insert(difference_type signed_offset, string_view string) noexcept { |
| 3490 | sz_size_t normalized_offset, normalized_length; |
| 3491 | sz_ssize_clamp_interval(size(), signed_offset, 0, &normalized_offset, &normalized_length); |
| 3492 | if (_with_alloc([&](sz_alloc_type &alloc) { |
| 3493 | return sz_string_expand(&string_, normalized_offset, string.size(), &alloc) ? sz_success_k |
| 3494 | : sz_bad_alloc_k; |
| 3495 | }) != status_t::success_k) |
| 3496 | return false; |
| 3497 | |
| 3498 | sz_copy(data() + normalized_offset, string.data(), string.size()); |
| 3499 | return true; |
| 3500 | } |
| 3501 | |
| 3502 | /** |
| 3503 | * @brief Replaces @b (in-place) a range of characters with a given string. |
nothing calls this directly
no test coverage detected