__GNU_CXX::__VERSA_STRING(3)

🌸 __gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base > 🌸

okay bestie, welcome to a Library Functions Manual moment, section 3, and it's giving very much "template class" energy. this is the page for __gnu_cxx::__versa_string, and no, it's not a weird string that tells you your future β€” it's a whole template class. we're doing this in 10 parts because it's long, so buckle up, hydrate, and let's go πŸ’…


✨ NAME ✨

__gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base > β€” Template class __versa_string. that's it, that's the name, iconic, no notes πŸ’–


✨ SYNOPSIS ✨

first things first, you gotta pull it in:

#include <vstring.h>

πŸŽ€ Public Types πŸŽ€

okay so this class has a whole wardrobe of public typedefs and honestly? every single one of them matters. not me listing all thirteen of them, but here we are, because we keep every detail in this house 🫢

  • typedef _Alloc allocator_type β€” the allocator, but make it a type name you can actually say out loud.
  • typedef __gnu_cxx::__normal_iterator< const_pointer, __versa_string > const_iterator β€” your iterator for when you're just looking, not touching. read-only queen πŸ‘‘
  • typedef _CharT_alloc_traits::const_pointer const_pointer β€” a pointer that refuses to let you change anything. boundaries, we love them.
  • typedef const value_type & const_reference β€” a reference to a const value_type. no edits allowed, periodt.
  • typedef std::reverse_iterator< const_iterator > const_reverse_iterator β€” same const iterator vibe, but it walks backwards. main character entrance but in reverse πŸ’€
  • typedef _CharT_alloc_type::difference_type difference_type β€” the type used for differences, like when you're subtracting one thing from another.
  • typedef __gnu_cxx::__normal_iterator< pointer, __versa_string > iterator β€” the iterator that can touch things. full permissions, unlocked ✨
  • typedef _CharT_alloc_traits::pointer pointer β€” a regular pointer type, courtesy of _CharT_alloc_traits.
  • typedef value_type & reference β€” a reference to a value_type, and yeah you can change stuff through it.
  • typedef std::reverse_iterator< iterator > reverse_iterator β€” a mutable iterator but it goes backwards. lowkey chaotic, highkey useful πŸ¦‹
  • typedef _CharT_alloc_type::size_type size_type β€” the type for sizes, brought to you by _CharT_alloc_type.
  • typedef _Traits traits_type β€” the traits, just renamed so it's cute and short.
  • typedef _Traits::char_type value_type β€” the character type, straight out of _Traits, and this is the value_type everything else is built around. the blueprint, fr fr 🌈

and that's just part 1 bestie, we're literally only getting started β€” more sections coming right up πŸ’–

πŸ’– Public Member Functions πŸ’–

okay bestie, this is the main character energy list of everything this string can do. every single one, no skips, periodt. πŸ’…

  • __versa_string (__versa_string &&__str) noexcept β€” String move constructor. it's giving move semantics, slay. ✨
  • Signature:
template<class _InputIterator, typename =
    std::_RequireInputIter<_InputIterator>> __versa_string
    (_InputIterator __beg, _InputIterator __end, const _Alloc
    &__a=_Alloc())

β€” Construct string as copy of a range. lowkey range vibes, bestie. πŸ¦‹

  • __versa_string (const __versa_string &__str) β€” Construct string with copy of value of __str. copy queen behavior. πŸ‘‘
  • __versa_string (const __versa_string &__str, size_type __pos, size_type __n, const _Alloc &__a) β€” Construct string as copy of a substring. it's a substring moment. πŸŽ€
  • __versa_string (const __versa_string &__str, size_type __pos, size_type __n=npos) β€” Construct string as copy of a substring. same vibe, but with a default npos. 🌈
  • __versa_string (const _Alloc &__a=_Alloc()) noexcept β€” Construct an empty string using allocator a. empty but iconic. πŸ’œ
  • __versa_string (const _CharT *__s, const _Alloc &__a=_Alloc()) β€” Construct string as copy of a C string. C string energy. πŸ“
  • __versa_string (const _CharT *__s, size_type __n, const _Alloc &__a=_Alloc()) β€” Construct string initialized by a character array. array to string, no cap. πŸ”₯
  • __versa_string (size_type __n, _CharT __c, const _Alloc &__a=_Alloc()) β€” Construct string as multiple characters. multiple characters, we love to see it. πŸ’š
  • __versa_string (std::initializer_list< _CharT > __l, const _Alloc &__a=_Alloc()) β€” Construct string from an initializer list. initializer list realness. ✨
  • ~__versa_string () noexcept β€” Destroy the string instance. it's the end of an era, but noexcept so no drama. πŸ’€
  • Signature:
template<typename _InputIterator> __versa_string< _CharT, _Traits,
    _Alloc, _Base > & _M_replace_dispatch (const_iterator __i1,
    const_iterator __i2, _InputIterator __k1, _InputIterator __k2,
    std::__false_type)

β€” (no description, just vibes) πŸ™ˆ

  • Signature:
template<class _InputIterator, typename =
    std::_RequireInputIter<_InputIterator>> __versa_string & append
    (_InputIterator __first, _InputIterator __last)

β€” Append a range of characters. append range, slay. πŸ’…

  • __versa_string & append (const __versa_string &__str) β€” Append a string to this string. append string to this string. πŸ‘‘
  • __versa_string & append (const __versa_string &__str, size_type __pos, size_type __n) β€” Append a substring. substring append. πŸŽ€
  • __versa_string & append (const _CharT *__s) β€” Append a C string. C string append. 🌊
  • __versa_string & append (const _CharT *__s, size_type __n) β€” Append a C substring. C substring append. ⭐
  • __versa_string & append (size_type __n, _CharT __c) β€” Append multiple characters. multiple chars go brrr. πŸ’œ
  • __versa_string & append (std::initializer_list< _CharT > __l) β€” Append an initializer_list of characters. init list append. πŸ“
  • __versa_string & assign (__versa_string &&__str) noexcept β€” Set value to contents of another string. assign move, no cap. πŸ”₯
  • Signature:
template<class _InputIterator, typename =
    std::_RequireInputIter<_InputIterator>> __versa_string & assign
    (_InputIterator __first, _InputIterator __last)

β€” Set value to a range of characters. assign range. πŸ’š

  • __versa_string & assign (const __versa_string &__str) β€” Set value to contents of another string. assign copy. 🌈
  • __versa_string & assign (const __versa_string &__str, size_type __pos, size_type __n) β€” Set value to a substring of a string. assign substring. ❀️
  • __versa_string & assign (const _CharT *__s) β€” Set value to contents of a C string. assign C string. πŸ’–
  • __versa_string & assign (const _CharT *__s, size_type __n) β€” Set value to a C substring. assign C substring. πŸ’…
  • __versa_string & assign (size_type __n, _CharT __c) β€” Set value to multiple characters. assign multiple. πŸŽ€
  • __versa_string & assign (std::initializer_list< _CharT > __l) β€” Set value to an initializer_list of characters. assign init list. πŸ¦‹
  • reference at (size_type __n) β€” Provides access to the data contained in the string. at access. πŸ’…
  • const_reference at (size_type __n) const β€” Provides access to the data contained in the string. const at access. πŸ’œ
  • const_reference back () const noexcept β€” (no description, just vibes) πŸ’€
  • reference back () noexcept β€” (no description, just vibes) πŸ”₯
  • const_iterator begin () const noexcept β€” (no description, just vibes) ✨
  • iterator begin () noexcept β€” (no description, just vibes) 🌈
  • const _CharT * c_str () const noexcept β€” Return const pointer to null-terminated contents. c_str for the C string girlies. πŸ“
  • size_type capacity () const noexcept β€” (no description, just vibes) πŸ’…
  • const_iterator cbegin () const noexcept β€” (no description, just vibes) πŸŽ€
  • const_iterator cend () const noexcept β€” (no description, just vibes) πŸ¦‹
  • void clear () noexcept β€” (no description, just vibes) 🧹
  • int compare (const __versa_string &__str) const β€” Compare to a string. compare string. πŸ”₯
  • int compare (const _CharT *__s) const β€” Compare to a C string. compare C string. πŸ’š
  • Signature:
int compare (size_type __pos, size_type __n, const __versa_string
    &__str) const

β€” Compare substring to a string. compare substring to string. 🌈

  • int compare (size_type __pos, size_type __n1, const _CharT *__s) const β€” Compare substring to a C string. compare substring to C string. ❀️
  • Signature:
int compare (size_type __pos, size_type __n1, const _CharT *__s,
    size_type __n2) const

β€” Compare substring against a character array. compare against char array. πŸ’–

  • Signature:
int compare (size_type __pos1, size_type __n1, const __versa_string
    &__str, size_type __pos2, size_type __n2) const

β€” Compare substring to a substring. compare substring to substring. πŸ’…

  • size_type copy (_CharT *__s, size_type __n, size_type __pos=0) const β€” Copy substring into C string. copy into C string. πŸŽ€
  • const_reverse_iterator crbegin () const noexcept β€” (no description, just vibes) πŸ¦‹
  • const_reverse_iterator crend () const noexcept β€” (no description, just vibes) 🌸
  • const _CharT * data () const noexcept β€” Return const pointer to contents. data pointer. 🌊
  • bool empty () const noexcept β€” (no description, just vibes) 🫢
  • const_iterator end () const noexcept β€” (no description, just vibes) ✨
  • iterator end () noexcept β€” (no description, just vibes) πŸ”₯
  • iterator erase (const_iterator __first, const_iterator __last) β€” Remove a range of characters. erase range. ⭐
  • iterator erase (const_iterator __position) β€” Remove one character. erase one. πŸ’œ
  • __versa_string & erase (size_type __pos=0, size_type __n=npos) β€” Remove characters. erase chars. πŸ“
  • size_type find (_CharT __c, size_type __pos=0) const noexcept β€” Find position of a character. find char. πŸ”₯
  • Signature:
size_type find (const __versa_string &__str, size_type __pos=0) const
    noexcept

β€” Find position of a string. find string. πŸ’š

  • size_type find (const _CharT *__s, size_type __pos, size_type __n) const β€” Find position of a C substring. find C substring. 🌈
  • size_type find (const _CharT *__s, size_type __pos=0) const β€” Find position of a C string. find C string. ❀️
  • size_type find_first_not_of (_CharT __c, size_type __pos=0) const noexcept β€” Find position of a different character. find first not of char. πŸ’–
  • Signature:
size_type find_first_not_of (const __versa_string &__str, size_type
    __pos=0) const noexcept

β€” Find position of a character not in string. find first not of string. πŸ’…

  • Signature:
size_type find_first_not_of (const _CharT *__s, size_type __pos,
    size_type __n) const

β€” Find position of a character not in C substring. find first not of C substring. πŸŽ€

  • size_type find_first_not_of (const _CharT *__s, size_type __pos=0) const β€” Find position of a character not in C string. find first not of C string. πŸ¦‹
  • size_type find_first_of (_CharT __c, size_type __pos=0) const noexcept β€” Find position of a character. find first of char. ⭐
  • Signature:
size_type find_first_of (const __versa_string &__str, size_type __pos=0)
    const noexcept

β€” Find position of a character of string. find first of string. πŸ’œ

  • Signature:
size_type find_first_of (const _CharT *__s, size_type __pos, size_type
    __n) const

β€” Find position of a character of C substring. find first of C substring. πŸ“

  • size_type find_first_of (const _CharT *__s, size_type __pos=0) const β€” Find position of a character of C string. find first of C string. πŸ”₯
  • Signature:
size_type find_last_not_of (_CharT __c, size_type __pos=npos) const
    noexcept

β€” Find last position of a different character. find last not of char. πŸ’š

  • Signature:
size_type find_last_not_of (const __versa_string &__str, size_type
    __pos=npos) const noexcept

β€” Find last position of a character not in string. find last not of string. 🌈

  • Signature:
size_type find_last_not_of (const _CharT *__s, size_type __pos,
    size_type __n) const

β€” Find last position of a character not in C substring. find last not of C substring. ❀️

  • Signature:
size_type find_last_not_of (const _CharT *__s, size_type __pos=npos)
    const

β€” Find last position of a character not in C string. find last not of C string. πŸ’–

  • size_type find_last_of (_CharT __c, size_type __pos=npos) const noexcept β€” Find last position of a character. find last of char. πŸ’…
  • Signature:
size_type find_last_of (const __versa_string &__str, size_type
    __pos=npos) const noexcept

β€” Find last position of a character of string. find last of string. πŸŽ€

  • Signature:
size_type find_last_of (const _CharT *__s, size_type __pos, size_type
    __n) const

β€” Find last position of a character of C substring. find last of C substring. πŸ¦‹

  • size_type find_last_of (const _CharT *__s, size_type __pos=npos) const β€” Find last position of a character of C string. find last of C string. ⭐
  • const_reference front () const noexcept β€” (no description, just vibes) πŸ’œ
  • reference front () noexcept β€” (no description, just vibes) πŸ“
  • allocator_type get_allocator () const noexcept β€” Return copy of allocator used to construct this string. get allocator. πŸ’œ
  • iterator insert (const_iterator __p, _CharT __c) β€” Insert one character. insert one char. πŸ“
  • Signature:
template<class _InputIterator, typename =
    std::_RequireInputIter<_InputIterator>> iterator insert
    (const_iterator __p, _InputIterator __beg, _InputIterator __end)

β€” Insert a range of characters. insert range. πŸ”₯

  • iterator insert (const_iterator __p, size_type __n, _CharT __c) β€” Insert multiple characters. insert multiple chars. πŸ’š
  • Signature:
iterator insert (const_iterator __p, std::initializer_list< _CharT >
    __l)

β€” Insert an initializer_list of characters. insert init list. 🌈

  • __versa_string & insert (size_type __pos, const _CharT *__s) β€” Insert a C string. insert C string. ❀️
  • __versa_string & insert (size_type __pos, const _CharT *__s, size_type __n) β€” Insert a C substring. insert C substring. πŸ’–
  • __versa_string & insert (size_type __pos, size_type __n, _CharT __c) β€” Insert multiple characters. insert multiple chars. πŸ’…
  • __versa_string & insert (size_type __pos1, const __versa_string &__str) β€” Insert value of a string. insert string. πŸŽ€
  • Signature:
__versa_string & insert (size_type __pos1, const __versa_string &__str,
    size_type __pos2, size_type __n)

β€” Insert a substring. insert substring. πŸ¦‹

  • size_type length () const noexcept β€” Returns the number of characters in the string, not including any null-termination. length. ⭐
  • size_type max_size () const noexcept β€” Returns the size() of the largest possible string. max size. πŸ’œ
  • __versa_string & operator+= (_CharT __c) β€” Append a character. operator+= char. πŸ“
  • __versa_string & operator+= (const __versa_string &__str) β€” Append a string to this string. operator+= string. πŸ”₯
  • __versa_string & operator+= (const _CharT *__s) β€” Append a C string. operator+= C string. πŸ’š
  • __versa_string & operator+= (std::initializer_list< _CharT > __l) β€” Append an initializer_list of characters. operator+= init list. 🌈
  • __versa_string & operator= (__versa_string &&__str) noexcept β€” String move assignment operator. move assignment. ❀️
  • __versa_string & operator= (_CharT __c) β€” Set value to string of length 1. assign char. πŸ’–
  • __versa_string & operator= (const __versa_string &__str) β€” Assign the value of str to this string. assign string. πŸ’…
  • __versa_string & operator= (const _CharT *__s) β€” Copy contents of __s into this string. assign C string. πŸŽ€
  • __versa_string & operator= (std::initializer_list< _CharT > __l) β€” Set value to string constructed from initializer list. assign init list. πŸ¦‹
  • const_reference operator[] (size_type __pos) const noexcept β€” Subscript access to the data contained in the string. operator[] const. ⭐
  • reference operator[] (size_type __pos) noexcept β€” Subscript access to the data contained in the string. operator[]. πŸ’œ
  • void pop_back () β€” Remove the last character. pop_back. πŸ“
  • void push_back (_CharT __c) β€” Append a single character. push_back. πŸ”₯
  • const_reverse_iterator rbegin () const noexcept β€” (no description, just vibes) πŸ’š
  • reverse_iterator rbegin () noexcept β€” (no description, just vibes) 🌈
  • const_reverse_iterator rend () const noexcept β€” (no description, just vibes) ❀️
  • reverse_iterator rend () noexcept β€” (no description, just vibes) πŸ’–
  • __versa_string & replace (const_iterator __i1, const_iterator __i2, β€” (partial, more coming in the next part) πŸ’…
           _CharT *__k1, _CharT *__k2)
  • template<class _InputIterator, typename = std::_RequireInputIter<_InputIterator>> __versa_string & replace (const_iterator __i1, const_iterator __i2, _InputIterator __k1, _InputIterator __k2) β€” swap a range of characters out for another range ✨
  • __versa_string & replace (const_iterator __i1, const_iterator __i2, const __versa_string &__str) β€” swap a range of characters out for a string
  • __versa_string & replace (const_iterator __i1, const_iterator __i2, const _CharT *__k1, const _CharT *__k2)
  • __versa_string & replace (const_iterator __i1, const_iterator __i2, const _CharT *__s) β€” swap a range of characters out for a C string
  • __versa_string & replace (const_iterator __i1, const_iterator __i2, const _CharT *__s, size_type __n) β€” swap a range of characters out for a C substring
  • __versa_string & replace (const_iterator __i1, const_iterator __i2, const_iterator __k1, const_iterator __k2)
  • __versa_string & replace (const_iterator __i1, const_iterator __i2, iterator __k1, iterator __k2)
  • __versa_string & replace (const_iterator __i1, const_iterator __i2, size_type __n, _CharT __c) β€” swap a range of characters out for multiple characters
  • __versa_string & replace (const_iterator __i1, const_iterator __i2, std::initializer_list< _CharT > __l) β€” swap a range of characters out for an initializer_list
  • __versa_string & replace (size_type __pos, size_type __n, const __versa_string &__str) β€” swap characters out for a value from another string
  • __versa_string & replace (size_type __pos, size_type __n1, const _CharT *__s) β€” swap characters out for the value of a C string
  • __versa_string & replace (size_type __pos, size_type __n1, const _CharT *__s, size_type __n2) β€” swap characters out for the value of a C substring
  • __versa_string & replace (size_type __pos, size_type __n1, size_type __n2, _CharT __c) β€” swap characters out for multiple characters
  • __versa_string & replace (size_type __pos1, size_type __n1, const __versa_string &__str, size_type __pos2, size_type __n2) β€” swap characters out for a value from another string
  • void reserve (size_type __res_arg=0) β€” try to preallocate enough memory for the number of characters you asked for 🫢
  • void resize (size_type __n) β€” resize the string to the number of characters you want
  • void resize (size_type __n, _CharT __c) β€” same thing, and you get to say what character fills the new space
  • size_type rfind (_CharT __c, size_type __pos=npos) const noexcept β€” find the last position of a character πŸ”Ž
  • size_type rfind (const __versa_string &__str, size_type __pos=npos) const noexcept β€” find the last position of a string
  • size_type rfind (const _CharT *__s, size_type __pos, size_type __n) const β€” find the last position of a C substring
  • size_type rfind (const _CharT *__s, size_type __pos=npos) const β€” find the last position of a C string
  • void shrink_to_fit () noexcept β€” a non-binding request to bring capacity() down to size() (she's asking politely, she can't force it, okay?)
  • size_type size () const noexcept β€” how many characters are in the string, not counting any null-termination πŸ’―
  • __versa_string substr (size_type __pos=0, size_type __n=npos) const β€” grab yourself a substring
  • void swap (__versa_string &__s) noexcept β€” trade contents with another string, mutual, consensual, iconic

πŸ’– Static Public Attributes πŸ’–

  • static const size_type npos β€” the value all these member functions hand back when they simply could not do the thing 😭 it's the "no" of return values

🌈 Detailed Description 🌈

template<typename _CharT, typename _Traits, typename _Alloc, template<
    typename, typename, typename > class _Base>
    class __gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base >

Template class __versa_string.

Data structure managing sequences of characters and character-like objects. that's literally the whole vibe β€” it holds your characters, in order, and it's so good at it πŸ’…


πŸŽ€ Constructor & Destructor Documentation πŸŽ€

πŸ’– Construct an empty string

template<typename _CharT, typename _Traits, typename _Alloc, template<
    typename, typename, typename > class _Base> __gnu_cxx::__versa_string<
    _CharT, _Traits, _Alloc, _Base >::__versa_string (const _Alloc & __a =
    _Alloc()) [inline],  [explicit],  [noexcept]

Build an empty string using allocator a. 🫧

Referenced by compare(), compare(), and __gnu_cxx::__versa_string< char >::substr().

πŸ¦‹ Copy constructor

template<typename _CharT, typename _Traits, typename _Alloc, template<
    typename, typename, typename > class _Base> __gnu_cxx::__versa_string<
    _CharT, _Traits, _Alloc, _Base >::__versa_string (const __versa_string<
    _CharT, _Traits, _Alloc, _Base > & __str) [inline]

Construct a string that's a copy of the value of __str.

Parameters

  • __str β€” Source string.

🧚 Move constructor

template<typename _CharT, typename _Traits, typename _Alloc, template<
    typename, typename, typename > class _Base> __gnu_cxx::__versa_string<
    _CharT, _Traits, _Alloc, _Base >::__versa_string (__versa_string<
    _CharT, _Traits, _Alloc, _Base > && __str) [inline],  [noexcept]

String move constructor, and yes she's noexcept, she's fast, she's that girl ✨

Parameters

  • __str β€” Source string.

The brand-new string contains the exact contents of __str. After that, the contents of __str are a valid, but unspecified string. πŸ‘€ translation: it's alive and legal, but don't go assuming what's inside it now.

🌸 Construct from an initializer list

template<typename _CharT, typename _Traits, typename _Alloc, template<
    typename, typename, typename > class _Base> __gnu_cxx::__versa_string<
    _CharT, _Traits, _Alloc, _Base >::__versa_string (std::initializer_list<
    _CharT > __l, const _Alloc & __a = _Alloc()) [inline]

Build a string straight from an initializer list, slay πŸ’…

Parameters

  • __l β€” std::initializer_list of characters.
  • __a β€” Allocator to use (default is default allocator).

πŸŽ€ Construct as a copy of a substring

template<typename _CharT, typename _Traits, typename _Alloc, template<
    typename, typename, typename > class _Base> __gnu_cxx::__versa_string<
    _CharT, _Traits, _Alloc, _Base >::__versa_string (const __versa_string<
    _CharT, _Traits, _Alloc, _Base > & __str, size_type __pos, size_type __n
    = npos) [inline]

Construct a string as a copy of a substring. πŸ“

Parameters

  • __str β€” Source string.
  • __pos β€” Index of first character to copy from.
  • __n β€” Number of characters to copy (default remainder).

🌈 Construct as a copy of a substring, with an allocator

template<typename _CharT, typename _Traits, typename _Alloc, template<
    typename, typename, typename > class _Base> __gnu_cxx::__versa_string<
    _CharT, _Traits, _Alloc, _Base >::__versa_string (const __versa_string<
    _CharT, _Traits, _Alloc, _Base > & __str, size_type __pos, size_type
    __n, const _Alloc & __a) [inline]

Same deal β€” copy of a substring β€” but you also pick the allocator.

Parameters

  • __str β€” Source string.
  • __pos β€” Index of first character to copy from.
  • __n β€” Number of characters to copy.
  • __a β€” Allocator to use.

πŸ¦‹ Construct from a character array

template<typename _CharT, typename _Traits, typename _Alloc, template<
    typename, typename, typename > class _Base> __gnu_cxx::__versa_string<
    _CharT, _Traits, _Alloc, _Base >::__versa_string (const _CharT * __s,
    size_type __n, const _Alloc & __a = _Alloc()) [inline]

Construct a string initialized by a character array.

Parameters

  • __s β€” Source character array.
  • __n β€” Number of characters to copy.
  • __a β€” Allocator to use (default is default allocator).
⚠️ NB: __s must have at least __n characters, and '\0' has no special meaning here. None. Zero. She does not care about your null terminator in this constructor, bestie. πŸ’€

πŸ’œ Construct as a copy of a C string

template<typename _CharT, typename _Traits, typename _Alloc, template<
    typename, typename, typename > class _Base> __gnu_cxx::__versa_string<
    _CharT, _Traits, _Alloc, _Base >::__versa_string (const _CharT * __s,
    const _Alloc & __a = _Alloc()) [inline]

Construct a string as a copy of a C string.

Parameters

  • __s β€” Source C string.
  • __a β€” Allocator to use (default is default allocator).

✨ Construct as multiple characters

template<typename _CharT, typename _Traits, typename _Alloc, template<
    typename, typename, typename > class _Base> __gnu_cxx::__versa_string<
    _CharT, _Traits, _Alloc, _Base >::__versa_string (size_type __n, _CharT
    __c, const _Alloc & __a = _Alloc()) [inline]

Construct a string as multiple characters β€” same character, __n times. It's giving pattern, it's giving repetition, it's giving iconic πŸŽ€

Parameters

  • __n β€” Number of characters.
  • __c β€” Character to use.
  • __a β€” Allocator to use (default is default allocator).

🧡 Construct as a copy of a range

template<typename _CharT, typename _Traits, typename _Alloc, template<
    typename, typename, typename > class _Base> template<class
    _InputIterator, typename = std::_RequireInputIter<_InputIterator>>
    __gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base
    >::__versa_string (_InputIterator __beg, _InputIterator __end, const
    _Alloc & __a = _Alloc()) [inline]

Construct a string as a copy of a range. 🫢

Parameters

  • __beg β€” Start of range.
  • __end β€” End of range.
  • __a β€” Allocator to use (default is default allocator).

πŸ’€ Destructor

template<typename _CharT, typename _Traits, typename _Alloc, template<
    typename, typename, typename > class _Base> __gnu_cxx::__versa_string<
    _CharT, _Traits, _Alloc, _Base >::~__versa_string () [inline],
    [noexcept]

Destroy the string instance. Say bye, she's noexcept about it, no drama, clean exit 🌈


πŸ¦‹ Member Function Documentation πŸ¦‹

πŸ’« append β€” a range of characters

template<typename _CharT, typename _Traits, typename _Alloc, template<
    typename, typename, typename > class _Base> template<class
    _InputIterator, typename = std::_RequireInputIter<_InputIterator>>
    __versa_string & __gnu_cxx::__versa_string< _CharT, _Traits, _Alloc,
    _Base >::append (_InputIterator __first, _InputIterator __last) [inline]

Append a range of characters. πŸ’…

Parameters

  • __first β€” Iterator referencing the first character to append.
  • __last β€” Iterator marking the end of the range.

Returns

Reference to this string.

Appends characters in the range [first,last) to this string. note the brackets, bestie β€” first is in, last is out, that's just how ranges roll.

πŸŽ€ append β€” a whole string

template<typename _CharT, typename _Traits, typename _Alloc, template<
    typename, typename, typename > class _Base> __versa_string &
    __gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base >::append
    (const __versa_string< _CharT, _Traits, _Alloc, _Base > & __str)
    [inline]

Append a string to this string. Simple. Elegant. Ate. πŸ”₯

Parameters

  • __str β€” The string to append.

Returns

Reference to this string.

Referenced by __gnu_cxx::__versa_string< char >::append(), std::getline(), __gnu_cxx::operator+(), __gnu_cxx::operator+(), __gnu_cxx::operator+(), __gnu_cxx::__versa_string< char >::operator+=(), __gnu_cxx::__versa_string< char >::operator+=(), __gnu_cxx::__versa_string< char >::operator+=(), and resize().

🌸 append β€” a substring

template<typename _CharT, typename _Traits, typename _Alloc, template<
    typename, typename, typename > class _Base> __versa_string &
    __gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base >::append
    (const __versa_string< _CharT, _Traits, _Alloc, _Base > & __str,
    size_type __pos, size_type __n) [inline]

Append a substring. Just a lil slice of a string, as a treat πŸ“

Parameters

  • __str β€” The string to append.
  • __pos β€” Index of the first character of str to append.
  • __n β€” The number of characters to append.

Returns

Reference to this string.

Exceptions

  • std::out_of_range if pos is not a valid index. 😭 watch that __pos, bestie, she will not let it slide.

This function appends __n characters from __str starting at __pos to this string. If __n is is larger than the number of available characters in __str, the remainder of __str is appended. πŸ’« (yes, the docs really do say "is is" β€” we keep the lore, we don't touch the lore)

append β€” the "and one more thing" queen πŸ’…

template<typename _CharT, typename _Traits, typename _Alloc, template<typename, typename, typename> class _Base>
__versa_string & __gnu_cxx::__versa_string<_CharT, _Traits, _Alloc, _Base>::append(const _CharT * __s) [inline]

Append a C string. Bestie just slides a whole C string onto the end, no big deal.

  • Parameters
    • __s β€” the C string you're appending.
  • Returns β€” a reference to this string, so you can keep chaining like the main character you are.

append(const _CharT * __s, size_type __n) β€” only part of the C string πŸŽ€

template<typename _CharT, typename _Traits, typename _Alloc, template<typename, typename, typename> class _Base>
__versa_string & __gnu_cxx::__versa_string<_CharT, _Traits, _Alloc, _Base>::append(const _CharT * __s, size_type __n) [inline]

Append a C substring.

  • Parameters
    • __s β€” the C string you're appending.
    • __n β€” how many characters to append.
  • Returns β€” a reference to this string. πŸ’–

append(size_type __n, _CharT __c) β€” copy-paste that character 🌸

template<typename _CharT, typename _Traits, typename _Alloc, template<typename, typename, typename> class _Base>
__versa_string & __gnu_cxx::__versa_string<_CharT, _Traits, _Alloc, _Base>::append(size_type __n, _CharT __c) [inline]

Append multiple characters.

  • Parameters
    • __n β€” how many characters to append.
    • __c β€” which character to use.
  • Returns β€” a reference to this string.

Appends n copies of c to this string. Yes, it's literally just spam but make it ✨intentional✨.


append(std::initializer_list< _CharT > __l) β€” brace-init girls rise πŸ¦‹

template<typename _CharT, typename _Traits, typename _Alloc, template<typename, typename, typename> class _Base>
__versa_string & __gnu_cxx::__versa_string<_CharT, _Traits, _Alloc, _Base>::append(std::initializer_list< _CharT > __l) [inline]

Append an initializer_list of characters.

  • Parameters
    • __l β€” the initializer_list of characters to append.
  • Returns β€” a reference to this string.

the assign era 🫢

assign(__versa_string && __str) β€” move it, don't copy it

template<typename _CharT, typename _Traits, typename _Alloc, template<typename, typename, typename> class _Base>
__versa_string & __gnu_cxx::__versa_string<_CharT, _Traits, _Alloc, _Base>::assign(__versa_string<_CharT, _Traits, _Alloc, _Base> && __str) [inline], [noexcept]

Set value to contents of another string.

  • Parameters
    • __str β€” the source string to use.
  • Returns β€” a reference to this string.

This function sets this string to the exact contents of __str. And listen β€” __str is a valid, but unspecified string after this. So like, it still exists, it's just not giving anything anymore. Don't come for it. πŸ’€


assign(_InputIterator __first, _InputIterator __last) β€” iterator range vibes 🌈

template<typename _CharT, typename _Traits, typename _Alloc, template<typename, typename, typename> class _Base>
template<class _InputIterator, typename = std::_RequireInputIter<_InputIterator>>
__versa_string & __gnu_cxx::__versa_string<_CharT, _Traits, _Alloc, _Base>::assign(_InputIterator __first, _InputIterator __last) [inline]

Set value to a range of characters.

  • Parameters
    • __first β€” iterator referencing the first character to append.
    • __last β€” iterator marking the end of the range.
  • Returns β€” a reference to this string.

Sets the value of the string to the characters in the range [first,last). Note the half-open bracket energy β€” first is in, last is not. Periodt.


assign(const __versa_string & __str) β€” the classic copy πŸ’œ

template<typename _CharT, typename _Traits, typename _Alloc, template<typename, typename, typename> class _Base>
__versa_string & __gnu_cxx::__versa_string<_CharT, _Traits, _Alloc, _Base>::assign(const __versa_string<_CharT, _Traits, _Alloc, _Base> & __str) [inline]

Set value to contents of another string.

  • Parameters
    • __str β€” the source string to use.
  • Returns β€” a reference to this string.
Referenced by __gnu_cxx::__versa_string< char >::assign(), __gnu_cxx::__versa_string< char >::operator=(), __gnu_cxx::__versa_string< char >::operator=(), __gnu_cxx::__versa_string< char >::operator=(), and __gnu_cxx::__versa_string< char >::operator=(). So basically everyone in the group chat calls on her. 😭

assign(const __versa_string & __str, size_type __pos, size_type __n) β€” the glow-up slice ✨

template<typename _CharT, typename _Traits, typename _Alloc, template<typename, typename, typename> class _Base>
__versa_string & __gnu_cxx::__versa_string<_CharT, _Traits, _Alloc, _Base>::assign(const __versa_string<_CharT, _Traits, _Alloc, _Base> & __str, size_type __pos, size_type __n) [inline]

Set value to a substring of a string.

  • Parameters
    • __str β€” the string to use.
    • __pos β€” index of the first character of str.
    • __n β€” number of characters to use.
  • Returns β€” a reference to this string.
  • Exceptions
    • std::out_of_range if __pos is not a valid index.

This function sets this string to the substring of __str consisting of __n characters at __pos. And if __n is larger than the number of available characters in __str, the remainder of __str is used. No drama, it just takes what's left. πŸŽ€


assign(const _CharT * __s) β€” straight from C string town

template<typename _CharT, typename _Traits, typename _Alloc, template<typename, typename, typename> class _Base>
__versa_string & __gnu_cxx::__versa_string<_CharT, _Traits, _Alloc, _Base>::assign(const _CharT * __s) [inline]

Set value to contents of a C string.

  • Parameters
    • __s β€” the C string to use.
  • Returns β€” a reference to this string.

This function sets the value of this string to the value of __s. The data is copied, so there is no dependence on __s once the function returns. So you can go ahead and free __s, she already moved on. πŸ’…


assign(const _CharT * __s, size_type __n) β€” C substring, but for assigning πŸ“

template<typename _CharT, typename _Traits, typename _Alloc, template<typename, typename, typename> class _Base>
__versa_string & __gnu_cxx::__versa_string<_CharT, _Traits, _Alloc, _Base>::assign(const _CharT * __s, size_type __n) [inline]

Set value to a C substring.

  • Parameters
    • __s β€” the C string to use.
    • __n β€” number of characters to use.
  • Returns β€” a reference to this string.

This function sets the value of this string to the first __n characters of __s. If __n is larger than the number of available characters in __s, the remainder of __s is used. Same "take what you can get" rule as above, she's consistent. 🫢


assign(size_type __n, _CharT __c) β€” fill mode activated πŸ”₯

template<typename _CharT, typename _Traits, typename _Alloc, template<typename, typename, typename> class _Base>
__versa_string & __gnu_cxx::__versa_string<_CharT, _Traits, _Alloc, _Base>::assign(size_type __n, _CharT __c) [inline]

Set value to multiple characters.

  • Parameters
    • __n β€” length of the resulting string.
    • __c β€” the character to use.
  • Returns β€” a reference to this string.

This function sets the value of this string to __n copies of character __c. It's giving "I only know one letter and I'm committing to it."


assign(std::initializer_list< _CharT > __l) β€” brace list bestie πŸŽ€

template<typename _CharT, typename _Traits, typename _Alloc, template<typename, typename, typename> class _Base>
__versa_string & __gnu_cxx::__versa_string<_CharT, _Traits, _Alloc, _Base>::assign(std::initializer_list< _CharT > __l) [inline]

Set value to an initializer_list of characters.

  • Parameters
    • __l β€” the initializer_list of characters to assign.
  • Returns β€” a reference to this string.

at β€” the safe one, lowkey the responsible sibling 🌸

at(size_type __n) β€” read/write access

template<typename _CharT, typename _Traits, typename _Alloc, template<typename, typename, typename> class _Base>
reference __gnu_cxx::__versa_string<_CharT, _Traits, _Alloc, _Base>::at(size_type __n) [inline]

Provides access to the data contained in the string.

  • Parameters
    • __n β€” the index of the character to access.
  • Returns β€” a read/write reference to the character.
  • Exceptions
    • std::out_of_range if __n is an invalid index.

This function provides for safer data access. The parameter is first checked that it is in the range of the string. The function throws out_of_range if the check fails. Success results in unsharing the string. So she's safe and she's independent now. Iconic.


at(size_type __n) const β€” read-only queen πŸ‘‘

template<typename _CharT, typename _Traits, typename _Alloc, template<typename, typename, typename> class _Base>
const_reference __gnu_cxx::__versa_string<_CharT, _Traits, _Alloc, _Base>::at(size_type __n) const [inline]

Provides access to the data contained in the string.

  • Parameters
    • __n β€” the index of the character to access.
  • Returns β€” a read-only (const) reference to the character.
  • Exceptions
    • std::out_of_range if __n is an invalid index.

This function provides for safer data access. The parameter is first checked that it is in the range of the string. The function throws out_of_range if the check fails. Same energy, just no editing privileges. πŸ™ˆ


back() const β€” peek at the last one, no touching

template<typename _CharT, typename _Traits, typename _Alloc, template<typename, typename, typename> class _Base>
const_reference __gnu_cxx::__versa_string<_CharT, _Traits, _Alloc, _Base>::back() const [inline], [noexcept]

Returns a read-only (constant) reference to the data at the last element of the string. Just looking. πŸ‘€


back() β€” okay now you can touch it

template<typename _CharT, typename _Traits, typename _Alloc, template<typename, typename, typename> class _Base>
reference __gnu_cxx::__versa_string<_CharT, _Traits, _Alloc, _Base>::back() [inline], [noexcept]

Returns a read/write reference to the data at the last element of the string.


begin() const β€” the first character, but make it const

template<typename _CharT, typename _Traits, typename _Alloc, template<typename, typename, typename> class _Base>
const_iterator __gnu_cxx::__versa_string<_CharT, _Traits, _Alloc, _Base>::begin() const [inline], [noexcept]

Returns a read-only (constant) iterator that points to the first character in the string.


begin() β€” the first character, full access πŸ’…

template<typename _CharT, typename _Traits, typename _Alloc, template<typename, typename, typename> class _Base>
iterator __gnu_cxx::__versa_string<_CharT, _Traits, _Alloc, _Base>::begin() [inline], [noexcept]

Returns a read/write iterator that points to the first character in the string. Unshares the string.

Referenced by __gnu_cxx::__versa_string< char >::crend(), __gnu_cxx::__versa_string< char >::rend(), and __gnu_cxx::__versa_string< char >::rend(). Reverse iterators? Yeah, they're built off this one. iykyk.

c_str() const β€” the raw pointer moment ⭐

template<typename _CharT, typename _Traits, typename _Alloc, template<typename, typename, typename> class _Base>
const _CharT * __gnu_cxx::__versa_string<_CharT, _Traits, _Alloc, _Base>::c_str() const [inline], [noexcept]

Return const pointer to null-terminated contents. This is a handle to internal data. Do not modify or dire things may happen. 🚨

Fr fr, that's a direct quote from the source. Not me exaggerating. Do NOT modify it. Dire. Things. May. Happen. 😭

capacity() const β€” how much room before the reallocation jumpscare

template<typename _CharT, typename _Traits, typename _Alloc, template<typename, typename, typename> class _Base>
size_type __gnu_cxx::__versa_string<_CharT, _Traits, _Alloc, _Base>::capacity() const [inline], [noexcept]

Returns the total number of characters that the string can hold before needing to allocate more memory.

Referenced by __gnu_cxx::__versa_string< char >::push_back(), and __gnu_cxx::__versa_string< char >::shrink_to_fit(). She's the number everyone checks before deciding whether to spend money. πŸ’Έ

cbegin() const β€” const iterator, but make it fashion

template<typename _CharT, typename _Traits, typename _Alloc, template<typename, typename, typename> class _Base>
const_iterator __gnu_cxx::__versa_string<_CharT, _Traits, _Alloc, _Base>::cbegin() const [inline], [noexcept]

Returns a read-only (constant) iterator that points to the first character in the string.


cend() const β€” one past the last one, still const

template<typename _CharT, typename _Traits, typename _Alloc, template<typename, typename, typename> class _Base>
const_iterator __gnu_cxx::__versa_string<_CharT, _Traits, _Alloc, _Base>::cend() const [inline], [noexcept]

Returns a read-only (constant) iterator that points one past the last character in the string. (Yes, one past. That's how the range works. [begin, end). We been knew.) πŸ¦‹


clear() β€” the reset button 🧚

template<typename _CharT, typename _Traits, typename _Alloc, template<typename, typename, typename> class _Base>
void __gnu_cxx::__versa_string<_CharT, _Traits, _Alloc, _Base>::clear() [inline], [noexcept]

Erases the string, making it empty. Clean slate, fresh start, we love a rebirth arc. ✨


🌸 compare β€” the whole entire compare family, bestie

Ok so compare has six overloads and they're all just "who's first in the alphabet" energy. Let's go one by one, no skipping. πŸ’…


πŸ¦‹ compare to another __versa_string

template<typename _CharT, typename _Traits, typename _Alloc, template<
    typename, typename, typename > class _Base> int
    __gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base >::compare
    (const __versa_string< _CharT, _Traits, _Alloc, _Base > & __str) const
    [inline]

Compare to a string.

  • Parameters
    • __str β€” the string you're comparing against, queen.
  • Returns
    • Integer < 0, 0, or > 0. That's it, that's the whole vibe check.

So here's the tea β˜•: you get an integer < 0 if this string is ordered before __str, 0 if their values are equivalent (twins, basically), or > 0 if this string is ordered after __str. It figures out the effective length rlen of the strings to compare as the smallest of size() and str.size(). Then it compares the two strings by calling traits::compare(data(), str.data(),rlen). If the result of the comparison is nonzero it returns it, otherwise the shorter one is ordered first. Short king behavior, honestly. πŸ‘‘

Referenced by __gnu_cxx::operator<(), __gnu_cxx::operator<(), __gnu_cxx::operator<(), __gnu_cxx::operator<(), __gnu_cxx::operator<=(), __gnu_cxx::operator<=(), __gnu_cxx::operator<=(), __gnu_cxx::operator>(), __gnu_cxx::operator>(), __gnu_cxx::operator>(), __gnu_cxx::operator>=(), __gnu_cxx::operator>=(), and __gnu_cxx::operator>=(). (yes bestie, that many. they're all obsessed with it. πŸ’–)


🌈 compare to a C string

template<typename _CharT, typename _Traits, typename _Alloc, template<
    typename, typename, typename > class _Base> int
    __gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base >::compare
    (const _CharT * __s) const

Compare to a C string.

  • Parameters
    • __s β€” the C string to compare against.
  • Returns
    • Integer < 0, 0, or > 0.

Returns an integer < 0 if this string is ordered before __s, 0 if their values are equivalent, or > 0 if this string is ordered after __s. It determines the effective length rlen of the strings to compare as the smallest of size() and the length of a string constructed from __s. Then it compares the two strings by calling traits::compare(data(),s,rlen). If the result of the comparison is nonzero it returns it, otherwise the shorter one is ordered first. ✨

References std::min(), and size().


πŸŽ€ compare a substring to a string

template<typename _CharT, typename _Traits, typename _Alloc, template<
    typename, typename, typename > class _Base> int
    __gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base >::compare
    (size_type __pos, size_type __n, const __versa_string< _CharT, _Traits,
    _Alloc, _Base > & __str) const

Compare substring to a string.

  • Parameters
    • __pos β€” index of first character of substring.
    • __n β€” number of characters in substring.
    • __str β€” string to compare against.
  • Returns
    • Integer < 0, 0, or > 0.

Form the substring of this string from the __n characters starting at __pos. Returns an integer < 0 if the substring is ordered before __str, 0 if their values are equivalent, or > 0 if the substring is ordered after __str. Determines the effective length rlen of the strings to compare as the smallest of the length of the substring and __str.size(). The function then compares the two strings by calling traits::compare(substring.data(),str.data(),rlen). If the result of the comparison is nonzero returns it, otherwise the shorter one is ordered first. 🫢

References __versa_string(), data(), std::min(), and size().


πŸ’œ compare a substring to a C string

template<typename _CharT, typename _Traits, typename _Alloc, template<
    typename, typename, typename > class _Base> int
    __gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base >::compare
    (size_type __pos, size_type __n1, const _CharT * __s) const

Compare substring to a C string.

  • Parameters
    • __pos β€” index of first character of substring.
    • __n1 β€” number of characters in substring.
    • __s β€” C string to compare against.
  • Returns
    • Integer < 0, 0, or > 0.

Form the substring of this string from the __n1 characters starting at __pos. Returns an integer < 0 if the substring is ordered before __s, 0 if their values are equivalent, or > 0 if the substring is ordered after __s. Determines the effective length rlen of the strings to compare as the smallest of the length of the substring and the length of a string constructed from __s. The function then compares the two string by calling traits::compare(substring.data(),s,rlen). If the result of the comparison is nonzero returns it, otherwise the shorter one is ordered first. 😌

References std::min().


πŸ“ compare a substring against a character array

template<typename _CharT, typename _Traits, typename _Alloc, template<
    typename, typename, typename > class _Base> int
    __gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base >::compare
    (size_type __pos, size_type __n1, const _CharT * __s, size_type __n2)
    const

Compare substring against a character array.

  • Parameters
    • __pos β€” index of first character of substring.
    • __n1 β€” number of characters in substring.
    • __s β€” character array to compare against.
    • __n2 β€” number of characters of s.
  • Returns
    • Integer < 0, 0, or > 0.

Form the substring of this string from the __n1 characters starting at __pos. Form a string from the first __n2 characters of __s. Returns an integer < 0 if this substring is ordered before the string from __s, 0 if their values are equivalent, or > 0 if this substring is ordered after the string from __s. Determines the effective length rlen of the strings to compare as the smallest of the length of the substring and __n2. The function then compares the two strings by calling traits::compare(substring.data(),__s,rlen). If the result of the comparison is nonzero returns it, otherwise the shorter one is ordered first. πŸ”₯

NB: __s must have at least n2 characters, \0 has no special meaning. (the null terminator is NOT the main character here, bestie, it gets no special treatment πŸ™ˆ)

References std::min().


πŸ’– compare a substring to a substring

template<typename _CharT, typename _Traits, typename _Alloc, template<
    typename, typename, typename > class _Base> int
    __gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base >::compare
    (size_type __pos1, size_type __n1, const __versa_string< _CharT,
    _Traits, _Alloc, _Base > & __str, size_type __pos2, size_type __n2)
    const

Compare substring to a substring.

  • Parameters
    • __pos1 β€” index of first character of substring.
    • __n1 β€” number of characters in substring.
    • __str β€” string to compare against.
    • __pos2 β€” index of first character of substring of str.
    • __n2 β€” number of characters in substring of str.
  • Returns
    • Integer < 0, 0, or > 0.

Form the substring of this string from the __n1 characters starting at __pos1. Form the substring of __str from the __n2 characters starting at __pos2. Returns an integer < 0 if this substring is ordered before the substring of __str, 0 if their values are equivalent, or > 0 if this substring is ordered after the substring of __str. Determines the effective length rlen of the strings to compare as the smallest of the lengths of the substrings. The function then compares the two strings by calling traits::compare(substring.data(),str.substr(pos2,n2).data(),rlen). If the result of the comparison is nonzero returns it, otherwise the shorter one is ordered first. ✨

References __versa_string(), data(), and std::min().


πŸ“‹ copy β€” putting a substring into a C string

template<typename _CharT, typename _Traits, typename _Alloc, template<
    typename, typename, typename > class _Base> __versa_string< _CharT,
    _Traits, _Alloc, _Base >::size_type __gnu_cxx::__versa_string< _CharT,
    _Traits, _Alloc, _Base >::copy (_CharT * __s, size_type __n, size_type
    __pos = 0) const

Copy substring into C string.

  • Parameters
    • __s β€” C string to copy value into.
    • __n β€” number of characters to copy.
    • __pos β€” index of first character to copy.
  • Returns
    • Number of characters actually copied
  • Exceptions
    • std::out_of_range β€” if pos > size().

Copies up to __n characters starting at __pos into the C string s. If __pos is greater than size(), out_of_range is thrown. So like, if you're trying to grab characters from a spot that doesn't even exist, it's gonna throw hands. πŸ’€

Note the default: __pos = 0. iykyk.


πŸ”„ crbegin β€” reverse iterator, but make it const

template<typename _CharT, typename _Traits, typename _Alloc, template<
    typename, typename, typename > class _Base> const_reverse_iterator
    __gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base >::crbegin ()
    const [inline],  [noexcept]

Returns a read-only (constant) reverse iterator that points to the last character in the string. Iteration is done in reverse element order. So you're walking the string backwards, no editing allowed, purely for the vibes. πŸ¦‹


πŸ”„ crend β€” reverse iterator, const, the end

template<typename _CharT, typename _Traits, typename _Alloc, template<
    typename, typename, typename > class _Base> const_reverse_iterator
    __gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base >::crend ()
    const [inline],  [noexcept]

Returns a read-only (constant) reverse iterator that points to one before the first character in the string. Iteration is done in reverse element order. It's the "you've reached the end, go home" iterator. πŸŒ™


πŸ‘€ data β€” the raw pointer moment

template<typename _CharT, typename _Traits, typename _Alloc, template<
    typename, typename, typename > class _Base> const _CharT *
    __gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base >::data ()
    const [inline],  [noexcept]

Return const pointer to contents.

This is a handle to internal data. Do not modify or dire things may happen. 😭

fr fr bestie, that's the actual warning. it's giving "touch grass, not my internal buffer". undefined behavior said hi.

Referenced by compare(), compare(), __gnu_cxx::__versa_string< char >::compare(), __gnu_cxx::__versa_string< char >::find(), __gnu_cxx::__versa_string< char >::find_first_not_of(), __gnu_cxx::__versa_string< char >::find_first_of(), __gnu_cxx::__versa_string< char >::find_last_of(), __gnu_cxx::operator==(), and __gnu_cxx::operator==().


🫧 empty β€” is it giving nothing

template<typename _CharT, typename _Traits, typename _Alloc, template<
    typename, typename, typename > class _Base> bool
    __gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base >::empty ()
    const [inline],  [nodiscard],  [noexcept]

Returns true if the string is empty. Equivalent to *this == "". That's the whole thing. <nodiscard> is there because ignoring this return value is a crime against humanity. πŸ’…


🏁 end β€” const version

template<typename _CharT, typename _Traits, typename _Alloc, template<
    typename, typename, typename > class _Base> const_iterator
    __gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base >::end ()
    const [inline],  [noexcept]

Returns a read-only (constant) iterator that points one past the last character in the string. Classic one-past-the-end energy, she's iconic for that. ⭐


🏁 end β€” the read/write one

template<typename _CharT, typename _Traits, typename _Alloc, template<
    typename, typename, typename > class _Base> iterator
    __gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base >::end ()
    [inline],  [noexcept]

Returns a read/write iterator that points one past the last character in the string. Unshares the string. (yes, calling this one has side effects on the internal sharing situation, not me making that up, it's literally in the docs 🫠)

Referenced by __gnu_cxx::__versa_string< char >::crbegin(), __gnu_cxx::__versa_string< char >::rbegin(), and __gnu_cxx::__versa_string< char >::rbegin().


βœ‚οΈ erase β€” remove a range of characters

template<typename _CharT, typename _Traits, typename _Alloc, template<
    typename, typename, typename > class _Base> iterator
    __gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base >::erase
    (const_iterator __first, const_iterator __last) [inline]

Remove a range of characters.

  • Parameters
    • __first β€” iterator referencing the first character to remove.
    • __last β€” iterator referencing the end of the range.
  • Returns
    • Iterator referencing location of first after removal.

Removes the characters in the range [first,last) from this string. The value of the string doesn't change if an error is thrown. πŸ›Ÿ Strong exception guarantee behavior, she's safe and she's proud of it.


  • erase(const_iterator __position) β€” yeet exactly one character πŸ’…
template<typename _CharT, typename _Traits, typename _Alloc, template<
    typename, typename, typename > class _Base> iterator
    __gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base >::erase
    (const_iterator __position) [inline]

okay so bestie, this one is the surgical version β€” it removes one character, not a whole range. Sneaky little single-target delete. 🎯

  • __position β€” an iterator pointing at the character you want gone.

Returns: an iterator referencing the same location, but after the removal. So like, the spot where that character used to be is now occupied by whatever came next. Slay.

It removes the character at __position from this string. And the best part? The value of the string doesn't change if an error is thrown. No half-deleted chaos, no messy vibes. If it blows up, your string is untouched. 🫢


  • erase(size_type __pos = 0, size_type __n = npos) β€” the big sweep 🧹✨
template<typename _CharT, typename _Traits, typename _Alloc, template<
    typename, typename, typename > class _Base> __versa_string &
    __gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base >::erase
    (size_type __pos = 0, size_type __n = npos) [inline]
  • __pos β€” index of the first character to remove (default 0).
  • __n β€” how many characters to remove (default is the whole remainder, i.e. npos).

Returns: a reference to this string. Chainable. Iconic. πŸ’–

Exceptions:

  • std::out_of_range if __pos is beyond the end of this string.

So what's happening: it removes __n characters from this string starting at __pos, and the length of the string goes down by __n. If there are fewer than __n characters left to remove, then the remainder of the string just gets truncated β€” no drama, no error. But if __p is beyond the end of the string, out_of_range gets thrown. And once again, the golden rule: the value of the string doesn't change if an error is thrown. Periodt. πŸ’…

Referenced by std::getline().

  • find(_CharT __c, size_type __pos = 0) const β€” where my little character at? πŸ”
template<typename _CharT, typename _Traits, typename _Alloc, template<
    typename, typename, typename > class _Base> __versa_string< _CharT,
    _Traits, _Alloc, _Base >::size_type __gnu_cxx::__versa_string< _CharT,
    _Traits, _Alloc, _Base >::find (_CharT __c, size_type __pos = 0) const
    [noexcept]
  • __c β€” the character to locate.
  • __pos β€” index of the character to search from (default 0).

Returns: the index of the first occurrence.

Starting from __pos, it searches forward for __c within this string. Found it? Returns the index where it was found. Not found? Returns npos. That's the whole story, no notes. ✨

References npos, and size().

  • find(const __versa_string< _CharT, _Traits, _Alloc, _Base > & __str, size_type __pos = 0) const β€” but make it a whole string πŸŽ€
template<typename _CharT, typename _Traits, typename _Alloc, template<
    typename, typename, typename > class _Base> size_type
    __gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base >::find (const
    __versa_string< _CharT, _Traits, _Alloc, _Base > & __str, size_type
    __pos = 0) const [inline],  [noexcept]
  • __str β€” the string to locate.
  • __pos β€” index of the character to search from (default 0).

Returns: the index of the start of the first occurrence.

Starting from __pos, searches forward for the value of __str within this string. If found, it returns the index where it begins β€” note, the beginning, not the end, we're not chaotic here. If not found, returns npos. 🌸


  • find(const _CharT * __s, size_type __pos, size_type __n) const β€” C substring hunt, limited edition πŸ¦‹
template<typename _CharT, typename _Traits, typename _Alloc, template<
    typename, typename, typename > class _Base> __versa_string< _CharT,
    _Traits, _Alloc, _Base >::size_type __gnu_cxx::__versa_string< _CharT,
    _Traits, _Alloc, _Base >::find (const _CharT * __s, size_type __pos,
    size_type __n) const
  • __s β€” the C string to locate.
  • __pos β€” index of the character to search from.
  • __n β€” number of characters from __s to search for.

Returns: the index of the start of the first occurrence.

Starting from __pos, searches forward for the first __n characters in __s within this string. If found, returns the index where it begins. If not found, returns npos. πŸ’«

References npos, and size().
Referenced by __gnu_cxx::__versa_string< char >::find(), __gnu_cxx::__versa_string< char >::find(), and __gnu_cxx::__versa_string< char >::find_first_of().

  • find(const _CharT * __s, size_type __pos = 0) const β€” the chill C-string version πŸ“
template<typename _CharT, typename _Traits, typename _Alloc, template<
    typename, typename, typename > class _Base> size_type
    __gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base >::find (const
    _CharT * __s, size_type __pos = 0) const [inline]
  • __s β€” the C string to locate.
  • __pos β€” index of the character to search from (default 0).

Returns: the index of the start of the first occurrence.

Starting from __pos, searches forward for the value of __s within this string. Found it? Index of where it begins. Didn't find it? npos. That's it bestie, no __n here, we're taking the whole string. 🌈


  • find_first_not_of(_CharT __c, size_type __pos = 0) const β€” find me literally anyone else πŸ™ˆ
template<typename _CharT, typename _Traits, typename _Alloc, template<
    typename, typename, typename > class _Base> __versa_string< _CharT,
    _Traits, _Alloc, _Base >::size_type __gnu_cxx::__versa_string< _CharT,
    _Traits, _Alloc, _Base >::find_first_not_of (_CharT __c, size_type __pos
    = 0) const [noexcept]
  • __c β€” the character to avoid.
  • __pos β€” index of the character to search from (default 0).

Returns: the index of the first occurrence.

Starting from __pos, searches forward for a character that is not __c within this string. If it finds one, it returns the index where it was found. If literally every character is __c (or there's nothing left to check), it returns npos. πŸ’€

References npos, and size().

  • find_first_not_of(const __versa_string< _CharT, _Traits, _Alloc, _Base > & __str, size_type __pos = 0) const β€” not-any-of-these energy ✨
template<typename _CharT, typename _Traits, typename _Alloc, template<
    typename, typename, typename > class _Base> size_type
    __gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base
    >::find_first_not_of (const __versa_string< _CharT, _Traits, _Alloc,
    _Base > & __str, size_type __pos = 0) const [inline],  [noexcept]
  • __str β€” the string containing the characters to avoid.
  • __pos β€” index of the character to search from (default 0).

Returns: the index of the first occurrence.

Starting from __pos, searches forward for a character that is not contained in __str, inside this string. Found one? Returns its index. None? npos. Lowkey this is the "find me something new" function. 🧚

Referenced by __gnu_cxx::__versa_string< char >::find_first_not_of(), and __gnu_cxx::__versa_string< char >::find_first_not_of().

  • find_first_not_of(const _CharT * __s, size_type __pos, size_type __n) const β€” C substring, but make it avoidance πŸ’œ
template<typename _CharT, typename _Traits, typename _Alloc, template<
    typename, typename, typename > class _Base> __versa_string< _CharT,
    _Traits, _Alloc, _Base >::size_type __gnu_cxx::__versa_string< _CharT,
    _Traits, _Alloc, _Base >::find_first_not_of (const _CharT * __s,
    size_type __pos, size_type __n) const
  • __s β€” the C string containing the characters to avoid.
  • __pos β€” index of the character to search from.
  • __n β€” number of characters from s to consider.

Returns: the index of the first occurrence.

Starting from __pos, searches forward for a character that is not contained in the first __n characters of __s, within this string. If found, returns the index where it was found. If not found, returns npos. πŸŽ€

References npos, and size().

  • find_first_not_of(const _CharT * __s, size_type __pos = 0) const β€” the full C-string avoid list 🌸
template<typename _CharT, typename _Traits, typename _Alloc, template<
    typename, typename, typename > class _Base> size_type
    __gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base
    >::find_first_not_of (const _CharT * __s, size_type __pos = 0) const
    [inline]
  • __s β€” the C string containing the characters to avoid.
  • __pos β€” index of the character to search from (default 0).

Returns: the index of the first occurrence.

Starting from __pos, searches forward for a character not contained in __s within this string. Found it β†’ returns the index where it was found. Not found β†’ npos. Simple as. 🫢


  • find_first_of(_CharT __c, size_type __pos = 0) const β€” the little single-char one that's just find in a wig πŸ’…
template<typename _CharT, typename _Traits, typename _Alloc, template<
    typename, typename, typename > class _Base> size_type
    __gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base
    >::find_first_of (_CharT __c, size_type __pos = 0) const [inline],
    [noexcept]
  • __c β€” the character to locate.
  • __pos β€” index of the character to search from (default 0).

Returns: the index of the first occurrence.

Starting from __pos, searches forward for the character __c within this string. Found β†’ index of where it was found. Not found β†’ npos.

Note: equivalent to find(c, pos). Yes bestie, literally the same thing. We love a redundant glow-up. ✨

  • find_first_of(const __versa_string< _CharT, _Traits, _Alloc, _Base > & __str, size_type __pos = 0) const β€” any-of-these hunt πŸ”₯
template<typename _CharT, typename _Traits, typename _Alloc, template<
    typename, typename, typename > class _Base> size_type
    __gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base
    >::find_first_of (const __versa_string< _CharT, _Traits, _Alloc, _Base >
    & __str, size_type __pos = 0) const [inline],  [noexcept]
  • __str β€” the string containing the characters to locate.
  • __pos β€” index of the character to search from (default 0).

Returns: the index of the first occurrence.

Starting from __pos, searches forward for one of the characters of __str within this string. Any single one of them counts. Found β†’ index where it was found. Not found β†’ npos. 🌟

Referenced by __gnu_cxx::__versa_string< char >::find_first_of(), and __gnu_cxx::__versa_string< char >::find_first_of().

  • find_first_of(const _CharT * __s, size_type __pos, size_type __n) const β€” C substring, choose-your-fighter edition πŸ¦‹
template<typename _CharT, typename _Traits, typename _Alloc, template<
    typename, typename, typename > class _Base> __versa_string< _CharT,
    _Traits, _Alloc, _Base >::size_type __gnu_cxx::__versa_string< _CharT,
    _Traits, _Alloc, _Base >::find_first_of (const _CharT * __s, size_type
    __pos, size_type __n) const
  • __s β€” the string containing the characters to locate.
  • __pos β€” index of the character to search from.
  • __n β€” number of characters from s to search for.

Returns: the index of the first occurrence.

Starting from __pos, searches forward for one of the first __n characters of __s within this string. If found, returns the index where it was found. If not found, returns npos. πŸ’–

References npos, and size().

  • find_first_of(const _CharT * __s, size_type __pos = 0) const β€” full C-string, any character counts 🌈
template<typename _CharT, typename _Traits, typename _Alloc, template<
    typename, typename, typename > class _Base> size_type
    __gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base
    >::find_first_of (const _CharT * __s, size_type __pos = 0) const
    [inline]
  • __s β€” the string containing the characters to locate.
  • __pos β€” index of the character to search from (default 0).

Returns: the index of the first occurrence.

Starting from __pos, searches forward for one of the characters of __s within this string. Found β†’ the index where it was found. Not found β†’ npos. 🎯


  • find_last_not_of(_CharT __c, size_type __pos = npos) const β€” going backwards, avoiding the vibe πŸ’œ
template<typename _CharT, typename _Traits, typename _Alloc, template<
    typename, typename, typename > class _Base> __versa_string< _CharT,
    _Traits, _Alloc, _Base >::size_type __gnu_cxx::__versa_string< _CharT,
    _Traits, _Alloc, _Base >::find_last_not_of (_CharT __c, size_type __pos
    = npos) const [noexcept]
  • __c β€” the character to avoid.
  • __pos β€” index of the character to search back from (default: the end).

Returns: the index of the last occurrence.

Starting from __pos, searches backward for a character other than __c within this string. If found, returns the index where it was found. If not found, returns npos. Note the default is npos, not 0 β€” because we're going the other way, bestie. Reverse main character energy. πŸ‘‘

πŸ’… find_last_not_of β€” the "find me the last vibe that ISN'T in this set" girlies

template<typename _CharT, typename _Traits, typename _Alloc,
         template<typename, typename, typename> class _Base>
size_type
__gnu_cxx::__versa_string<_CharT, _Traits, _Alloc, _Base>::
find_last_not_of(const __versa_string<_CharT, _Traits, _Alloc, _Base>& __str,
                 size_type __pos = npos) const [inline], [noexcept]

okay so this one is giving "Find last position of a character not in string." πŸ¦‹

Parameters:

  • __str β€” the string holding all the characters you wanna AVOID, bestie.
  • __pos β€” index of the character to search back from (defaults to the end, slay).

Returns: index of the last occurrence. πŸŽ€

Starting from __pos, it searches backward for a character that is not contained in __str within this string. Found one? You get the index where it lives. Not found? You get npos. Periodt. πŸ’€

References npos, and size().


template<typename _CharT, typename _Traits, typename _Alloc,
         template<typename, typename, typename> class _Base>
__versa_string<_CharT, _Traits, _Alloc, _Base>::size_type
__gnu_cxx::__versa_string<_CharT, _Traits, _Alloc, _Base>::
find_last_not_of(const _CharT* __s, size_type __pos, size_type __n) const

Find last position of a character not in C substring. 🌸

Parameters:

  • __s β€” C string containing characters to avoid.
  • __pos β€” index of the character to search back from.
  • __n β€” number of characters from s to consider.

Returns: index of the last occurrence. ✨

Starting from __pos, it searches backward for a character not contained in the first __n characters of __s within this string. Found it β†’ index. Didn't find it β†’ npos. No cap.

References npos, and size().


template<typename _CharT, typename _Traits, typename _Alloc,
         template<typename, typename, typename> class _Base>
size_type
__gnu_cxx::__versa_string<_CharT, _Traits, _Alloc, _Base>::
find_last_not_of(const _CharT* __s, size_type __pos = npos) const [inline]

Find last position of a character not in C string. πŸ‘‘

Parameters:

  • __s β€” C string containing characters to avoid.
  • __pos β€” index of the character to search back from (default end).

Returns: index of the last occurrence. πŸ’–

Starting from __pos, searches backward for a character not contained in __s within this string. If found, returns the index where it was found. If not found, returns npos. That's the whole plot, fr fr.


πŸ”₯ find_last_of β€” the "last one of THESE specific characters" era

template<typename _CharT, typename _Traits, typename _Alloc,
         template<typename, typename, typename> class _Base>
size_type
__gnu_cxx::__versa_string<_CharT, _Traits, _Alloc, _Base>::
find_last_of(_CharT __c, size_type __pos = npos) const [inline], [noexcept]

Find last position of a character. πŸ’…

Parameters:

  • __c β€” the character to locate.
  • __pos β€” index of the character to search back from (default end).

Returns: index of the last occurrence.

Starting from __pos, it searches backward for __c within this string. Found it? Index. Not found? npos. Iconic behaviour honestly.

Note: equivalent to rfind(c, pos). 🫢

template<typename _CharT, typename _Traits, typename _Alloc,
         template<typename, typename, typename> class _Base>
size_type
__gnu_cxx::__versa_string<_CharT, _Traits, _Alloc, _Base>::
find_last_of(const __versa_string<_CharT, _Traits, _Alloc, _Base>& __str,
             size_type __pos = npos) const [inline], [noexcept]

Find last position of a character of string. 🌈

Parameters:

  • __str β€” string containing characters to locate.
  • __pos β€” index of the character to search back from (default end).

Returns: index of the last occurrence.

Starting from __pos, searches backward for one of the characters of __str within this string. If found, returns the index where it was found. If not found, returns npos. Simple as that, bestie.

Referenced by __gnu_cxx::__versa_string< char >::find_last_of(), and __gnu_cxx::__versa_string< char >::find_last_of().


template<typename _CharT, typename _Traits, typename _Alloc,
         template<typename, typename, typename> class _Base>
__versa_string<_CharT, _Traits, _Alloc, _Base>::size_type
__gnu_cxx::__versa_string<_CharT, _Traits, _Alloc, _Base>::
find_last_of(const _CharT* __s, size_type __pos, size_type __n) const

Find last position of a character of C substring. πŸ“

Parameters:

  • __s β€” C string containing characters to locate.
  • __pos β€” index of the character to search back from.
  • __n β€” number of characters from s to search for.

Returns: index of the last occurrence.

Starting from __pos, searches backward for one of the first __n characters of __s within this string. If found, returns the index where it was found. If not found, returns npos.

References npos, and size().


template<typename _CharT, typename _Traits, typename _Alloc,
         template<typename, typename, typename> class _Base>
size_type
__gnu_cxx::__versa_string<_CharT, _Traits, _Alloc, _Base>::
find_last_of(const _CharT* __s, size_type __pos = npos) const [inline]

Find last position of a character of C string. ⭐

Parameters:

  • __s β€” C string containing characters to locate.
  • __pos β€” index of the character to search back from (default end).

Returns: index of the last occurrence.

Starting from __pos, searches backward for one of the characters of __s within this string. If found, returns the index where it was found. If not found, returns npos. Slay.


πŸŽ€ front() β€” the first character, read-only edition

template<typename _CharT, typename _Traits, typename _Alloc,
         template<typename, typename, typename> class _Base>
const_reference
__gnu_cxx::__versa_string<_CharT, _Traits, _Alloc, _Base>::
front() const [inline], [noexcept]

Returns a read-only (constant) reference to the data at the first element of the string. Look but don't touch, babe. πŸ™ˆ


πŸ’œ front() β€” the first character, but make it writable

template<typename _CharT, typename _Traits, typename _Alloc,
         template<typename, typename, typename> class _Base>
reference
__gnu_cxx::__versa_string<_CharT, _Traits, _Alloc, _Base>::
front() [inline], [noexcept]

Returns a read/write reference to the data at the first element of the string. Now you can actually edit it. Main character energy. πŸ‘‘


🌸 get_allocator() β€” hand me the receipts of who built this

template<typename _CharT, typename _Traits, typename _Alloc,
         template<typename, typename, typename> class _Base>
allocator_type
__gnu_cxx::__versa_string<_CharT, _Traits, _Alloc, _Base>::
get_allocator() const [inline], [noexcept]

Return a copy of the allocator used to construct this string. That's it, that's the function. 🫢


✨ insert() β€” the glow-up section, starting with one lil character

template<typename _CharT, typename _Traits, typename _Alloc,
         template<typename, typename, typename> class _Base>
iterator
__gnu_cxx::__versa_string<_CharT, _Traits, _Alloc, _Base>::
insert(const_iterator __p, _CharT __c) [inline]

Insert one character. πŸ’…

Parameters:

  • __p β€” iterator referencing the position in the string to insert at.
  • __c β€” the character to insert.

Returns: iterator referencing the newly inserted char. πŸŽ€

Exceptions:

  • std::length_error β€” if the new length exceeds max_size().

Inserts character __c at the position referenced by __p. If adding the character causes the length to exceed max_size(), length_error gets thrown. If __p is beyond the end of the string, out_of_range gets thrown. The value of the string doesn't change if an error is thrown β€” so no half-done glow-up, bestie. ✨


πŸ¦‹ insert() β€” a whole range of characters, come through

template<typename _CharT, typename _Traits, typename _Alloc,
         template<typename, typename, typename> class _Base>
template<class _InputIterator, typename = std::_RequireInputIter<_InputIterator>>
iterator
__gnu_cxx::__versa_string<_CharT, _Traits, _Alloc, _Base>::
insert(const_iterator __p, _InputIterator __beg, _InputIterator __end) [inline]

Insert a range of characters. 🌈

Parameters:

  • __p β€” const_iterator referencing the location in the string to insert at.
  • __beg β€” start of range.
  • __end β€” end of range.

Returns: iterator referencing the first inserted char.

Exceptions:

  • std::length_error β€” if the new length exceeds max_size().

Inserts the characters in the range [beg,end). If adding characters causes the length to exceed max_size(), length_error is thrown. The value of the string doesn't change if an error is thrown. Periodt. πŸ’€


πŸ’– insert() β€” __n copies of one character, go off

template<typename _CharT, typename _Traits, typename _Alloc,
         template<typename, typename, typename> class _Base>
iterator
__gnu_cxx::__versa_string<_CharT, _Traits, _Alloc, _Base>::
insert(const_iterator __p, size_type __n, _CharT __c) [inline]

Insert multiple characters. πŸ”₯

Parameters:

  • __p β€” const_iterator referencing the location in the string to insert at.
  • __n β€” number of characters to insert.
  • __c β€” the character to insert.

Returns: iterator referencing the first inserted char.

Exceptions:

  • std::length_error β€” if the new length exceeds max_size().

Inserts __n copies of character __c starting at the position referenced by iterator __p. If adding characters causes the length to exceed max_size(), length_error is thrown. The value of the string doesn't change if an error is thrown. No cap. πŸŽ€

Referenced by __gnu_cxx::__versa_string< char >::insert().


🌟 insert() β€” initializer_list edition, very modern of you

template<typename _CharT, typename _Traits, typename _Alloc,
         template<typename, typename, typename> class _Base>
iterator
__gnu_cxx::__versa_string<_CharT, _Traits, _Alloc, _Base>::
insert(const_iterator __p, std::initializer_list<_CharT> __l) [inline]

Insert an initializer_list of characters. πŸ’«

Parameters:

  • __p β€” const_iterator referencing the location in the string to insert at.
  • __l β€” the initializer_list of characters to insert.

Returns: iterator referencing the first inserted char.

Exceptions:

  • std::length_error β€” if the new length exceeds max_size().

πŸ‘‘ insert() β€” the C string enters the chat

template<typename _CharT, typename _Traits, typename _Alloc,
         template<typename, typename, typename> class _Base>
__versa_string&
__gnu_cxx::__versa_string<_CharT, _Traits, _Alloc, _Base>::
insert(size_type __pos, const _CharT* __s) [inline]

Insert a C string. 🌸

Parameters:

  • __pos β€” iterator referencing the location in the string to insert at.
  • __s β€” the C string to insert.

Returns: reference to this string.

Exceptions:

  • std::length_error β€” if the new length exceeds max_size().
  • std::out_of_range β€” if __pos is beyond the end of this string.

Inserts the first __n characters of __s starting at __pos. If adding characters causes the length to exceed max_size(), length_error is thrown. If __pos is beyond end(), out_of_range is thrown. The value of the string doesn't change if an error is thrown. So dramatic but so correct. πŸ’…


πŸŽ€ insert() β€” C substring, but with a length limit

template<typename _CharT, typename _Traits, typename _Alloc,
         template<typename, typename, typename> class _Base>
__versa_string&
__gnu_cxx::__versa_string<_CharT, _Traits, _Alloc, _Base>::
insert(size_type __pos, const _CharT* __s, size_type __n) [inline]

Insert a C substring. πŸ“

Parameters:

  • __pos β€” iterator referencing the location in the string to insert at.
  • __s β€” the C string to insert.
  • __n β€” the number of characters to insert.

Returns: reference to this string.

Exceptions:

  • std::length_error β€” if the new length exceeds max_size().
  • std::out_of_range β€” if __pos is beyond the end of this string.

...continues where the last one left off, so like: it drops the first __n characters of __s, starting at __pos, into your string. If that push makes the length go over max_size(), a length_error gets yeeted. And if __pos is past end(), you get an out_of_range instead. Either way, if something blows up, your string stays exactly how it was β€” no half-edits, no mess, we love a clean rollback. πŸ’–


✨ insert (multiple characters, but make it repetitive) ✨

template<typename _CharT, typename _Traits, typename _Alloc, template<typename, typename, typename > class _Base> __versa_string & __gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base >::insert(size_type __pos, size_type __n, _CharT __c)

[inline]

okay bestie, this one is "Insert multiple characters." Same character, __n times, we're committing to the bit.

Parameters πŸ’…

  • __pos β€” the index in the string where you're inserting.
  • __n β€” how many characters you want to insert.
  • __c β€” the character you're inserting.

Returns

  • A reference to this string. (Yes, back to you. Chainable, iconic. πŸ‘‘)

Exceptions

  • std::length_error β€” if the new length exceeds max_size().
  • std::out_of_range β€” if __pos is beyond the end of this string.

So fr: it inserts __n copies of the character __c, starting at index __pos. If adding all those characters makes the length exceed max_size(), length_error is thrown. And if __pos > length(), that's out_of_range, bestie. And again β€” the value of the string doesn't change if an error is thrown. Safe queen behavior. πŸ›‘οΈ


✨ insert (a whole other string, no cap) ✨

template<typename _CharT, typename _Traits, typename _Alloc, template<typename, typename, typename > class _Base> __versa_string & __gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base >::insert(size_type __pos1, const __versa_string< _CharT, _Traits, _Alloc, _Base > & __str)

[inline]

"Insert value of a string." Like, the entire vibe of another string, dropped into yours. πŸ’–

Parameters

  • __pos1 β€” iterator referencing the location in the string to insert at. (Yeah, the docs say iterator, we're just reporting the lore. πŸ™ˆ)
  • __str β€” the string you're inserting.

Returns

  • A reference to this string. 🫢

Exceptions

  • std::length_error β€” if the new length exceeds max_size().

It inserts the value of __str starting at __pos1. If adding those characters pushes the length past max_size(), length_error is thrown. And if an error gets thrown, the string's value stays untouched. periodt.


✨ insert (a substring, so specific) ✨

template<typename _CharT, typename _Traits, typename _Alloc, template<typename, typename, typename > class _Base> __versa_string & __gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base >::insert(size_type __pos1, const __versa_string< _CharT, _Traits, _Alloc, _Base > & __str, size_type __pos2, size_type __n)

[inline]

"Insert a substring." Snipping a little piece out of one string and tucking it into another. πŸŽ€

Parameters

  • __pos1 β€” iterator referencing the location in the string to insert at.
  • __str β€” the string you're inserting from.
  • __pos2 β€” where the characters you want start, inside str.
  • __n β€” how many characters to insert.

Returns

  • A reference to this string. πŸ’–

Exceptions

  • std::length_error β€” if the new length exceeds max_size().
  • std::out_of_range β€” if __pos1 > size() or __pos2 > __str.size().

Starting at __pos1, it inserts __n characters of __str, beginning with __pos2. If adding characters makes the length exceed max_size(), length_error is thrown. If __pos1 is beyond the end of this string, or __pos2 is beyond the end of __str, it's out_of_range. And bestie, if an error is thrown, the value of the string does not change. Clean. 🌸


✨ length ✨

template<typename _CharT, typename _Traits, typename _Alloc, template<typename, typename, typename > class _Base> size_type __gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base >::length() const

[inline], [noexcept]

Returns the number of characters in the string β€” and specifically NOT counting any null-termination. So like, the actual characters, the real ones, the main characters. πŸ‘‘


✨ max_size ✨

template<typename _CharT, typename _Traits, typename _Alloc, template<typename, typename, typename > class _Base> size_type __gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base >::max_size() const

[inline], [noexcept]

Returns the size() of the largest possible string. Like the absolute ceiling, the final boss, the theoretical max. 🌈

Referenced by std::getline(). iykyk.

✨ operator+= (character edition) ✨

template<typename _CharT, typename _Traits, typename _Alloc, template<typename, typename, typename > class _Base> __versa_string & __gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base >::operator+=(_CharT __c)

[inline]

"Append a character." One little guy, tacked on the end. πŸ’…

Parameters

  • __c β€” the character to append.

Returns

  • A reference to this string. 🫢

✨ operator+= (string edition) ✨

template<typename _CharT, typename _Traits, typename _Alloc, template<typename, typename, typename > class _Base> __versa_string & __gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base >::operator+=(const __versa_string< _CharT, _Traits, _Alloc, _Base > & __str)

[inline]

"Append a string to this string." String plus string, they're besties now, they live together. πŸ’–

Parameters

  • __str β€” the string to append.

Returns

  • A reference to this string. ✨

✨ operator+= (C string edition) ✨

template<typename _CharT, typename _Traits, typename _Alloc, template<typename, typename, typename > class _Base> __versa_string & __gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base >::operator+=(const _CharT * __s)

[inline]

"Append a C string." The raw, unbothered, null-terminated kind. πŸ“

Parameters

  • __s β€” the C string to append.

Returns

  • A reference to this string. πŸ‘‘

✨ operator+= (initializer_list edition) ✨

template<typename _CharT, typename _Traits, typename _Alloc, template<typename, typename, typename > class _Base> __versa_string & __gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base >::operator+=(std::initializer_list< _CharT > __l)

[inline]

"Append an initializer_list of characters." Brace-init girlies, this one's for you. 🌸

Parameters

  • __l β€” the initializer_list of characters to be appended.

Returns

  • A reference to this string. 🫢

✨ operator= (move assignment) ✨

template<typename _CharT, typename _Traits, typename _Alloc, template<typename, typename, typename > class _Base> __versa_string & __gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base >::operator=(__versa_string< _CharT, _Traits, _Alloc, _Base > && __str)

[inline], [noexcept]

"String move assignment operator." The glow-up where nobody copies anything. πŸ’…

Parameters

  • __str β€” the source string.

The contents of __str are moved into this string (without copying). And then __str is a valid, but unspecified string. Like, it's alive, it's legal, but bestie... do not ask what's inside it. πŸ’€


✨ operator= (single character) ✨

template<typename _CharT, typename _Traits, typename _Alloc, template<typename, typename, typename > class _Base> __versa_string & __gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base >::operator=(_CharT __c)

[inline]

"Set value to string of length 1." Shrinking the whole thing down to one iconic little character. πŸŽ€

Parameters

  • __c β€” the source character.

Assigning to a character makes this string length 1 and (*this)[0] == __c. Fr fr, that's the whole deal. ✨


✨ operator= (copy assignment) ✨

template<typename _CharT, typename _Traits, typename _Alloc, template<typename, typename, typename > class _Base> __versa_string & __gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base >::operator=(const __versa_string< _CharT, _Traits, _Alloc, _Base > & __str)

[inline]

"Assign the value of str to this string."

Parameters

  • __str β€” the source string.

Copy it, paste it, slay it. πŸ’–


✨ operator= (C string) ✨

template<typename _CharT, typename _Traits, typename _Alloc, template<typename, typename, typename > class _Base> __versa_string & __gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base >::operator=(const _CharT * __s)

[inline]

"Copy contents of __s into this string."

Parameters

  • __s β€” the source null-terminated string.

Yes bestie, null-terminated, it knows when to stop. πŸ“


✨ operator= (initializer_list) ✨

template<typename _CharT, typename _Traits, typename _Alloc, template<typename, typename, typename > class _Base> __versa_string & __gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base >::operator=(std::initializer_list< _CharT > __l)

[inline]

"Set value to string constructed from initializer list." Brace yourself. πŸŽ€

Parameters

  • __l β€” std::initializer_list.

✨ operator[] (the read-only one) ✨

template<typename _CharT, typename _Traits, typename _Alloc, template<typename, typename, typename > class _Base> const_reference __gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base >::operator[](size_type __pos) const

[inline], [noexcept]

"Subscript access to the data contained in the string."

Parameters

  • __pos β€” the index of the character to access.

Returns

  • A read-only (constant) reference to the character.

This operator allows for easy, array-style, data access. But heads up bestie: data access with this operator is unchecked, and out-of-range lookups are not defined. (For checked lookups, see at().) πŸ‘‘

Referenced by __gnu_cxx::__versa_string< char >::back(), __gnu_cxx::__versa_string< char >::back(), __gnu_cxx::__versa_string< char >::front(), and __gnu_cxx::__versa_string< char >::front().

✨ operator[] (the read/write one) ✨

template<typename _CharT, typename _Traits, typename _Alloc, template<typename, typename, typename > class _Base> reference __gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base >::operator[](size_type __pos)

[inline], [noexcept]

"Subscript access to the data contained in the string."

Parameters

  • __pos β€” the index of the character to access.

Returns

  • A read/write reference to the character.

This operator allows for easy, array-style, data access. Note that data access with this operator is unchecked and out_of_range lookups are not defined. (For checked lookups see at().) Oh and β€” Unshares the string. πŸ’…


✨ pop_back ✨

template<typename _CharT, typename _Traits, typename _Alloc, template<typename, typename, typename > class _Base> void __gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base >::pop_back()

[inline]

"Remove the last character." Goodbye to the final little guy. 😭

The string must be non-empty. Do not come for an empty string, she has nothing to give you. πŸ’€

✨ push_back ✨

template<typename _CharT, typename _Traits, typename _Alloc, template<typename, typename, typename > class _Base> void __gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base >::push_back(_CharT __c)

[inline]

"Append a single character." One character. One. That's it. Simple. Iconic. ✨

Parameters

  • __c β€” the character to append.
Referenced by __gnu_cxx::operator+(), __gnu_cxx::operator+(), and __gnu_cxx::__versa_string< char >::operator+=().

✨ rbegin (const) ✨

template<typename _CharT, typename _Traits, typename _Alloc, template<typename, typename, typename > class _Base> const_reverse_iterator __gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base >::rbegin() const

[inline], [noexcept]

Returns a read-only (constant) reverse iterator that points to the last character in the string. And iteration is done in reverse element order, so you're walking it backwards, bestie. πŸ¦‹


✨ rbegin (mutable) ✨

template<typename _CharT, typename _Traits, typename _Alloc, template<typename, typename, typename > class _Base> reverse_iterator __gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base >::rbegin()

[inline], [noexcept]

Returns a read/write reverse iterator that points to the last character in the string. Iteration is done in reverse element order. And β€” Unshares the string. πŸ’…


✨ rend (const) ✨

template<typename _CharT, typename _Traits, typename _Alloc, template<typename, typename, typename > class _Base> const_reverse_iterator __gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base >::rend() const

[inline], [noexcept]

Returns a read-only (constant) reverse iterator that points to one before the first character in the string. Iteration is done in reverse element order. The end-of-the-road marker, but backwards. 🌈


✨ rend (mutable) ✨

template<typename _CharT, typename _Traits, typename _Alloc, template<typename, typename, typename > class _Base> reverse_iterator __gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base >::rend()

[inline], [noexcept]

Returns a read/write reverse iterator that points to one before the first character in the string. Iteration is done in reverse element order. And yes β€” Unshares the string. ✨


🌸 replace() β€” the overload era begins (part 2 of the replace saga)

template<typename _CharT, typename _Traits, typename _Alloc,
         template<typename, typename, typename> class _Base>
template<class _InputIterator,
         typename = std::_RequireInputIter<_InputIterator>>
__versa_string&
__gnu_cxx::__versa_string<_CharT, _Traits, _Alloc, _Base>::
replace(const_iterator __i1, const_iterator __i2,
        _InputIterator __k1, _InputIterator __k2) [inline]

Replace range of characters with range. bestie it's a swap-out but make it fashion πŸ’…

Parameters

  • __i1 β€” iterator pointing at the start of the range you're yeeting out πŸ—‘οΈ
  • __i2 β€” iterator pointing at the end of the range you're yeeting out
  • __k1 β€” iterator pointing at the start of the range you're putting in ✨
  • __k2 β€” iterator pointing at the end of the range you're putting in

Returns

A reference to this string. (Yes, back to you. Main character energy πŸ‘‘)

Exceptions

  • std::length_error β€” thrown if the new length goes over max_size()

So like: the characters in the range [i1,i2) get removed, and in their place the characters in the range [k1,k2) get inserted. If the resulting length is more than max_size(), length_error is thrown. And the important bit β€” the value of the string does not change if an error is thrown, so no half-melted string, we stay unbothered πŸ™ˆ


🌈 and another one

template<typename _CharT, typename _Traits, typename _Alloc,
         template<typename, typename, typename> class _Base>
__versa_string&
__gnu_cxx::__versa_string<_CharT, _Traits, _Alloc, _Base>::
replace(const_iterator __i1, const_iterator __i2,
        const __versa_string<_CharT, _Traits, _Alloc, _Base>& __str) [inline]

Replace range of characters with string. πŸ’–

Parameters

  • __i1 β€” iterator referencing start of range to replace
  • __i2 β€” iterator referencing end of range to replace
  • __str β€” the string value to insert

Returns

Reference to this string 🫢

Exceptions

  • std::length_error β€” if new length exceeds max_size()

Removes the characters in [i1,i2), and in place, the value of __str is inserted. Too long? length_error. Something goes wrong? the string stays exactly how it was. Periodt.


πŸ¦‹ C string edition

template<typename _CharT, typename _Traits, typename _Alloc,
         template<typename, typename, typename> class _Base>
__versa_string&
__gnu_cxx::__versa_string<_CharT, _Traits, _Alloc, _Base>::
replace(const_iterator __i1, const_iterator __i2, const _CharT* __s) [inline]

Replace range of characters with C string. 🌸

Parameters

  • __i1 β€” iterator referencing start of range to replace
  • __i2 β€” iterator referencing end of range to replace
  • __s β€” C string value to insert

Returns

Reference to this string ✨

Exceptions

  • std::length_error β€” if new length exceeds max_size()

Removes [i1,i2), drops the characters of __s in their place. If it all gets too long β†’ length_error. If an error is thrown, the string's value doesn't change. no cap 🧚


πŸŽ€ C substring edition

template<typename _CharT, typename _Traits, typename _Alloc,
         template<typename, typename, typename> class _Base>
__versa_string&
__gnu_cxx::__versa_string<_CharT, _Traits, _Alloc, _Base>::
replace(const_iterator __i1, const_iterator __i2,
        const _CharT* __s, size_type __n) [inline]

Replace range of characters with C substring. πŸ’œ

Parameters

  • __i1 β€” iterator referencing start of range to replace
  • __i2 β€” iterator referencing end of range to replace
  • __s β€” C string value to insert
  • __n β€” number of characters from s to insert

Returns

Reference to this string πŸ’–

Exceptions

  • std::length_error β€” if new length exceeds max_size()

Removes the characters in [i1,i2), and in place, the first n characters of __s are inserted. Length blows past max_size()? length_error. Error thrown? Value unchanged, we're fine πŸ’…


⭐ multiple characters, why not

template<typename _CharT, typename _Traits, typename _Alloc,
         template<typename, typename, typename> class _Base>
__versa_string&
__gnu_cxx::__versa_string<_CharT, _Traits, _Alloc, _Base>::
replace(const_iterator __i1, const_iterator __i2,
        size_type __n, _CharT __c) [inline]

Replace range of characters with multiple characters. πŸ”₯

Parameters

  • __i1 β€” iterator referencing start of range to replace
  • __i2 β€” iterator referencing end of range to replace
  • __n β€” number of characters to insert
  • __c β€” character to insert

Returns

Reference to this string 🫢

Exceptions

  • std::length_error β€” if new length exceeds max_size()

Removes [i1,i2), and in place, __n copies of __c get inserted. If the result exceeds max_size(), length_error gets thrown. And yeah β€” value unchanged if an error is thrown, iconic behaviour honestly πŸ‘‘


πŸ“ initializer_list girlies rise

template<typename _CharT, typename _Traits, typename _Alloc,
         template<typename, typename, typename> class _Base>
__versa_string&
__gnu_cxx::__versa_string<_CharT, _Traits, _Alloc, _Base>::
replace(const_iterator __i1, const_iterator __i2,
        std::initializer_list<_CharT> __l) [inline]

Replace range of characters with initializer_list. 🌈

Parameters

  • __i1 β€” iterator referencing start of range to replace
  • __i2 β€” iterator referencing end of range to replace
  • __l β€” the initializer_list of characters to insert

Returns

Reference to this string ✨

Exceptions

  • std::length_error β€” if new length exceeds max_size()

Removes the characters in [i1,i2). In place, characters in the range [k1,k2) are inserted. If the length of the result exceeds max_size(), length_error is thrown. The value of the string doesn't change if an error is thrown. (Yes bestie, the doc really does say [k1,k2) here even though there's no __k1/__k2 in this overload β€” I'm just the messenger πŸ’€)


πŸ’« position-based replace, the classic

template<typename _CharT, typename _Traits, typename _Alloc,
         template<typename, typename, typename> class _Base>
__versa_string&
__gnu_cxx::__versa_string<_CharT, _Traits, _Alloc, _Base>::
replace(size_type __pos, size_type __n,
        const __versa_string<_CharT, _Traits, _Alloc, _Base>& __str) [inline]

Replace characters with value from another string. πŸ’–

Parameters

  • __pos β€” index of first character to replace
  • __n β€” number of characters to be replaced
  • __str β€” string to insert

Returns

Reference to this string 🌸

Exceptions

  • std::out_of_range β€” if __pos is beyond the end of this string
  • std::length_error β€” if new length exceeds max_size()

Removes the characters in the range [pos,pos+n) from this string. In place, the value of __str is inserted. If __pos is beyond the end of the string, out_of_range gets thrown. If the length of the result exceeds max_size(), length_error gets thrown. And of course, the value of the string doesn't change if an error is thrown 🧚

Referenced by

  • __gnu_cxx::__versa_string< char >::append()
  • __gnu_cxx::__versa_string< char >::assign()
  • __gnu_cxx::__versa_string< char >::insert()
  • __gnu_cxx::__versa_string< char >::insert()
  • __gnu_cxx::__versa_string< char >::insert()
  • __gnu_cxx::__versa_string< char >::insert()
  • __gnu_cxx::__versa_string< char >::insert()
  • __gnu_cxx::__versa_string< char >::insert()
  • __gnu_cxx::__versa_string< char >::replace()
  • __gnu_cxx::__versa_string< char >::replace()
  • __gnu_cxx::__versa_string< char >::replace()
  • __gnu_cxx::__versa_string< char >::replace()
  • __gnu_cxx::__versa_string< char >::replace()
  • __gnu_cxx::__versa_string< char >::replace()
  • and __gnu_cxx::__versa_string< char >::replace()

(that's a lot of internal glow-up happening behind the scenes, they're all leaning on this one 😭)


πŸŽ€ C string, but with position

template<typename _CharT, typename _Traits, typename _Alloc,
         template<typename, typename, typename> class _Base>
__versa_string&
__gnu_cxx::__versa_string<_CharT, _Traits, _Alloc, _Base>::
replace(size_type __pos, size_type __n1, const _CharT* __s) [inline]

Replace characters with value of a C string. 🌸

Parameters

  • __pos β€” index of first character to replace
  • __n1 β€” number of characters to be replaced
  • __s β€” C string to insert

Returns

Reference to this string πŸ’œ

Exceptions

  • std::out_of_range β€” if __pos > size()
  • std::length_error β€” if new length exceeds max_size()

Removes the characters in the range [pos,pos + n1) from this string. In place, the characters of __s are inserted. If pos is beyond the end of the string, out_of_range is thrown. If the length of the result exceeds max_size(), length_error is thrown. The value of the string doesn't change if an error is thrown. slay 🫢


πŸ¦‹ C substring, but with position

template<typename _CharT, typename _Traits, typename _Alloc,
         template<typename, typename, typename> class _Base>
__versa_string&
__gnu_cxx::__versa_string<_CharT, _Traits, _Alloc, _Base>::
replace(size_type __pos, size_type __n1,
        const _CharT* __s, size_type __n2) [inline]

Replace characters with value of a C substring. ✨

Parameters

  • __pos β€” index of first character to replace
  • __n1 β€” number of characters to be replaced
  • __s β€” C string to insert
  • __n2 β€” number of characters from __s to use

Returns

Reference to this string πŸ’–

Exceptions

  • std::out_of_range β€” if __pos1 > size()
  • std::length_error β€” if new length exceeds max_size()

Removes the characters in the range [pos,pos + n1) from this string. In place, the first __n2 characters of __s are inserted β€” or, if __n2 is too large, all of __s. If __pos is beyond the end of the string, out_of_range is thrown. If the length of the result exceeds max_size(), length_error is thrown. The value of the string doesn't change if an error is thrown. (and yes, the doc says __pos1 in the exception line and __pos everywhere else β€” we love a little inconsistency, it's giving chaos πŸ“)


⭐ n2 copies of a character, positioned

template<typename _CharT, typename _Traits, typename _Alloc,
         template<typename, typename, typename> class _Base>
__versa_string&
__gnu_cxx::__versa_string<_CharT, _Traits, _Alloc, _Base>::
replace(size_type __pos, size_type __n1, size_type __n2, _CharT __c) [inline]

Replace characters with multiple characters. πŸ”₯

Parameters

  • __pos β€” index of first character to replace
  • __n1 β€” number of characters to be replaced
  • __n2 β€” number of characters to insert
  • __c β€” character to insert

Returns

Reference to this string πŸ‘‘

Exceptions

  • std::out_of_range β€” if __pos > size()
  • std::length_error β€” if new length exceeds max_size()

Removes the characters in the range [pos,pos + n1) from this string. In place, __n2 copies of __c are inserted. If __pos is beyond the end of the string, out_of_range is thrown. If the length of the result exceeds max_size(), length_error is thrown. The value of the string doesn't change if an error is thrown. πŸ’…


πŸ’œ string-into-string, fully positioned (the deluxe version)

template<typename _CharT, typename _Traits, typename _Alloc,
         template<typename, typename, typename> class _Base>
__versa_string&
__gnu_cxx::__versa_string<_CharT, _Traits, _Alloc, _Base>::
replace(size_type __pos1, size_type __n1,
        const __versa_string<_CharT, _Traits, _Alloc, _Base>& __str,
        size_type __pos2, size_type __n2) [inline]

Replace characters with value from another string. 🌈

Parameters

  • __pos1 β€” index of first character to replace
  • __n1 β€” number of characters to be replaced
  • __str β€” string to insert
  • __pos2 β€” index of first character of str to use
  • __n2 β€” number of characters from str to use

Returns

Reference to this string 🫢

Exceptions πŸ’€

  • std::out_of_range β€” if __pos1 > size() or __pos2 > str.size().
  • std::length_error β€” if new length exceeds max_size().

okay bestie, so this function is out here removing the characters in the range [pos1,pos1 + n) from this string. In place, the value of __str is inserted. If __pos is beyond end of string, out_of_range is thrown. If the length of the result exceeds max_size(), length_error is thrown. The value of the string doesn't change if an error is thrown. no cap, it stays put if it throws. πŸ’…


reserve ✨

   template<typename _CharT, typename _Traits, typename _Alloc, template<
       typename, typename, typename > class _Base> void
       __gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base >::reserve
       (size_type __res_arg = 0) [inline]

Attempt to preallocate enough memory for specified number of characters. it's giving β€œlet me get my space ready before the party starts”.

Parameters

  • __res_arg β€” Number of characters required.

Exceptions

  • std::length_error β€” If __res_arg exceeds max_size().

This function attempts to reserve enough memory for the string to hold the specified number of characters. If the number requested is more than max_size(), length_error is thrown.

The advantage of this function is that if optimal code is a necessity and the user can determine the string length that will be required, the user can reserve the memory in advance, and thus prevent a possible reallocation of memory and copying of string data. so if you know how long your string is gonna be, reserve it and avoid the reallocation jump scare.

Referenced by __gnu_cxx::operator+(), __gnu_cxx::operator+(), __gnu_cxx::operator+(), and __gnu_cxx::__versa_string< char >::shrink_to_fit().


resize (size_type __n) πŸ¦‹

   template<typename _CharT, typename _Traits, typename _Alloc, template<
       typename, typename, typename > class _Base> void
       __gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base >::resize
       (size_type __n) [inline]

Resizes the string to the specified number of characters. slay.

Parameters

  • __n β€” Number of characters the string should contain.

This function will resize the string to the specified length. If the new size is smaller than the string's current size the string is truncated, otherwise the string is extended and new characters are default-constructed. For basic types such as char, this means setting them to 0. so if it grows, new chars are default-constructed, and for basic types like char, that means 0. periodt.


resize (size_type __n, _CharT __c) 🌸

   template<typename _CharT, typename _Traits, typename _Alloc, template<
       typename, typename, typename > class _Base> void
       __gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base >::resize
       (size_type __n, _CharT __c)

Resizes the string to the specified number of characters.

Parameters

  • __n β€” Number of characters the string should contain.
  • __c β€” Character to fill any new elements.

This function will resize the string to the specified number of characters. If the number is smaller than the string's current size the string is truncated, otherwise the string is extended and new elements are set to __c. so you get to pick the filler char, cute.

References append(), and size().

Referenced by __gnu_cxx::__versa_string< char >::resize().


rfind (_CharT __c, size_type __pos = npos) const [noexcept] πŸ’œ

   template<typename _CharT, typename _Traits, typename _Alloc, template<
       typename, typename, typename > class _Base> __versa_string< _CharT,
       _Traits, _Alloc, _Base >::size_type __gnu_cxx::__versa_string< _CharT,
       _Traits, _Alloc, _Base >::rfind (_CharT __c, size_type __pos = npos)
       const [noexcept]

Find last position of a character.

Parameters

  • __c β€” Character to locate.
  • __pos β€” Index of character to search back from (default end).

Returns

  • Index of last occurrence.

Starting from __pos, searches backward for __c within this string. If found, returns the index where it was found. If not found, returns npos. so it's the reverse search queen, looking back from __pos.

References npos, and size().


rfind (const __versa_string< _CharT, _Traits, _Alloc, _Base > & __str, size_type __pos = npos) const [inline], [noexcept] πŸŽ€

   template<typename _CharT, typename _Traits, typename _Alloc, template<
       typename, typename, typename > class _Base> size_type
       __gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base >::rfind
       (const __versa_string< _CharT, _Traits, _Alloc, _Base > & __str,
       size_type __pos = npos) const [inline],  [noexcept]

Find last position of a string.

Parameters

  • __str β€” String to locate.
  • __pos β€” Index of character to search back from (default end).

Returns

  • Index of start of last occurrence.

Starting from __pos, searches backward for value of __str within this string. If found, returns the index where it begins. If not found, returns npos.

Referenced by __gnu_cxx::__versa_string< char >::find_last_of(), __gnu_cxx::__versa_string< char >::rfind(), and __gnu_cxx::__versa_string< char >::rfind().


rfind (const _CharT * __s, size_type __pos, size_type __n) const 🌈

   template<typename _CharT, typename _Traits, typename _Alloc, template<
       typename, typename, typename > class _Base> __versa_string< _CharT,
       _Traits, _Alloc, _Base >::size_type __gnu_cxx::__versa_string< _CharT,
       _Traits, _Alloc, _Base >::rfind (const _CharT * __s, size_type __pos,
       size_type __n) const

Find last position of a C substring.

Parameters

  • __s β€” C string to locate.
  • __pos β€” Index of character to search back from.
  • __n β€” Number of characters from s to search for.

Returns

  • Index of start of last occurrence.

Starting from __pos, searches backward for the first __n characters in __s within this string. If found, returns the index where it begins. If not found, returns npos.

References std::min(), npos, and size().


rfind (const _CharT * __s, size_type __pos = npos) const [inline] ⭐

   template<typename _CharT, typename _Traits, typename _Alloc, template<
       typename, typename, typename > class _Base> size_type
       __gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base >::rfind
       (const _CharT * __s, size_type __pos = npos) const [inline]

Find last position of a C string.

Parameters

  • __s β€” C string to locate.
  • __pos β€” Index of character to start search at (default end).

Returns

  • Index of start of last occurrence.

Starting from __pos, searches backward for the value of __s within this string. If found, returns the index where it begins. If not found, returns npos.


shrink_to_fit () [inline], [noexcept] 🧚

   template<typename _CharT, typename _Traits, typename _Alloc, template<
       typename, typename, typename > class _Base> void
       __gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base
       >::shrink_to_fit () [inline],  [noexcept]

A non-binding request to reduce capacity() to size(). it's giving β€œpls shrink, but no pressure”.


size () const [inline], [noexcept] πŸ‘‘

   template<typename _CharT, typename _Traits, typename _Alloc, template<
       typename, typename, typename > class _Base> size_type
       __gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base >::size ()
       const [inline],  [noexcept]

Returns the number of characters in the string, not including any null-termination. bestie, it's the actual char count, no null terminator included.

Referenced by __gnu_cxx::__versa_string< char >::append(), __gnu_cxx::__versa_string< char >::append(), __gnu_cxx::__versa_string< char >::assign(), __gnu_cxx::__versa_string< char >::assign(), __gnu_cxx::__versa_string< char >::assign(), __gnu_cxx::__versa_string< char >::assign(), __gnu_cxx::__versa_string< char >::at(), __gnu_cxx::__versa_string< char >::at(), __gnu_cxx::__versa_string< char >::back(), __gnu_cxx::__versa_string< char >::back(), __gnu_cxx::__versa_string< char >::cend(), compare(), compare(), __gnu_cxx::__versa_string< char >::compare(), __gnu_cxx::__versa_string< char >::empty(), __gnu_cxx::__versa_string< char >::end(), __gnu_cxx::__versa_string< char >::end(), find(), find(), __gnu_cxx::__versa_string< char >::find(), find_first_not_of(), find_first_not_of(), __gnu_cxx::__versa_string< char >::find_first_not_of(), find_first_of(), __gnu_cxx::__versa_string< char >::find_first_of(), find_last_not_of(), find_last_not_of(), find_last_of(), __gnu_cxx::__versa_string< char >::find_last_of(), __gnu_cxx::__versa_string< char >::insert(), __gnu_cxx::operator+(), __gnu_cxx::operator+(), __gnu_cxx::operator+(), __gnu_cxx::operator+(), __gnu_cxx::operator+(), __gnu_cxx::operator==(), __gnu_cxx::operator==(), __gnu_cxx::__versa_string< char >::operator[](), __gnu_cxx::__versa_string< char >::operator[](), __gnu_cxx::__versa_string< char >::pop_back(), __gnu_cxx::__versa_string< char >::push_back(), __gnu_cxx::__versa_string< char >::replace(), __gnu_cxx::__versa_string< char >::replace(), resize(), rfind(), rfind(), and __gnu_cxx::__versa_string< char >::shrink_to_fit().


substr (size_type __pos = 0, size_type __n = npos) const [inline] πŸ“

   template<typename _CharT, typename _Traits, typename _Alloc, template<
       typename, typename, typename > class _Base> __versa_string
       __gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base >::substr
       (size_type __pos = 0, size_type __n = npos) const [inline]

Get a substring.

Parameters

  • __pos β€” Index of first character (default 0).
  • __n β€” Number of characters in substring (default remainder).

Returns

  • The new string.

Exceptions

  • std::out_of_range β€” If pos > size().

Construct and return a new string using the __n characters starting at __pos. If the string is too short, use the remainder of the characters. If __pos is beyond the end of the string, out_of_range is thrown. so it's a little slice of the string, and if you ask for too much it throws. πŸ’…


swap (__versa_string< _CharT, _Traits, _Alloc, _Base > & __s) [inline], [noexcept] πŸ”₯

   template<typename _CharT, typename _Traits, typename _Alloc, template<
       typename, typename, typename > class _Base> void
       __gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base >::swap
       (__versa_string< _CharT, _Traits, _Alloc, _Base > & __s) [inline],
       [noexcept]

Swap contents with another string.

Parameters

  • __s β€” String to swap with.

Exchanges the contents of this string with that of __s in constant time. it's giving instant trade, no copying stress.

Referenced by __gnu_cxx::__versa_string< char >::assign(), __gnu_cxx::__versa_string< char >::operator=(), and __gnu_cxx::swap().


πŸ’– Member Data Documentation πŸ’–

npos [static] πŸ‘‘

   template<typename _CharT, typename _Traits, typename _Alloc, template<
       typename, typename, typename > class _Base> const size_type
       __gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base >::npos
       [static]

Value returned by various member functions when they fail. so when the search functions are like β€œnot found bestie”, they return this.

Referenced by find(), find(), find_first_not_of(), find_first_not_of(), find_first_of(), find_last_not_of(), find_last_not_of(), find_last_of(), rfind(), and rfind().


✨ Author ✨

Generated automatically by Doxygen for libstdc++ from the source code. so yeah, the robots wrote it, not a human. πŸ’…


and that's the tea, bestie 🫢 this page came from libstdc++ and its man page tag is __gnu_cxx:...oc, _Base >(3). stay iconic, keep your strings safe, and don't forget to reserve. πŸ’–βœ¨

πŸ“¦ where this page comes from
  • arch rolling: gcc 16.2.1+r23+gd564253eb6c8-1 Β· GPL-3.0-or-later WITH GCC-exception-3.1 AND GFDL-1.3-or-later
  • fedora 44: libstdc++-docs 16.0.1-0.10.fc44 Β· GPL-3.0-or-later AND LGPL-3.0-or-later AND (GPL-3.0-or-later WITH GCC-exception-3.1) AND (GPL-3.0-or-later WITH Texinfo-exception) AND (LGPL-2.1-or-later WITH GCC-exception-2.0) AND (GPL-2.0-or-later WITH GCC-exception-2.0) AND (GPL-2.0-or-later WITH GNU-compiler-exception) AND BSL-1.0 AND GFDL-1.3-or-later AND Linux-man-pages-copyleft-2-para AND SunPro AND BSD-1-Clause AND BSD-2-Clause AND BSD-2-Clause-Views AND BSD-3-Clause AND BSD-4-Clause AND BSD-Source-Code AND Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 WITH LLVM-Exception) AND ZPL-2.1 AND ISC AND LicenseRef-Fedora-Public-Domain AND HP-1986 AND curl AND Martin-Birgmeier AND HPND-Markus-Kuhn AND dtoa AND SMLNJ AND AMD-newlib AND OAR AND HPND-merchantability-variant AND HPND-Intel
  • fedora 44: libstdc++-docs 16.2.1-2.fc44
  • fedora 44: libstdc++-docs 16.2.1-3.fc44 Β· GPL-3.0-or-later AND LGPL-3.0-or-later AND (GPL-3.0-or-later WITH GCC-exception-3.1) AND (GPL-3.0-or-later WITH Texinfo-exception) AND (LGPL-2.1-or-later WITH GCC-exception-2.0) AND (GPL-2.0-or-later WITH GCC-exception-2.0) AND (GPL-2.0-or-later WITH GNU-compiler-exception) AND BSL-1.0 AND GFDL-1.3-or-later AND Linux-man-pages-copyleft-2-para AND SunPro AND BSD-1-Clause AND BSD-2-Clause AND BSD-2-Clause-Views AND BSD-3-Clause AND BSD-4-Clause AND BSD-Source-Code AND Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 WITH LLVM-Exception) AND ZPL-2.1 AND ISC AND LicenseRef-Fedora-Public-Domain AND HP-1986 AND curl AND Martin-Birgmeier AND HPND-Markus-Kuhn AND dtoa AND SMLNJ AND AMD-newlib AND OAR AND HPND-merchantability-variant AND HPND-Intel
  • πŸ’– girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms