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

Method insert

include/stringzilla/stringzilla.hpp:3691–3695  ·  view source on GitHub ↗

* @brief Inserts @b (in-place) one ::character at the given iterator position. * @throw `std::out_of_range` if `pos > size()` or `other_index > other.size()`. * @throw `std::length_error` if the string is too long. * @throw `std::bad_alloc` if the allocation fails. */

Source from the content-addressed store, hash-verified

3689 * @throw `std::bad_alloc` if the allocation fails.
3690 */
3691 iterator insert(const_iterator it, char_type character) noexcept(false) sz_lifetime_bound_ {
3692 auto pos = range_length(cbegin(), it);
3693 insert(pos, string_view(&character, 1));
3694 return begin() + pos;
3695 }
3696
3697 /**
3698 * @brief Inserts @b (in-place) a ::character multiple times at the given iterator position.

Callers 6

build_stringzillaFunction · 0.80
hashmap_with_szFunction · 0.80
let_assertFunction · 0.80

Calls 6

range_lengthFunction · 0.85
raiseFunction · 0.85
_with_allocFunction · 0.85
sz_string_expandFunction · 0.85
beginMethod · 0.45
endMethod · 0.45

Tested by 4

hashmap_with_szFunction · 0.64
let_assertFunction · 0.64