__GNU_CXX::__VERSA_STRING(3cxx)
okay so bestie, this is a 3cxx manual page, and itβs all about the template class __gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base > π yes the name is huge, weβre handling it.
πΈ NAME πΈ
__gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base > β Template class __versa_string. thatβs the whole NAME, short and iconic β¨
β¨ SYNOPSIS β¨
to summon this thing, you literally type:
#include <vstring.h>
and it inherits from _Base< _CharT, _Traits, _Alloc > β yes, exactly like that, spaces and all π«Ά
π Public Types π
typedef _Alloc allocator_typeβ theallocator_typealias, serving its little typedef moment πtypedef __gnu_cxx::__normal_iterator< const_pointer, __versa_string > const_iteratorβconst_iterator, no cap πtypedef _CharT_alloc_traits::const_pointer const_pointerβ theconst_pointertypedef, right here bestie β¨typedef const value_type & const_referenceβconst_reference, living that reference life πtypedef std::reverse_iterator< const_iterator > const_reverse_iteratorβconst_reverse_iterator, iconic reverse energy π¦typedef _CharT_alloc_type::difference_type difference_typeβdifference_type, periodt πΈtypedef __gnu_cxx::__normal_iterator< pointer, __versa_string > iteratorβiterator, main character typedef fr fr πtypedef _CharT_alloc_traits::pointer pointerβ thepointeralias, slay π₯typedef value_type & referenceβreference, lowkey essential πtypedef std::reverse_iterator< iterator > reverse_iteratorβreverse_iterator, going backwards but make it cute πtypedef _CharT_alloc_type::size_type size_typeβsize_type, holding it down βtypedef _Traits traits_typeβtraits_type, the vibes alias π§typedef _Traits::char_type value_typeβvalue_type, final typedef of this batch, and yes it ate π
okay so we're deep in the member function list now and bestie there are SO many π constructors first, because of course this class has like ten ways to be born. iconic behaviour honestly.
__versa_string (__versa_string &&__str) noexceptβ the string move constructor. yes she moves,noexceptand everything, no cap β¨template<class _InputIterator , typename = std::_RequireInputIter<_InputIterator>> __versa_string (_InputIterator __beg, _InputIterator __end, const _Alloc &__a=_Alloc())β builds the string as a copy of a range, from__begto__end, with the allocator defaulting to_Alloc()π¦__versa_string (const __versa_string &__str)β the classic copy constructor: construct a string with a copy of the value of__strπ__versa_string (const __versa_string &__str, size_type __pos, size_type __n, const _Alloc &__a)β construct the string as a copy of a substring β you hand it the source, a__pos, an__n, and an allocator πΈ__versa_string (const __versa_string &__str, size_type __pos, size_type __n=npos)β same substring-copy vibe, but__ndefaults tonposso you can yeet it βοΈ__versa_string (const _Alloc &__a=_Alloc()) noexceptβ construct an empty string using allocatora, and it'snoexceptso she's calm π__versa_string (const _CharT *__s, const _Alloc &__a=_Alloc())β construct the string as a copy of a C string π₯__versa_string (const _CharT *__s, size_type __n, const _Alloc &__a=_Alloc())β construct a string initialized by a character array,__ncharacters of it, allocator optional π«__versa_string (size_type __n, _CharT __c, const _Alloc &__a=_Alloc())β construct the string as multiple characters:__ncopies of__c. it's giving "repeat after me" π__versa_string (std::initializer_list< _CharT > __l, const _Alloc &__a=_Alloc())β construct the string from aninitializer_list. brace-init girlies rise π«Ά~__versa_string () noexceptβ destroy the string instance. she's done, she's logging off,noexceptπ
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)β the page genuinely gives no blurb for this one, so I'm not inventing lore. signature only, bestie π
now the append era begins. big era.
template<class _InputIterator , typename = std::_RequireInputIter<_InputIterator>> __versa_string & append (_InputIterator __first, _InputIterator __last)β append a range of characters,__firstthrough__lastπ__versa_string & append (const __versa_string &__str)β append a string to this string. she's stacking β¨__versa_string & append (const __versa_string &__str, size_type __pos, size_type __n)β append a substring of__str, starting at__pos,__nlong π__versa_string & append (const _CharT *__s)β append a C string π__versa_string & append (const _CharT *__s, size_type __n)β append a C substring,__nchars of it π¦__versa_string & append (size_type __n, _CharT __c)β append multiple characters:__ncopies of__cπ__versa_string & append (std::initializer_list< _CharT > __l)β append aninitializer_listof characters π
assign next, aka "no actually, be this instead":
__versa_string & assign (__versa_string &&__str) noexceptβ set value to the contents of another string, via move.noexceptobviously βtemplate<class _InputIterator , typename = std::_RequireInputIter<_InputIterator>> __versa_string & assign (_InputIterator __first, _InputIterator __last)β set value to a range of characters πΈ__versa_string & assign (const __versa_string &__str)β set value to the contents of another string π__versa_string & assign (const __versa_string &__str, size_type __pos, size_type __n)β set value to a substring of a string,__posand__nstyle π__versa_string & assign (const _CharT *__s)β set value to the contents of a C string π₯__versa_string & assign (const _CharT *__s, size_type __n)β set value to a C substring π__versa_string & assign (size_type __n, _CharT __c)β set value to multiple characters:__nof__cβ¨__versa_string & assign (std::initializer_list< _CharT > __l)β set value to aninitializer_listof characters π§
reference at (size_type __n)β provides access to the data contained in the string, at__nπ«Άconst_reference at (size_type __n) constβ same, but theconstflavour πconst_reference back () const noexceptβ signature only, the page gives no blurb, so no invented lore from me πreference back () noexceptβ again, signature and nothing else πconst_iterator begin () const noexceptβ signature only πΈiterator begin () noexceptβ signature only π¦const _CharT * c_str () const noexceptβ return a const pointer to the null-terminated contents βsize_type capacity () const noexceptβ signature only, no blurb on the page πconst_iterator cbegin () const noexceptβ signature only β¨const_iterator cend () const noexceptβ signature only πvoid clear () noexceptβ signature only,noexceptβ
the compare girlies. six of them. she's thorough.
int compare (const __versa_string &__str) constβ compare to a string πint compare (const _CharT *__s) constβ compare to a C string πint compare (size_type __pos, size_type __n, const __versa_string &__str) constβ compare a substring to a string πint compare (size_type __pos, size_type __n1, const _CharT *__s) constβ compare a substring to a C string πint compare (size_type __pos, size_type __n1, const _CharT *__s, size_type __n2) constβ compare a substring against a character array, with__n1and__n2both in play π€int compare (size_type __pos1, size_type __n1, const __versa_string &__str, size_type __pos2, size_type __n2) constβ compare a substring to a substring. yes, both sides get pos-and-n. it's giving β¨symmetryβ¨size_type copy (_CharT *__s, size_type __n, size_type __pos=0) constβ copy a substring into a C string,__nchars,__posdefaulting to0π
const_reverse_iterator crbegin () const noexceptβ signature only, no blurb given πconst_reverse_iterator crend () const noexceptβ signature only π«const _CharT * data () const noexceptβ return a const pointer to the contents π«Άbool empty () const noexceptβ signature only β¨const_iterator end () const noexceptβ signature only πiterator end () noexceptβ signature only π¦
erase hours π€
iterator erase (const_iterator __first, const_iterator __last)β remove a range of characters,__firstto__lastπiterator erase (const_iterator __position)β remove one character at__positionπ__versa_string & erase (size_type __pos=0, size_type __n=npos)β remove characters, with__posdefaulting to0and__ndefaulting tonposπ₯
now the search arc. the find family ate, honestly:
size_type find (_CharT __c, size_type __pos=0) const noexceptβ find the position of a character,__posdefaults0,noexceptπsize_type find (const __versa_string &__str, size_type __pos=0) const noexceptβ find the position of a string πsize_type find (const _CharT *__s, size_type __pos, size_type __n) constβ find the position of a C substring πsize_type find (const _CharT *__s, size_type __pos=0) constβ find the position of a C string π
find_first_not_of β the contrarian queen π
size_type find_first_not_of (_CharT __c, size_type __pos=0) const noexceptβ find the position of a different character πsize_type find_first_not_of (const __versa_string &__str, size_type __pos=0) const noexceptβ find the position of a character not in the string πsize_type find_first_not_of (const _CharT *__s, size_type __pos, size_type __n) constβ find the position of a character not in a C substring πsize_type find_first_not_of (const _CharT *__s, size_type __pos=0) constβ find the position of a character not in a C string π
find_first_of β back to the agreeable era β¨
size_type find_first_of (_CharT __c, size_type __pos=0) const noexceptβ find the position of a character πsize_type find_first_of (const __versa_string &__str, size_type __pos=0) const noexceptβ find the position of a character of the string πsize_type find_first_of (const _CharT *__s, size_type __pos, size_type __n) constβ find the position of a character of a C substring πsize_type find_first_of (const _CharT *__s, size_type __pos=0) constβ find the position of a character of a C string π
find_last_not_of β same energy, but from the BACK π
size_type find_last_not_of (_CharT __c, size_type __pos=npos) const noexceptβ find the last position of a different character,__posdefaults tonposπsize_type find_last_not_of (const __versa_string &__str, size_type __pos=npos) const noexceptβ find the last position of a character not in the string πsize_type find_last_not_of (const _CharT *__s, size_type __pos, size_type __n) constβ find the last position of a character not in a C substring πsize_type find_last_not_of (const _CharT *__s, size_type __pos=npos) constβ find the last position of a character not in a C string π
find_last_of β closing out the search saga π¬
size_type find_last_of (_CharT __c, size_type __pos=npos) const noexceptβ find the last position of a character πsize_type find_last_of (const __versa_string &__str, size_type __pos=npos) const noexceptβ find the last position of a character of the string πsize_type find_last_of (const _CharT *__s, size_type __pos, size_type __n) constβ find the last position of a character of a C substring πsize_type find_last_of (const _CharT *__s, size_type __pos=npos) constβ find the last position of a character of a C string π
const_reference front () const noexceptβ signature only, no blurb π«Άreference front () noexceptβ signature only πallocator_type get_allocator () const noexceptβ return a copy of the allocator used to construct this string π
insert overloads, aka "let me just squeeze this in" π
iterator insert (const_iterator __p, _CharT __c)β insert one character at__pβ¨template<class _InputIterator , typename = std::_RequireInputIter<_InputIterator>> iterator insert (const_iterator __p, _InputIterator __beg, _InputIterator __end)β insert a range of characters at__pπ¦iterator insert (const_iterator __p, size_type __n, _CharT __c)β insert multiple characters,__nof__cπΈiterator insert (const_iterator __p, std::initializer_list< _CharT > __l)β insert aninitializer_listof characters π__versa_string & insert (size_type __pos, const _CharT *__s)β insert a C string at__posπ₯__versa_string & insert (size_type __pos, const _CharT *__s, size_type __n)β insert a C substring π₯__versa_string & insert (size_type __pos, size_type __n, _CharT __c)β insert multiple characters π«__versa_string & insert (size_type __pos1, const __versa_string &__str)β insert the value of a string at__pos1π__versa_string & insert (size_type __pos1, const __versa_string &__str, size_type __pos2, size_type __n)β insert a substring. positions on positions π€
size_type length () const noexceptβ returns the number of characters in the string, not including any null-termination πsize_type max_size () const noexceptβ returns thesize()of the largest possible string π
operator era π
__versa_string & operator+= (_CharT __c)β append a character πΈ__versa_string & operator+= (const __versa_string &__str)β append a string to this string π¦__versa_string & operator+= (const _CharT *__s)β append a C string π__versa_string & operator+= (std::initializer_list< _CharT > __l)β append aninitializer_listof characters β¨__versa_string & operator= (__versa_string &&__str) noexceptβ the string move assignment operator.noexceptand unbothered π__versa_string & operator= (_CharT __c)β set value to a string of length 1 π__versa_string & operator= (const __versa_string &__str)β assign the value ofstrto this string π__versa_string & operator= (const _CharT *__s)β copy the contents of__sinto this string π₯__versa_string & operator= (std::initializer_list< _CharT > __l)β set value to a string constructed from an initializer list πconst_reference operator[] (size_type __pos) const noexceptβ subscript access to the data contained in the string,constflavour β¨reference operator[] (size_type __pos) noexceptβ subscript access to the data contained in the string πvoid pop_back ()β remove the last character. bye bestie πvoid push_back (_CharT __c)β append a single character π«Άconst_reverse_iterator rbegin () const noexceptβ signature only, no blurb πreverse_iterator rbegin () noexceptβ signature only π§const_reverse_iterator rend () const noexceptβ signature only βreverse_iterator rend () noexceptβ signature only πΈ
aaaaand we land on replace, where the page literally cuts itself off mid-signature:
__versa_string & replace (const_iterator __i1, const_iterator __i2,β and that's where this part of the page runs out of room π signature's not finished, no blurb either, so we're picking this up right where it left off next time π
β¦_CharT *__k1, _CharT *__k2) β ok that's literally just the tail end of one of the replace overloads hanging out mid-signature, we're picking up right there bestie, no restart, no recap π
template<class _InputIterator , typename = std::_RequireInputIter<_InputIterator>> __versa_string & replace (const_iterator __i1, const_iterator __i2, _InputIterator __k1, _InputIterator __k2)β replace range of characters with range β¨__versa_string & replace (const_iterator __i1, const_iterator __i2, const __versa_string &__str)β replace range of characters with 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)β replace range of characters with C string__versa_string & replace (const_iterator __i1, const_iterator __i2, const _CharT *__s, size_type __n)β replace range of characters with 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)β replace range of characters with multiple characters__versa_string & replace (const_iterator __i1, const_iterator __i2, std::initializer_list< _CharT > __l)β replace range of characters withinitializer_list__versa_string & replace (size_type __pos, size_type __n, const __versa_string &__str)β replace characters with value from another string__versa_string & replace (size_type __pos, size_type __n1, const _CharT *__s)β replace characters with value of a C string__versa_string & replace (size_type __pos, size_type __n1, const _CharT *__s, size_type __n2)β replace characters with value of a C substring__versa_string & replace (size_type __pos, size_type __n1, size_type __n2, _CharT __c)β replace characters with multiple characters__versa_string & replace (size_type __pos1, size_type __n1, const __versa_string &__str, size_type __pos2, size_type __n2)β replace characters with value from another string
ok and yes, some of those have no little description attached in the source β the ones with nothing after them are just signature-and-vibes, I'm not gonna make up lore for them π
void reserve (size_type __res_arg=0)β attempt to preallocate enough memory for specified number of characters πvoid resize (size_type __n)β resizes the string to the specified number of charactersvoid resize (size_type __n, _CharT __c)β resizes the string to the specified number of characterssize_type rfind (_CharT __c, size_type __pos=npos) const noexceptβ find last position of a charactersize_type rfind (const __versa_string &__str, size_type __pos=npos) const noexceptβ find last position of a stringsize_type rfind (const _CharT *__s, size_type __pos, size_type __n) constβ find last position of a C substringsize_type rfind (const _CharT *__s, size_type __pos=npos) constβ find last position of a C stringvoid shrink_to_fit () noexceptβ a non-binding request to reducecapacity()tosize()(non-binding!! she might not listen, that's the whole point π«Ά)size_type size () const noexceptβ returns the number of characters in the string, not including any null-termination__versa_string substr (size_type __pos=0, size_type __n=npos) constβ get a substringvoid swap (__versa_string &__s) noexceptβ swap contents with another string
π¦ STATIC PUBLIC ATTRIBUTES π¦
static const size_type nposβ the value returned by various member functions when they fail. icon behavior honestly, she has one job and she does it π
π 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 it, that's the whole vibe check β¨
π CONSTRUCTOR & DESTRUCTOR DOCUMENTATION π
the default one πΈ
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]
Construct an empty string using allocator a. three badges at once β [inline], [explicit], [noexcept] β she's serving, we love a multi-tag queen π
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 string with copy of 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.
Parameters
__strβ source string.
The newly-constructed string contains the exact contents of __str. The contents of __str are a valid, but unspecified string β so like, don't go reading __str afterwards expecting the same thing, she's moved out and living her new life π
initializer_list constructor π
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]
Construct string from an initializer list.
Parameters
__lβstd::initializer_listof characters.__aβ allocator to use (default is default allocator).
substring constructors π
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 string as copy of a substring.
Parameters
__strβ source string.__posβ index of first character to copy from.__nβ number of characters to copy (default remainder).
and the same thing but with an allocator, because she likes options:
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]
Construct string as copy of a substring.
Parameters
__strβ source string.__posβ index of first character to copy from.__nβ number of characters to copy.__aβ allocator to use.
character array 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 _CharT * __s,
size_type __n, const _Alloc & __a = _Alloc()) [inline]
Construct 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:__smust have at least__ncharacters,'\0'has no special meaning. like, none. zero. don't come at her with your null terminator assumptions π¨
C string 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 _CharT * __s,
const _Alloc & __a = _Alloc()) [inline]
Construct string as copy of a C string.
Parameters
__sβ source C string.__aβ allocator to use (default is default allocator).
the "n copies of one character" constructor πΈ
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 string as multiple characters.
Parameters
__nβ number of characters.__cβ character to use.__aβ allocator to use (default is default allocator).
the iterator range constructor β¨
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 string as 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. bye bestie, [inline] and [noexcept] on the way out too, classy till the end π«Ά
β¨ MEMBER FUNCTION DOCUMENTATION β¨
append β the range one π¦
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.
References β __gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base >::replace().
append β the whole-string one π
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.
Parameters
__strβ the string to append.
Returns β reference to this string.
References β __gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base >::size().
Referenced by β __gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base >::append(), std::getline(), __gnu_cxx::operator+(), __gnu_cxx::operator+(), __gnu_cxx::operator+(), __gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base >::operator+=(), __gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base >::operator+=(), and __gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base >::operator+=(). she's a collaborator, everyone wants her on the track π
append β the substring one π
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.
Parameters
__strβ the string to append.__posβ index of the first character ofstrto append.__nβ the number of characters to append.
Returns β reference to this string.
ok that's where we're pausing, hold that thought, there's more append coming and I'm not done hyping her up π
Exceptions β std::out_of_range if pos is not a valid index.
This function appends __n characters from __str starting at __pos to this string. If __n is larger than the number of available characters in __str, the remainder of __str is appended. simple, clean, no cap π
append β C string era π
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. yes bestie, just the whole string β¨
- Parameters:
__sβ the C string to append. - Returns: reference to this string.
append β 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 >::append
(const _CharT * __s, size_type __n) [inline]
Append a C substring. a lil slice of the C string, iconic π
- Parameters:
__sβ the C string to append;__nβ the number of characters to append. - Returns: reference to this string.
append β multiple characters, okay?? π
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. we're literally just stacking copies π
- Parameters:
__nβ the number of characters to append;__cβ the character to use. - Returns: reference to this string.
Appends n copies of c to this string.
- References:
__gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base >::size().
append β initializer_list moment β¨
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. the curly-brace girlies ate π
- Parameters:
__lβ theinitializer_listof characters to append. - Returns: reference to this string.
- References:
__gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base >::append().
assign β move assignment but make it cute π
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. moving, not copying β main character energy π
- Parameters:
__strβ source string to use. - Returns: reference to this string.
This function sets this string to the exact contents of __str. __str is a valid, but unspecified string.
- References:
__gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base >::swap().
assign β 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 >::assign (_InputIterator __first, _InputIterator __last) [inline]
Set value to a range of characters. iterators in, vibes out π¦
- Parameters:
__firstβ iterator referencing the first character to append;__lastβ iterator marking the end of the range. - Returns: reference to this string.
Sets value of string to characters in the range [first,last).
- References:
__gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base >::replace().
assign β copy assignment, 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 >::assign
(const __versa_string< _CharT, _Traits, _Alloc, _Base > & __str)
[inline]
Set value to contents of another string. the copy-paste bestie we know and love π
- Parameters:
__strβ source string to use. - Returns: reference to this string.
- Referenced by:
__gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base >::assign(),__gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base >::operator=(),__gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base >::operator=(),__gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base >::operator=(), and__gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base >::operator=().
assign β substring of a string π
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. grab a chunk, leave the rest β¨
- Parameters:
__strβ the string to use;__posβ index of the first character ofstr;__nβ number of characters to use. - Returns: reference to this string.
- Exceptions:
std::out_of_rangeif__posis not a valid index.
This function sets this string to the substring of __str consisting of __n characters at __pos. If __n is larger than the number of available characters in __str, the remainder of __str is used.
- References:
__gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base >::size().
assign β C string, but make it safe π§
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. copied, so no lingering dependence πΈ
- Parameters:
__sβ the C string to use. - Returns: 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.
- References:
__gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base >::size().
assign β C substring, bestie sized π¦
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. first __n characters, periodt π
- Parameters:
__sβ the C string to use;__nβ number of characters to use. - Returns: 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.
- References:
__gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base >::size().
assign β multiple characters, we love a repeat π₯
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. __n copies of __c, no notes π
- Parameters:
__nβ length of the resulting string;__cβ the character to use. - Returns: reference to this string.
This function sets the value of this string to __n copies of character __c.
- References:
__gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base >::size().
assign β initializer_list assigns π
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. curly braces stay winning β¨
- Parameters:
__lβ theinitializer_listof characters to assign. - Returns: reference to this string.
- References:
__gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base >::assign().
at β the safe access era π
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. bounds-checked, because we're responsible π«Ά
- Parameters:
__nβ the index of the character to access. - Returns: read/write reference to the character.
- Exceptions:
std::out_of_rangeif__nis 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.
- References:
__gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base >::size().
at const β same safety, no editing π
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. read-only, look but don't touch π
- Parameters:
__nβ the index of the character to access. - Returns: read-only (
const) reference to the character. - Exceptions:
std::out_of_rangeif__nis 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.
- References:
__gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base >::size().
back const β last character, but make it const π
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. the final girlie, no changes allowed π
- References:
__gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base >::operator[](), and__gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base >::size().
back β last character, now with edits π¦
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. last element said "let me be editable" β¨
- References:
__gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base >::operator[](), and__gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base >::size().
begin const β first character, read-only πΈ
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. peek only, bestie π«Ά
begin β 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. the way that begin() unshares? iconic. π
- Referenced by:
__gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base >::crend(),__gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base >::rend(), and__gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base >::rend().
π c_str() β 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]
Returns a const pointer to the null-terminated contents π. It's a handle to internal data β like, that's the string's actual luggage, not a copy, no cap.
β οΈ Do not modify it or, and I quote, "dire things may happen." Bestie the manpage said dire. Believe it. ππ
π¦ capacity() β how much room before the next glow-up
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 β¨. Think of it as the size of the closet, not the number of outfits currently in it.
Referenced by __gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base >::push_back(), and __gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base >::shrink_to_fit().
π₯ cbegin() β read-only, first character
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 π«Ά. Look, don't touch.
π cend() β read-only, one past the end
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 πΈ. Classic end-of-range icon behavior.
References __gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base >::size().
π§Ή 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 π. Fresh start energy. We love a blank slate.
βοΈ compare(const __versa_string& __str) β the O.G. comparison
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β String to compare against.
Returns
Integer < 0, 0, or > 0.
So here's the tea β: you get an integer < 0 if this string is ordered before __str, 0 if their values are equivalent, or > 0 if this string is ordered after __str. It determines 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 β¨.
References __gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base >::data(), std::min(), and __gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base >::size().
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>=(), and __gnu_cxx::operator>=(). (Yes, three of each β the operators are thriving.)
βοΈ compare(const _CharT * __s) β string vs. 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β 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. Determines the effective length rlen of the strings to compare as the smallest of size() and the length of a string constructed from __s. The function then 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().
βοΈ compare(size_type __pos, size_type __n, const __versa_string& __str) β substring vs. 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 it returns it, otherwise the shorter one is ordered first π«.
References __gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base >::data(), std::min(), and __gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base >::size().
βοΈ compare(size_type __pos, size_type __n1, const _CharT * __s) β substring vs. 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 it returns it, otherwise the shorter one is ordered first πΈ.
References std::min().
βοΈ compare(size_type __pos, size_type __n1, const _CharT * __s, size_type __n2)
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 it returns it, otherwise the shorter one is ordered first π.
π¨ NB:__smust have at leastn2characters,\0has no special meaning. Like, it does not stop at the null. Don't come crying to me when you read past your buffer, bestie. π
References std::min().
βοΈ compare(size_type __pos1, size_type __n1, const __versa_string& __str, size_type __pos2, size_type __n2) β substring vs. substring, the double-feature
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 it returns it, otherwise the shorter one is ordered first π
.
References __gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base >::data(), and std::min().
π€ copy(_CharT * __s, size_type __n, size_type __pos = 0) β dump it 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 π. That's the whole vibe: you get back how many characters actually got copied, so check your receipt.
π crbegin() β read-only, last character first
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 π¦. Main character energy: enters from the back.
References __gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base >::end().
π crend() β read-only, one before the first
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 mirror-universe cend(), and she's slaying.
References __gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base >::begin().
π«Ά data()
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]
Okay bestie, this one hands you a const pointer to the contents β¨ β basically a handle straight into the internal data. And like...
β οΈ Do NOT modify it. The manpage literally says "Do not modify or dire things may happen." Dire!! π That's not a vibe check, that's a threat. Hands off the internals, periodt.
Referenced by: __gnu_cxx::__versa_string<_CharT, _Traits, _Alloc, _Base>::compare() (three times β all the compare() overloads), ::find(), ::find_first_not_of(), ::find_first_of(), ::find_last_of(), and __gnu_cxx::operator==() (both overloads).
π¦ empty()
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] [noexcept]
Returns true if the string is empty β and it's exactly the same thing as *this == '', no cap π
So like, it's giving "is there anything in here or nah".
References: ::size().
πΈ end() β the const one
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]
Gives you a read-only (constant) iterator pointing one past the last character in the string π Classic "the end isn't actually the last character" situation, iykyk.
References: ::size().
π end() β the non-const 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]
Same deal but you get a read/write iterator pointing one past the last character. Only extra detail: it unshares the string π (yes, before you get to poke at it, it makes sure the string is yours alone β main character energy, no sharing).
References: ::size().
Referenced by: ::crbegin(), ::rbegin(), and ::rbegin() again (there are two rbegin() overloads, bestie).
π erase(const_iterator __first, const_iterator __last)
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 whole range of characters π₯
Parameters
__firstβ iterator referencing the first character to remove.__lastβ iterator referencing the end of the range.
Returns: an iterator referencing the location of the first character after removal.
It removes the characters in the range [first,last) from this string. And the glow-up safety guarantee: the value of the string doesn't change if an error is thrown β¨
π§ erase(const_iterator __position)
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]
Just one character, singular, no ensemble π
Parameters
__positionβ iterator referencing the character to remove.
Returns: an iterator referencing the same location after removal.
Removes the character at __position from this string. And again, same promise: the value of the string doesn't change if an error is thrown π«Ά
β erase(size_type __pos = 0, size_type __n = npos)
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]
The index-based erase, and it returns a reference to this string so you can keep chaining π
Parameters
__posβ index of first character to remove (default0).__nβ number of characters to remove (default: the remainder).
Returns: reference to this string.
Exceptions
std::out_of_rangeβ if__posis beyond the end of this string.
So here's the tea: removes __n characters from this string starting at __pos. The length of the string is reduced by __n. If there are < __n characters to remove, the remainder of the string is truncated. If __p is beyond end of string, out_of_range is thrown π¨ And (say it with me) the value of the string doesn't change if an error is thrown.
Referenced by: std::getline().
π find(_CharT __c, size_type __pos = 0)
template<typename _CharT, typename _Traits, typename _Alloc,
template<typename, typename, typename> class _Base>
__gnu_cxx::__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]
Find the position of a single character π
Parameters
__cβ character to locate.__posβ index of character to search from (default0).
Returns: 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 π
π find(const __versa_string& __str, size_type __pos = 0)
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]
Same hunt, but for a whole string π
Parameters
__strβ string to locate.__posβ index of character to search from (default0).
Returns: index of the start of the first occurrence.
Starting from __pos, searches forward for the value of __str within this string. If found, returns the index where it begins. If not found, returns npos.
References: ::data(), ::find(), and ::size().
π find(const _CharT * __s, size_type __pos, size_type __n)
template<typename _CharT, typename _Traits, typename _Alloc,
template<typename, typename, typename> class _Base>
__gnu_cxx::__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
Now we're finding a C substring β notice there's no default for __pos or __n here, bestie, you're giving it all three π«‘
Parameters
__sβ C string to locate.__posβ index of character to search from.__nβ number of characters from__sto search for.
Returns: 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.
Referenced by: ::find(), ::find(), and ::find_first_of().
β¨ find(const _CharT * __s, size_type __pos = 0)
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]
The C-string version, now with the __pos = 0 default restored, we love convenience π
Parameters
__sβ C string to locate.__posβ index of character to search from (default0).
Returns: index of the start of the first occurrence.
Starting from __pos, searches forward for the value of __s within this string. If found, returns the index where it begins. If not found, returns npos.
References: ::find().
π find_first_not_of(_CharT __c, size_type __pos = 0)
template<typename _CharT, typename _Traits, typename _Alloc,
template<typename, typename, typename> class _Base>
__gnu_cxx::__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]
The opposite hunt β find the position of a different character π
Parameters
__cβ character to avoid.__posβ index of character to search from (default0).
Returns: index of the first occurrence.
Starting from __pos, searches forward for a character other than __c within this string. Found one? Returns the index where it was found. None? Returns npos.
π§ find_first_not_of(const __versa_string& __str, size_type __pos = 0)
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]
Find a character that is not in the given string π
Parameters
__strβ string containing characters to avoid.__posβ index of character to search from (default0).
Returns: index of the first occurrence.
Starting from __pos, searches forward for a character not contained in __str within this string. If found, returns the index where it was found. If not found, returns npos.
References: ::data(), ::find_first_not_of(), and ::size().
Referenced by: ::find_first_not_of() and ::find_first_not_of() (two more overloads, it's a whole family π«Ά).
π₯ find_first_not_of(const _CharT * __s, size_type __pos, size_type __n)
template<typename _CharT, typename _Traits, typename _Alloc,
template<typename, typename, typename> class _Base>
__gnu_cxx::__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
Find a character not in a C substring β again, no defaults for __pos and __n, you're on your own for those two π
Parameters
__sβ C string containing characters to avoid.__posβ index of character to search from.__nβ number of characters fromsto consider.
Returns: index of the first occurrence.
Starting from __pos, searches forward for a character 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.
πΈ find_first_not_of(const _CharT * __s, size_type __pos = 0)
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]
Find a character not in a C string, with the default __pos = 0 back where it belongs β¨
Parameters
__sβ C string containing characters to avoid.__posβ index of character to search from (default0).
Returns: index of the first occurrence.
Starting from __pos, searches forward for a character not contained in __s within this string. If found, returns the index where it was found. If not found, returns npos.
References: __gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base >::find_first_not_of().
π
find_first_of β bestie, where's the first match?
πΈ find_first_of (_CharT __c, size_type __pos = 0) β 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
>::find_first_of (_CharT __c, size_type __pos = 0) const [inline],
[noexcept]
Find position of a character. Literally just one lil char hunt π
Parameters
__cβ the character to locate, i.e. the one you're simping for.__posβ index of the character to search from (default0).
Returns β index of first occurrence. That's it, that's the whole vibe.
Starting from __pos, it searches forward for the character __c within this string. If found, returns the index where it was found. If not found, returns npos (sad girl hours π).
Note: equivalent to find(c, pos).
References: __gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base >::find().
π¦ find_first_of (const __versa_string& __str, size_type __pos = 0) β 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
>::find_first_of (const __versa_string< _CharT, _Traits, _Alloc, _Base >
& __str, size_type __pos = 0) const [inline], [noexcept]
Find position of a character of string. Now we're hunting for any one of a whole squad of characters β¨
Parameters
__strβ the string containing the characters to locate.__posβ index of the character to search from (default0).
Returns β index of first occurrence.
Starting from __pos, it searches forward for one of the characters of __str within this string. Found one? Returns the index. Nope, nothing? Returns npos.
References: __gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base >::data(), __gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base >::find_first_of(), and __gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base >::size().
Referenced by: __gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base >::find_first_of(), and __gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base >::find_first_of().
π find_first_of (const _CharT* __s, size_type __pos, size_type __n)
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
Find position of a character of C substring. Same energy, but you're telling it exactly how many characters to look at π
Parameters
__sβ string containing the characters to locate.__posβ index of the character to search from.__nβ number of characters fromsto search for.
Returns β index of first occurrence.
Starting from __pos, it 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.
π§ find_first_of (const _CharT* __s, size_type __pos = 0) β 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
>::find_first_of (const _CharT * __s, size_type __pos = 0) const
[inline]
Find position of a character of C string. The classic no-count version, she's convenient like that π«Ά
Parameters
__sβ string containing the characters to locate.__posβ index of the character to search from (default0).
Returns β index of first occurrence.
Starting from __pos, it searches forward for one of the characters of __s within this string. If found, returns the index where it was found. If not found, returns npos.
References: __gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base >::find_first_of().
π find_last_not_of β the "anything but that" girlie
π find_last_not_of (_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 >::find_last_not_of (_CharT __c, size_type __pos
= npos) const [noexcept]
Find last position of a different character. She's looking backwards and she's picky β not this one, literally anything else bestie π
Parameters
__cβ character to avoid. (We don't do that here.)__posβ index of the character to search back from (default end).
Returns β index of last occurrence.
Starting from __pos, it 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.
β find_last_not_of (const __versa_string& __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
>::find_last_not_of (const __versa_string< _CharT, _Traits, _Alloc,
_Base > & __str, size_type __pos = npos) const [inline], [noexcept]
Find last position of a character not in string. Whole-string avoid list, we love a boundary π
Parameters
__strβ string containing the characters to avoid.__posβ index of the character to search back from (default end).
Returns β index of last occurrence.
Starting from __pos, it searches backward for a character not contained in __str within this string. If found, returns the index where it was found. If not found, returns npos.
References: __gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base >::find_last_not_of().
Referenced by: __gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base >::find_last_not_of(), and __gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base >::find_last_not_of().
π find_last_not_of (const _CharT* __s, size_type __pos, size_type __n)
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. Bounded avoid-list, very demure, very mindful π
Parameters
__sβ C string containing the characters to avoid.__posβ index of the character to search back from.__nβ number of characters fromsto consider.
Returns β index of last occurrence.
Starting from __pos, it searches backward for a character 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.
π find_last_not_of (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
>::find_last_not_of (const _CharT * __s, size_type __pos = npos) const
[inline]
Find last position of a character not in C string. The low-effort version β just hand her the C string and go β¨
Parameters
__sβ C string containing the characters to avoid.__posβ index of the character to search back from (default end).
Returns β index of last occurrence.
Starting from __pos, it 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.
References: __gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base >::find_last_not_of().
π₯ find_last_of β searching backwards for the moment
πΈ find_last_of (_CharT __c, 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
>::find_last_of (_CharT __c, size_type __pos = npos) const [inline],
[noexcept]
Find last position of a character. One char, but from the back π
Parameters
__cβ character to locate.__posβ index of the character to search back from (default end).
Returns β index of last occurrence.
Starting from __pos, it searches backward for __c within this string. If found, returns the index where it was found. If not found, returns npos.
Note: equivalent to rfind(c, pos).
References: __gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base >::rfind().
π¦ find_last_of (const __versa_string& __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
>::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. Backwards hunt through a whole squad π
Parameters
__strβ string containing the characters to locate.__posβ index of the character to search back from (default end).
Returns β index of last occurrence.
Starting from __pos, it 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.
References: __gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base >::data(), __gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base >::find_last_of(), and __gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base >::size().
Referenced by: __gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base >::find_last_of(), and __gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base >::find_last_of().
π§ find_last_of (const _CharT* __s, size_type __pos, size_type __n)
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. Backwards, but only within the first __n chars of __s β boundaries are hot π₯
Parameters
__sβ C string containing the characters to locate.__posβ index of the character to search back from.__nβ number of characters fromsto search for.
Returns β index of last occurrence.
Starting from __pos, it 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.
β find_last_of (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
>::find_last_of (const _CharT * __s, size_type __pos = npos) const
[inline]
Find last position of a character of C string. Give her the whole C string, she'll do the rest π«Ά
Parameters
__sβ C string containing the characters to locate.__posβ index of the character to search back from (default end).
Returns β index of last occurrence.
Starting from __pos, it 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.
References: __gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base >::find_last_of().
π front β the first character, main character energy
π front β const, [inline], [noexcept]
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, don't touch πβ¨
References: __gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base >::operator[]().
π front
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 touch β go off, edit that first character π π₯
References __gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base >::operator[]().
(that trailing bit is just the receipts from the entry right above it, bestie β it references operator[], slay π
)
get_allocator π
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]
Returns a copy of the allocator that was used to construct this string. That's the whole thing β a little allocator souvenir π
insert β one single 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]
Inserts exactly one character. Lowkey the simplest insert there is β¨
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 exceedsmax_size().
So: it inserts __c at the position referenced by __p. If adding that character makes the length exceed max_size(), length_error gets thrown. And if __p is beyond end of string, out_of_range is thrown. Either way, the value of the string doesn't change if an error is thrown β she's not messy like that π
insert β a whole range of characters π¦
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]
Inserts a range of characters. Group-chat energy: bring the whole squad in π
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 exceedsmax_size().
It inserts the characters in the range [beg,end). If adding those characters makes the length exceed max_size(), length_error is thrown. And bestie, the value of the string doesn't change if an error is thrown β no half-finished edits, periodt.
References __gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base >::replace().
insert β multiple characters, iterator edition π
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]
Inserts multiple copies of one character. It's giving "copy paste but make it C++" π
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 exceedsmax_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. And yep β the value of the string doesn't change if an error is thrown.
References __gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base >::replace().
Referenced by __gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base >::insert().
insert β initializer_list edition π
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]
Inserts an initializer_list of characters. Curly braces girlies, this one's for you β¨
Parameters
__pβ const_iterator referencing the location in the string to insert at.__lβ theinitializer_listof characters to insert.
Returns
- Iterator referencing the first inserted char.
Exceptions
std::length_errorβ if the new length exceedsmax_size().
References __gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base >::insert().
insert β a C string goes in π
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]
Inserts a C string. Classic, iconic, no notes π
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 exceedsmax_size().std::out_of_rangeβ if__posis beyond the end of this string.
It 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. And fr fr β the value of the string doesn't change if an error is thrown.
References __gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base >::replace().
insert β a C substring, with a length this time π§
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]
Inserts a C substring. Same vibe, but you tell her exactly how many chars to take π
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 exceedsmax_size().std::out_of_rangeβ if__posis 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. And again, bestie: the value of the string doesn't change if an error is thrown π
References __gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base >::replace().
insert β n copies of a char at an index π
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]
Insert multiple characters, but this time you're working with an index instead of an iterator. Main character energy π₯
Parameters
__posβ index in string to insert at.__nβ number of characters to insert.__cβ the character to insert.
Returns
- Reference to this string.
Exceptions
std::length_errorβ if the new length exceedsmax_size().std::out_of_rangeβ if__posis beyond the end of this string.
Inserts __n copies of character __c, starting at index __pos. If adding characters causes the length to exceed max_size(), length_error is thrown. If __pos > length(), out_of_range is thrown. And yup β the value of the string doesn't change if an error is thrown β¨
insert β jam a whole string in there π
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]
Inserts the value of a string. String-ception, we love to see it π¦
Parameters
__pos1β iterator referencing the location in the string to insert at.__strβ the string to insert.
Returns
- Reference to this string.
Exceptions
std::length_errorβ if the new length exceedsmax_size().
Inserts the value of __str, starting at __pos1. If adding characters causes the length to exceed max_size(), length_error is thrown. And obviously β the value of the string doesn't change if an error is thrown π
References __gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base >::replace(), and __gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base >::size().
insert β the full substring situation πΈ
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]
Inserts a substring β the most specific of the insert girlies and honestly? Obsessed π
Parameters
__pos1β iterator referencing the location in the string to insert at.__strβ the string to insert.__pos2β start of characters in str to insert.__nβ number of characters to insert.
Returns
- Reference to this string.
Exceptions
std::length_errorβ if the new length exceedsmax_size().std::out_of_rangeβ if__pos1 > size()or__pos2 > __str.size().
Starting at __pos1, insert __n character of __str beginning with __pos2. If adding characters causes the length to exceed max_size(), length_error is thrown. If __pos1 is beyond the end of this string, or __pos2 is beyond the end of __str, out_of_range is thrown. And yes, one more time for the people in the back: the value of the string doesn't change if an error is thrown π
References __gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base >::replace().
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 β not including any null-termination. That null terminator is not invited to the count π
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. Big "how much can she hold" energy π
Referenced by std::getline().
operator+= β append a 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]
Appends a single character. Tiny little add, big little slay β¨
Parameters
__cβ the character to append.
Returns
- Reference to this string.
References __gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base >::push_back().
operator+= β append a 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 __versa_string< _CharT, _Traits, _Alloc, _Base > & __str)
[inline]
Appends a string to this string. Two strings becoming one, it's giving soulmate behaviour π
Parameters
__strβ the string to append.
Returns
- Reference to this string.
References __gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base >::append().
operator+= β append a 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]
Appends a C string. The OG char pointer gets to join the party too π
Parameters
__sβ the C string to append.
Returns
- Reference to this string.
References __gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base >::append().
π
operator+= (the initializer_list one)
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]
okay so this one just appends an entire initializer_list of characters onto your string, bestie β¨
- Parameters β
__l: theinitializer_listof characters you're slapping on the end. - Returns β a reference to this string. π«Ά
References: __gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base >::append().
π 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]
the string move assignment operator, and she's noexcept so she's not about to throw hands π
- Parameters β
__str: the source string.
the contents of __str get moved into this string β without copying, periodt. and after that, __str is described as a valid, but unspecified string. (translation: don't go poking at it expecting the old contents, she's been through something π)
References: __gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base >::swap().
π€ 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 the value to a string of length 1. literally one character era π
- Parameters β
__c: the source character.
assigning to a character makes this string length 1, and (*this)[0] == __c. no cap.
References: __gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base >::assign().
π 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. the classic. the icon. πΈ
- Parameters β
__str: the source string.
References: __gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base >::assign().
πͺ’ 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 the contents of __s into this string π¦
- Parameters β
__s: source null-terminated string.
References: __gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base >::assign().
π 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]
sets the value to a string constructed from an initializer list β¨
- Parameters β
__l:std::initializer_list.
References: __gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base >::assign().
π operator[] (const version)
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 inside the string β the read-only, behave-yourself version π
- Parameters β
__pos: the index of the character you want to access. - Returns β a read-only (constant) reference to that character.
this operator gives you easy, array-style, data access. but β and this is the important bit, bestie β data access with this operator is unchecked, and out_of_range lookups are not defined. π (for checked lookups, go see at().)
References: __gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base >::size().
Referenced by: __gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base >::back(), __gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base >::back(), __gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base >::front(), and __gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base >::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 inside the string, but this time you get to write π
- Parameters β
__pos: the index of the character you're accessing. - Returns β a read/write reference to the character.
same deal as above: easy, array-style, data access. and again β data access with this operator is unchecked, out_of_range lookups are not defined, and for checked lookups you want at(). one extra thing: this version unshares the string π₯
References: __gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base >::size().
βοΈ 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]
removes the last character. and heads up: the string must be non-empty β οΈ don't come crying to me if you pop an empty string, I warned you.
References: __gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base >::size().
β 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]
appends a single character. tiny little addition, huge slay π
- Parameters β
__c: the character to append.
References: __gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base >::capacity(), and __gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base >::size().
Referenced by: __gnu_cxx::operator+(), __gnu_cxx::operator+(), and __gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base >::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 pointing at the last character in the string. iteration happens in reverse element order, which is exactly the vibe π¦
References: __gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base >::end().
π rbegin (read/write)
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 pointing at the last character in the string. iteration is in reverse element order. and yes β it unshares the string π
References: __gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base >::end().
π 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 pointing to one before the first character in the string. iteration's in reverse element order, as always β¨
References: __gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base >::begin().
π¬ rend (read/write)
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 pointing to one before the first character in the string. reverse element order, obviously. and it unshares the string πΈ
References: __gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base >::begin().
π©Ή replace β range with range
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 a range of characters with another range β the swap-your-whole-situation move π
- Parameters
__i1: iterator referencing the start of the range to replace.__i2: iterator referencing the end of the range to replace.__k1: iterator referencing the start of the range to insert.__k2: iterator referencing the end of the range to insert.
- Returns β a reference to this string.
- Exceptions β
std::length_errorif the new length exceedsmax_size().
here's the tea: it removes the characters in the range [i1,i2), and in place the characters in the range [k1,k2) get inserted. if the resulting length exceeds max_size(), length_error gets thrown. and good news β the value of the string doesn't change if an error is thrown π«Ά
π©Ή replace β range with string
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 a range of characters with an entire string π
- Parameters
__i1: iterator referencing the start of the range to replace.__i2: iterator referencing the end of the range to replace.__str: the string value to insert.
- Returns β a reference to this string.
- Exceptions β
std::length_errorif the new length exceedsmax_size().
it removes the characters in [i1,i2) and, in place, inserts the value of __str. if the result is longer than max_size(), length_error is thrown. the string's value stays untouched if an error is thrown π
References: __gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base >::replace(), and __gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base >::size().
π©Ή replace β range with 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 >::replace
(const_iterator __i1, const_iterator __i2, const _CharT * __s) [inline]
replace a range of characters with a C string β¨
- Parameters
__i1: iterator referencing the start of the range to replace.__i2: iterator referencing the end of the range to replace.__s: the C string value to insert.
- Returns β a reference to this string.
- Exceptions β
std::length_errorif the new length exceedsmax_size().
kicks out the characters in [i1,i2) and drops in the characters of __s in their place. over max_size()? that's a length_error. and if an error's thrown, the string value does not change π
References: __gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base >::replace().
π©Ή replace β range with C substring
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 a range of characters with a C substring β yes, she takes an __n too, she's thorough π
Parameters πΈ
__i1β iterator pointing at the start of the range you're replacing. Like, where the swap-out begins, bestie.__i2β iterator pointing at the end of that range. One past the last character getting yeeted.__sβ the C string value you're inserting. π__nβ number of characters fromsto insert.
Returns π
Reference to this string. Chaining vibes, fr fr.
Exceptions π
std::length_errorβ if the new length exceedsmax_size().
Removes the characters in the range [i1,i2). In place, the first n characters of __s are inserted. If the length of result exceeds max_size(), length_error is thrown. The value of the string doesn't change if an error is thrown.
References π
__gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base >::replace().
β¨ another replace overload: iterator range + count + character β¨
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. Iconic behavior, no cap.
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 exceedsmax_size().
Removes the characters in the range [i1,i2). In place, __n copies of __c are inserted. If the length of result exceeds max_size(), length_error is thrown. The value of the string doesn't change if an error is thrown.
π replace overload: iterator range + 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 >::replace
(const_iterator __i1, const_iterator __i2, std::initializer_list< _CharT
> __l) [inline]
Replace range of characters with initializer_list. Very cute, very curated. π
Parameters πΈ
__i1β iterator referencing start of range to replace.__i2β iterator referencing end of range to replace.__lβ theinitializer_listof characters to insert.
Returns π
Reference to this string.
Exceptions π
std::length_errorβ if new length exceedsmax_size().
Removes the characters in the range [i1,i2). In place, characters in the range [k1,k2) are inserted. If the length of result exceeds max_size(), length_error is thrown. The value of the string doesn't change if an error is thrown.
References π
__gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base >::replace().
π¦ replace overload: index + count + another string π¦
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. It's giving copy-paste but make it C++.
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__posis beyond the end of this string.std::length_errorβ if new length exceedsmax_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 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.
References π
__gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base >::replace()__gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base >::size()
Referenced by (yes, all of these, no cap) π₯
__gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base >::append()__gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base >::assign()__gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base >::insert()__gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base >::insert()__gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base >::insert()__gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base >::insert()__gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base >::insert()__gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base >::insert()__gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base >::replace()__gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base >::replace()__gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base >::replace()__gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base >::replace()__gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base >::replace()__gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base >::replace()__gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base >::replace()
π replace overload: index + count + 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 >::replace
(size_type __pos, size_type __n1, const _CharT * __s) [inline]
Replace characters with value of a C string. Very main character, very null-terminated. β¨
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 exceedsmax_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 end of string, out_of_range is thrown. If the length of result exceeds max_size(), length_error is thrown.
The value of the string doesn't change if an error is thrown.
References π
__gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base >::replace().
π replace overload: index + count + C substring + count π
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. It's giving "only take the first few chars, bestie." π¦
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__sto use.
Returns π«Ά
Reference to this string.
Exceptions π
std::out_of_rangeβ if__pos1 > size().std::length_errorβ if new length exceedsmax_size().
Removes the characters in the range [pos,pos + n1) from this string. In place, the first __n2 characters of __s are inserted, or all of __s if __n2 is too large. If __pos is beyond end of string, out_of_range is thrown. If the length of result exceeds max_size(), length_error is thrown. The value of the string doesn't change if an error is thrown.
β replace overload: index + counts + character β
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. Same char, multiple times. We love a repeat moment. π
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 exceedsmax_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 end of string, out_of_range is thrown. If the length of result exceeds max_size(), length_error is thrown. The value of the string doesn't change if an error is thrown.
π replace overload: index + count + string + index + count π
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. This one takes a whole little slice of __str, iykyk.
Parameters π§
__pos1β index of first character to replace.__n1β number of characters to be replaced.__strβ string to insert.__pos2β index of first character ofstrto use.__n2β number of characters fromstrto use.
Returns π«Ά
Reference to this string.
Exceptions π
std::out_of_rangeβ if__pos1 > size()or__pos2 > str.size().std::length_errorβ if new length exceedsmax_size().
Removes 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.
References π
__gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base >::replace().
π reserve β preallocate like a planner π
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. Future-proofing vibes, honestly. β¨
Parameters πΈ
__res_argβ number of characters required.
Exceptions π
std::length_errorβ if__res_argexceedsmax_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.
Referenced by π₯
__gnu_cxx::operator+()__gnu_cxx::operator+()__gnu_cxx::operator+()__gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base >::shrink_to_fit()
π¦ resize β change the character count π¦
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. Glow-up or shrink-down, either way. π
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.
References π
__gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base >::resize().
okay bestie, we're in the final stretch of the member functions and it's giving completionist energy β¨ let's close this out π
resize β the glow-up/glow-down πββοΈ
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. iconic.
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.
Referenced by __gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base >::resize(). (yes, it references itself, main character energy fr fr)
rfind (char) β last seen at the function, literally π
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.
rfind (string) β bestie, where was the last time you saw this? π«Ά
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.
References
__gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base >::rfind()
Referenced by
__gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base >::find_last_of()__gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base >::rfind()__gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base >::rfind()
rfind (C substring) β the "last seen with a length" 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 >::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 fromsto 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()
rfind (C string) β no length, just vibes β¨
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.
References
__gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base >::rfind()
shrink_to_fit β the "reduce capacity to size" hint, non-binding bestie π
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().
References
__gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base >::capacity()__gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base >::reserve()__gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base >::size()
size β the character count, no nulls invited π«
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.
Referenced by
__gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base >::append()__gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base >::append()__gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base >::assign()__gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base >::assign()__gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base >::assign()__gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base >::assign()__gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base >::at()__gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base >::at()__gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base >::back()__gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base >::back()__gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base >::cend()__gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base >::compare()__gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base >::compare()__gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base >::empty()__gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base >::end()__gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base >::end()__gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base >::find()__gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base >::find_first_not_of()__gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base >::find_first_of()__gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base >::find_last_of()__gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base >::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< _CharT, _Traits, _Alloc, _Base >::operator[]()__gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base >::operator[]()__gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base >::pop_back()__gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base >::push_back()__gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base >::replace()__gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base >::replace()__gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base >::shrink_to_fit()
substr β get a little slice of the string π°
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_rangeifpos > 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.
swap β trade contents in constant time, no cap πββοΈ
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.
Referenced by
__gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base >::assign()__gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base >::operator=()__gnu_cxx::swap()
π Member Data Documentation π
npos β the value returned when things fail π
template<typename _CharT , typename _Traits , typename _Alloc , template<
typename, typename, typename > class _Base> const __versa_string<
_CharT, _Traits, _Alloc, _Base >::size_type __gnu_cxx::__versa_string<
_CharT, _Traits, _Alloc, _Base >::npos [static]
Value returned by various member functions when they fail.
πΈ Author πΈ
Generated automatically by Doxygen for libstdc++ from the source code.
And that's the whole page, bestie π
the footer line is your classic libstd__gnu_cxx::__v..._Alloc, _Base >(3cxx) version/date stamp β shoutout to Doxygen for auto-generating this for libstdc++ from the source code, periodt. π«Άβ¨
π¦ where this page comes from
- ubuntu noble: libstdc++-14-doc 14-20240412-0ubuntu1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms