__GNU_CXX::__VERSA_STRING(3)
πΈ __gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base > πΈ
okay bestie, welcome to a Library Functions Manual moment, section 3, and it's giving very much "template class" energy. this is the page for __gnu_cxx::__versa_string, and no, it's not a weird string that tells you your future β it's a whole template class. we're doing this in 10 parts because it's long, so buckle up, hydrate, and let's go π
β¨ NAME β¨
__gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base > β Template class __versa_string. that's it, that's the name, iconic, no notes π
β¨ SYNOPSIS β¨
first things first, you gotta pull it in:
#include <vstring.h>
π Public Types π
okay so this class has a whole wardrobe of public typedefs and honestly? every single one of them matters. not me listing all thirteen of them, but here we are, because we keep every detail in this house π«Ά
typedef _Alloc allocator_typeβ the allocator, but make it a type name you can actually say out loud.typedef __gnu_cxx::__normal_iterator< const_pointer, __versa_string > const_iteratorβ your iterator for when you're just looking, not touching. read-only queen πtypedef _CharT_alloc_traits::const_pointer const_pointerβ a pointer that refuses to let you change anything. boundaries, we love them.typedef const value_type & const_referenceβ a reference to aconst value_type. no edits allowed, periodt.typedef std::reverse_iterator< const_iterator > const_reverse_iteratorβ same const iterator vibe, but it walks backwards. main character entrance but in reverse πtypedef _CharT_alloc_type::difference_type difference_typeβ the type used for differences, like when you're subtracting one thing from another.typedef __gnu_cxx::__normal_iterator< pointer, __versa_string > iteratorβ the iterator that can touch things. full permissions, unlocked β¨typedef _CharT_alloc_traits::pointer pointerβ a regular pointer type, courtesy of_CharT_alloc_traits.typedef value_type & referenceβ a reference to avalue_type, and yeah you can change stuff through it.typedef std::reverse_iterator< iterator > reverse_iteratorβ a mutable iterator but it goes backwards. lowkey chaotic, highkey useful π¦typedef _CharT_alloc_type::size_type size_typeβ the type for sizes, brought to you by_CharT_alloc_type.typedef _Traits traits_typeβ the traits, just renamed so it's cute and short.typedef _Traits::char_type value_typeβ the character type, straight out of_Traits, and this is thevalue_typeeverything else is built around. the blueprint, fr fr π
and that's just part 1 bestie, we're literally only getting started β more sections coming right up π
π Public Member Functions π
okay bestie, this is the main character energy list of everything this string can do. every single one, no skips, periodt. π
__versa_string (__versa_string &&__str) noexceptβ String move constructor. it's giving move semantics, slay. β¨- Signature:
template<class _InputIterator, typename =
std::_RequireInputIter<_InputIterator>> __versa_string
(_InputIterator __beg, _InputIterator __end, const _Alloc
&__a=_Alloc())
β Construct string as copy of a range. lowkey range vibes, bestie. π¦
__versa_string (const __versa_string &__str)β Construct string with copy of value of __str. copy queen behavior. π__versa_string (const __versa_string &__str, size_type __pos, size_type __n, const _Alloc &__a)β Construct string as copy of a substring. it's a substring moment. π__versa_string (const __versa_string &__str, size_type __pos, size_type __n=npos)β Construct string as copy of a substring. same vibe, but with a default npos. π__versa_string (const _Alloc &__a=_Alloc()) noexceptβ Construct an empty string using allocator a. empty but iconic. π__versa_string (const _CharT *__s, const _Alloc &__a=_Alloc())β Construct string as copy of a C string. C string energy. π__versa_string (const _CharT *__s, size_type __n, const _Alloc &__a=_Alloc())β Construct string initialized by a character array. array to string, no cap. π₯__versa_string (size_type __n, _CharT __c, const _Alloc &__a=_Alloc())β Construct string as multiple characters. multiple characters, we love to see it. π__versa_string (std::initializer_list< _CharT > __l, const _Alloc &__a=_Alloc())β Construct string from an initializer list. initializer list realness. β¨~__versa_string () noexceptβ Destroy the string instance. it's the end of an era, but noexcept so no drama. π- Signature:
template<typename _InputIterator> __versa_string< _CharT, _Traits,
_Alloc, _Base > & _M_replace_dispatch (const_iterator __i1,
const_iterator __i2, _InputIterator __k1, _InputIterator __k2,
std::__false_type)
β (no description, just vibes) π
- Signature:
template<class _InputIterator, typename =
std::_RequireInputIter<_InputIterator>> __versa_string & append
(_InputIterator __first, _InputIterator __last)
β Append a range of characters. append range, slay. π
__versa_string & append (const __versa_string &__str)β Append a string to this string. append string to this string. π__versa_string & append (const __versa_string &__str, size_type __pos, size_type __n)β Append a substring. substring append. π__versa_string & append (const _CharT *__s)β Append a C string. C string append. π__versa_string & append (const _CharT *__s, size_type __n)β Append a C substring. C substring append. β__versa_string & append (size_type __n, _CharT __c)β Append multiple characters. multiple chars go brrr. π__versa_string & append (std::initializer_list< _CharT > __l)β Append an initializer_list of characters. init list append. π__versa_string & assign (__versa_string &&__str) noexceptβ Set value to contents of another string. assign move, no cap. π₯- Signature:
template<class _InputIterator, typename =
std::_RequireInputIter<_InputIterator>> __versa_string & assign
(_InputIterator __first, _InputIterator __last)
β Set value to a range of characters. assign range. π
__versa_string & assign (const __versa_string &__str)β Set value to contents of another string. assign copy. π__versa_string & assign (const __versa_string &__str, size_type __pos, size_type __n)β Set value to a substring of a string. assign substring. β€οΈ__versa_string & assign (const _CharT *__s)β Set value to contents of a C string. assign C string. π__versa_string & assign (const _CharT *__s, size_type __n)β Set value to a C substring. assign C substring. π__versa_string & assign (size_type __n, _CharT __c)β Set value to multiple characters. assign multiple. π__versa_string & assign (std::initializer_list< _CharT > __l)β Set value to an initializer_list of characters. assign init list. π¦reference at (size_type __n)β Provides access to the data contained in the string. at access. πconst_reference at (size_type __n) constβ Provides access to the data contained in the string. const at access. πconst_reference back () const noexceptβ (no description, just vibes) πreference back () noexceptβ (no description, just vibes) π₯const_iterator begin () const noexceptβ (no description, just vibes) β¨iterator begin () noexceptβ (no description, just vibes) πconst _CharT * c_str () const noexceptβ Return const pointer to null-terminated contents. c_str for the C string girlies. πsize_type capacity () const noexceptβ (no description, just vibes) πconst_iterator cbegin () const noexceptβ (no description, just vibes) πconst_iterator cend () const noexceptβ (no description, just vibes) π¦void clear () noexceptβ (no description, just vibes) π§Ήint compare (const __versa_string &__str) constβ Compare to a string. compare string. π₯int compare (const _CharT *__s) constβ Compare to a C string. compare C string. π- Signature:
int compare (size_type __pos, size_type __n, const __versa_string
&__str) const
β Compare substring to a string. compare substring to string. π
int compare (size_type __pos, size_type __n1, const _CharT *__s) constβ Compare substring to a C string. compare substring to C string. β€οΈ- Signature:
int compare (size_type __pos, size_type __n1, const _CharT *__s,
size_type __n2) const
β Compare substring against a character array. compare against char array. π
- Signature:
int compare (size_type __pos1, size_type __n1, const __versa_string
&__str, size_type __pos2, size_type __n2) const
β Compare substring to a substring. compare substring to substring. π
size_type copy (_CharT *__s, size_type __n, size_type __pos=0) constβ Copy substring into C string. copy into C string. πconst_reverse_iterator crbegin () const noexceptβ (no description, just vibes) π¦const_reverse_iterator crend () const noexceptβ (no description, just vibes) πΈconst _CharT * data () const noexceptβ Return const pointer to contents. data pointer. πbool empty () const noexceptβ (no description, just vibes) π«Άconst_iterator end () const noexceptβ (no description, just vibes) β¨iterator end () noexceptβ (no description, just vibes) π₯iterator erase (const_iterator __first, const_iterator __last)β Remove a range of characters. erase range. βiterator erase (const_iterator __position)β Remove one character. erase one. π__versa_string & erase (size_type __pos=0, size_type __n=npos)β Remove characters. erase chars. πsize_type find (_CharT __c, size_type __pos=0) const noexceptβ Find position of a character. find char. π₯- Signature:
size_type find (const __versa_string &__str, size_type __pos=0) const
noexcept
β Find position of a string. find string. π
size_type find (const _CharT *__s, size_type __pos, size_type __n) constβ Find position of a C substring. find C substring. πsize_type find (const _CharT *__s, size_type __pos=0) constβ Find position of a C string. find C string. β€οΈsize_type find_first_not_of (_CharT __c, size_type __pos=0) const noexceptβ Find position of a different character. find first not of char. π- Signature:
size_type find_first_not_of (const __versa_string &__str, size_type
__pos=0) const noexcept
β Find position of a character not in string. find first not of string. π
- Signature:
size_type find_first_not_of (const _CharT *__s, size_type __pos,
size_type __n) const
β Find position of a character not in C substring. find first not of C substring. π
size_type find_first_not_of (const _CharT *__s, size_type __pos=0) constβ Find position of a character not in C string. find first not of C string. π¦size_type find_first_of (_CharT __c, size_type __pos=0) const noexceptβ Find position of a character. find first of char. β- Signature:
size_type find_first_of (const __versa_string &__str, size_type __pos=0)
const noexcept
β Find position of a character of string. find first of string. π
- Signature:
size_type find_first_of (const _CharT *__s, size_type __pos, size_type
__n) const
β Find position of a character of C substring. find first of C substring. π
size_type find_first_of (const _CharT *__s, size_type __pos=0) constβ Find position of a character of C string. find first of C string. π₯- Signature:
size_type find_last_not_of (_CharT __c, size_type __pos=npos) const
noexcept
β Find last position of a different character. find last not of char. π
- Signature:
size_type find_last_not_of (const __versa_string &__str, size_type
__pos=npos) const noexcept
β Find last position of a character not in string. find last not of string. π
- Signature:
size_type find_last_not_of (const _CharT *__s, size_type __pos,
size_type __n) const
β Find last position of a character not in C substring. find last not of C substring. β€οΈ
- Signature:
size_type find_last_not_of (const _CharT *__s, size_type __pos=npos)
const
β Find last position of a character not in C string. find last not of C string. π
size_type find_last_of (_CharT __c, size_type __pos=npos) const noexceptβ Find last position of a character. find last of char. π- Signature:
size_type find_last_of (const __versa_string &__str, size_type
__pos=npos) const noexcept
β Find last position of a character of string. find last of string. π
- Signature:
size_type find_last_of (const _CharT *__s, size_type __pos, size_type
__n) const
β Find last position of a character of C substring. find last of C substring. π¦
size_type find_last_of (const _CharT *__s, size_type __pos=npos) constβ Find last position of a character of C string. find last of C string. βconst_reference front () const noexceptβ (no description, just vibes) πreference front () noexceptβ (no description, just vibes) πallocator_type get_allocator () const noexceptβ Return copy of allocator used to construct this string. get allocator. πiterator insert (const_iterator __p, _CharT __c)β Insert one character. insert one char. π- Signature:
template<class _InputIterator, typename =
std::_RequireInputIter<_InputIterator>> iterator insert
(const_iterator __p, _InputIterator __beg, _InputIterator __end)
β Insert a range of characters. insert range. π₯
iterator insert (const_iterator __p, size_type __n, _CharT __c)β Insert multiple characters. insert multiple chars. π- Signature:
iterator insert (const_iterator __p, std::initializer_list< _CharT >
__l)
β Insert an initializer_list of characters. insert init list. π
__versa_string & insert (size_type __pos, const _CharT *__s)β Insert a C string. insert C string. β€οΈ__versa_string & insert (size_type __pos, const _CharT *__s, size_type __n)β Insert a C substring. insert C substring. π__versa_string & insert (size_type __pos, size_type __n, _CharT __c)β Insert multiple characters. insert multiple chars. π__versa_string & insert (size_type __pos1, const __versa_string &__str)β Insert value of a string. insert string. π- Signature:
__versa_string & insert (size_type __pos1, const __versa_string &__str,
size_type __pos2, size_type __n)
β Insert a substring. insert substring. π¦
size_type length () const noexceptβ Returns the number of characters in the string, not including any null-termination. length. βsize_type max_size () const noexceptβ Returns the size() of the largest possible string. max size. π__versa_string & operator+= (_CharT __c)β Append a character. operator+= char. π__versa_string & operator+= (const __versa_string &__str)β Append a string to this string. operator+= string. π₯__versa_string & operator+= (const _CharT *__s)β Append a C string. operator+= C string. π__versa_string & operator+= (std::initializer_list< _CharT > __l)β Append an initializer_list of characters. operator+= init list. π__versa_string & operator= (__versa_string &&__str) noexceptβ String move assignment operator. move assignment. β€οΈ__versa_string & operator= (_CharT __c)β Set value to string of length 1. assign char. π__versa_string & operator= (const __versa_string &__str)β Assign the value of str to this string. assign string. π__versa_string & operator= (const _CharT *__s)β Copy contents of __s into this string. assign C string. π__versa_string & operator= (std::initializer_list< _CharT > __l)β Set value to string constructed from initializer list. assign init list. π¦const_reference operator[] (size_type __pos) const noexceptβ Subscript access to the data contained in the string. operator[] const. βreference operator[] (size_type __pos) noexceptβ Subscript access to the data contained in the string. operator[]. πvoid pop_back ()β Remove the last character. pop_back. πvoid push_back (_CharT __c)β Append a single character. push_back. π₯const_reverse_iterator rbegin () const noexceptβ (no description, just vibes) πreverse_iterator rbegin () noexceptβ (no description, just vibes) πconst_reverse_iterator rend () const noexceptβ (no description, just vibes) β€οΈreverse_iterator rend () noexceptβ (no description, just vibes) π__versa_string & replace (const_iterator __i1, const_iterator __i2,β (partial, more coming in the next part) π
_CharT *__k1, _CharT *__k2)
template<class _InputIterator, typename = std::_RequireInputIter<_InputIterator>> __versa_string & replace (const_iterator __i1, const_iterator __i2, _InputIterator __k1, _InputIterator __k2)β swap a range of characters out for another range β¨__versa_string & replace (const_iterator __i1, const_iterator __i2, const __versa_string &__str)β swap a range of characters out for a string__versa_string & replace (const_iterator __i1, const_iterator __i2, const _CharT *__k1, const _CharT *__k2)__versa_string & replace (const_iterator __i1, const_iterator __i2, const _CharT *__s)β swap a range of characters out for a C string__versa_string & replace (const_iterator __i1, const_iterator __i2, const _CharT *__s, size_type __n)β swap a range of characters out for a C substring__versa_string & replace (const_iterator __i1, const_iterator __i2, const_iterator __k1, const_iterator __k2)__versa_string & replace (const_iterator __i1, const_iterator __i2, iterator __k1, iterator __k2)__versa_string & replace (const_iterator __i1, const_iterator __i2, size_type __n, _CharT __c)β swap a range of characters out for multiple characters__versa_string & replace (const_iterator __i1, const_iterator __i2, std::initializer_list< _CharT > __l)β swap a range of characters out for aninitializer_list__versa_string & replace (size_type __pos, size_type __n, const __versa_string &__str)β swap characters out for a value from another string__versa_string & replace (size_type __pos, size_type __n1, const _CharT *__s)β swap characters out for the value of a C string__versa_string & replace (size_type __pos, size_type __n1, const _CharT *__s, size_type __n2)β swap characters out for the value of a C substring__versa_string & replace (size_type __pos, size_type __n1, size_type __n2, _CharT __c)β swap characters out for multiple characters__versa_string & replace (size_type __pos1, size_type __n1, const __versa_string &__str, size_type __pos2, size_type __n2)β swap characters out for a value from another stringvoid reserve (size_type __res_arg=0)β try to preallocate enough memory for the number of characters you asked for π«Άvoid resize (size_type __n)β resize the string to the number of characters you wantvoid resize (size_type __n, _CharT __c)β same thing, and you get to say what character fills the new spacesize_type rfind (_CharT __c, size_type __pos=npos) const noexceptβ find the last position of a character πsize_type rfind (const __versa_string &__str, size_type __pos=npos) const noexceptβ find the last position of a stringsize_type rfind (const _CharT *__s, size_type __pos, size_type __n) constβ find the last position of a C substringsize_type rfind (const _CharT *__s, size_type __pos=npos) constβ find the last position of a C stringvoid shrink_to_fit () noexceptβ a non-binding request to bringcapacity()down tosize()(she's asking politely, she can't force it, okay?)size_type size () const noexceptβ how many characters are in the string, not counting any null-termination π―__versa_string substr (size_type __pos=0, size_type __n=npos) constβ grab yourself a substringvoid swap (__versa_string &__s) noexceptβ trade contents with another string, mutual, consensual, iconic
π Static Public Attributes π
static const size_type nposβ the value all these member functions hand back when they simply could not do the thing π it's the "no" of return values
π Detailed Description π
template<typename _CharT, typename _Traits, typename _Alloc, template<
typename, typename, typename > class _Base>
class __gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base >
Template class __versa_string.
Data structure managing sequences of characters and character-like objects. that's literally the whole vibe β it holds your characters, in order, and it's so good at it π
π Constructor & Destructor Documentation π
π Construct an empty string
template<typename _CharT, typename _Traits, typename _Alloc, template<
typename, typename, typename > class _Base> __gnu_cxx::__versa_string<
_CharT, _Traits, _Alloc, _Base >::__versa_string (const _Alloc & __a =
_Alloc()) [inline], [explicit], [noexcept]
Build an empty string using allocator a. π«§
Referenced by compare(), compare(), and __gnu_cxx::__versa_string< char >::substr().
π¦ Copy constructor
template<typename _CharT, typename _Traits, typename _Alloc, template<
typename, typename, typename > class _Base> __gnu_cxx::__versa_string<
_CharT, _Traits, _Alloc, _Base >::__versa_string (const __versa_string<
_CharT, _Traits, _Alloc, _Base > & __str) [inline]
Construct a string that's a copy of the value of __str.
Parameters
__strβ Source string.
π§ Move constructor
template<typename _CharT, typename _Traits, typename _Alloc, template<
typename, typename, typename > class _Base> __gnu_cxx::__versa_string<
_CharT, _Traits, _Alloc, _Base >::__versa_string (__versa_string<
_CharT, _Traits, _Alloc, _Base > && __str) [inline], [noexcept]
String move constructor, and yes she's noexcept, she's fast, she's that girl β¨
Parameters
__strβ Source string.
The brand-new string contains the exact contents of __str. After that, the contents of __str are a valid, but unspecified string. π translation: it's alive and legal, but don't go assuming what's inside it now.
πΈ Construct from an initializer list
template<typename _CharT, typename _Traits, typename _Alloc, template<
typename, typename, typename > class _Base> __gnu_cxx::__versa_string<
_CharT, _Traits, _Alloc, _Base >::__versa_string (std::initializer_list<
_CharT > __l, const _Alloc & __a = _Alloc()) [inline]
Build a string straight from an initializer list, slay π
Parameters
__lβstd::initializer_listof characters.__aβ Allocator to use (default is default allocator).
π Construct as a copy of a substring
template<typename _CharT, typename _Traits, typename _Alloc, template<
typename, typename, typename > class _Base> __gnu_cxx::__versa_string<
_CharT, _Traits, _Alloc, _Base >::__versa_string (const __versa_string<
_CharT, _Traits, _Alloc, _Base > & __str, size_type __pos, size_type __n
= npos) [inline]
Construct a string as a copy of a substring. π
Parameters
__strβ Source string.__posβ Index of first character to copy from.__nβ Number of characters to copy (default remainder).
π Construct as a copy of a substring, with an allocator
template<typename _CharT, typename _Traits, typename _Alloc, template<
typename, typename, typename > class _Base> __gnu_cxx::__versa_string<
_CharT, _Traits, _Alloc, _Base >::__versa_string (const __versa_string<
_CharT, _Traits, _Alloc, _Base > & __str, size_type __pos, size_type
__n, const _Alloc & __a) [inline]
Same deal β copy of a substring β but you also pick the allocator.
Parameters
__strβ Source string.__posβ Index of first character to copy from.__nβ Number of characters to copy.__aβ Allocator to use.
π¦ Construct from a character array
template<typename _CharT, typename _Traits, typename _Alloc, template<
typename, typename, typename > class _Base> __gnu_cxx::__versa_string<
_CharT, _Traits, _Alloc, _Base >::__versa_string (const _CharT * __s,
size_type __n, const _Alloc & __a = _Alloc()) [inline]
Construct a string initialized by a character array.
Parameters
__sβ Source character array.__nβ Number of characters to copy.__aβ Allocator to use (default is default allocator).
β οΈ NB:__smust have at least__ncharacters, and'\0'has no special meaning here. None. Zero. She does not care about your null terminator in this constructor, bestie. π
π Construct as a copy of a C string
template<typename _CharT, typename _Traits, typename _Alloc, template<
typename, typename, typename > class _Base> __gnu_cxx::__versa_string<
_CharT, _Traits, _Alloc, _Base >::__versa_string (const _CharT * __s,
const _Alloc & __a = _Alloc()) [inline]
Construct a string as a copy of a C string.
Parameters
__sβ Source C string.__aβ Allocator to use (default is default allocator).
β¨ Construct as multiple characters
template<typename _CharT, typename _Traits, typename _Alloc, template<
typename, typename, typename > class _Base> __gnu_cxx::__versa_string<
_CharT, _Traits, _Alloc, _Base >::__versa_string (size_type __n, _CharT
__c, const _Alloc & __a = _Alloc()) [inline]
Construct a string as multiple characters β same character, __n times. It's giving pattern, it's giving repetition, it's giving iconic π
Parameters
__nβ Number of characters.__cβ Character to use.__aβ Allocator to use (default is default allocator).
π§΅ Construct as a copy of a range
template<typename _CharT, typename _Traits, typename _Alloc, template<
typename, typename, typename > class _Base> template<class
_InputIterator, typename = std::_RequireInputIter<_InputIterator>>
__gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base
>::__versa_string (_InputIterator __beg, _InputIterator __end, const
_Alloc & __a = _Alloc()) [inline]
Construct a string as a copy of a range. π«Ά
Parameters
__begβ Start of range.__endβ End of range.__aβ Allocator to use (default is default allocator).
π Destructor
template<typename _CharT, typename _Traits, typename _Alloc, template<
typename, typename, typename > class _Base> __gnu_cxx::__versa_string<
_CharT, _Traits, _Alloc, _Base >::~__versa_string () [inline],
[noexcept]
Destroy the string instance. Say bye, she's noexcept about it, no drama, clean exit π
π¦ Member Function Documentation π¦
π« append β a range of characters
template<typename _CharT, typename _Traits, typename _Alloc, template<
typename, typename, typename > class _Base> template<class
_InputIterator, typename = std::_RequireInputIter<_InputIterator>>
__versa_string & __gnu_cxx::__versa_string< _CharT, _Traits, _Alloc,
_Base >::append (_InputIterator __first, _InputIterator __last) [inline]
Append a range of characters. π
Parameters
__firstβ Iterator referencing the first character to append.__lastβ Iterator marking the end of the range.
Returns
Reference to this string.
Appends characters in the range [first,last) to this string. note the brackets, bestie β first is in, last is out, that's just how ranges roll.
π append β a whole string
template<typename _CharT, typename _Traits, typename _Alloc, template<
typename, typename, typename > class _Base> __versa_string &
__gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base >::append
(const __versa_string< _CharT, _Traits, _Alloc, _Base > & __str)
[inline]
Append a string to this string. Simple. Elegant. Ate. π₯
Parameters
__strβ The string to append.
Returns
Reference to this string.
Referenced by __gnu_cxx::__versa_string< char >::append(), std::getline(), __gnu_cxx::operator+(), __gnu_cxx::operator+(), __gnu_cxx::operator+(), __gnu_cxx::__versa_string< char >::operator+=(), __gnu_cxx::__versa_string< char >::operator+=(), __gnu_cxx::__versa_string< char >::operator+=(), and resize().
πΈ append β a substring
template<typename _CharT, typename _Traits, typename _Alloc, template<
typename, typename, typename > class _Base> __versa_string &
__gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base >::append
(const __versa_string< _CharT, _Traits, _Alloc, _Base > & __str,
size_type __pos, size_type __n) [inline]
Append a substring. Just a lil slice of a string, as a treat π
Parameters
__strβ The string to append.__posβ Index of the first character ofstrto append.__nβ The number of characters to append.
Returns
Reference to this string.
Exceptions
std::out_of_rangeifposis not a valid index. π watch that__pos, bestie, she will not let it slide.
This function appends __n characters from __str starting at __pos to this string. If __n is is larger than the number of available characters in __str, the remainder of __str is appended. π« (yes, the docs really do say "is is" β we keep the lore, we don't touch the lore)
append β the "and one more thing" queen π
template<typename _CharT, typename _Traits, typename _Alloc, template<typename, typename, typename> class _Base>
__versa_string & __gnu_cxx::__versa_string<_CharT, _Traits, _Alloc, _Base>::append(const _CharT * __s) [inline]
Append a C string. Bestie just slides a whole C string onto the end, no big deal.
- Parameters
__sβ the C string you're appending.
- Returns β a reference to this string, so you can keep chaining like the main character you are.
append(const _CharT * __s, size_type __n) β only part of the C string π
template<typename _CharT, typename _Traits, typename _Alloc, template<typename, typename, typename> class _Base>
__versa_string & __gnu_cxx::__versa_string<_CharT, _Traits, _Alloc, _Base>::append(const _CharT * __s, size_type __n) [inline]
Append a C substring.
- Parameters
__sβ the C string you're appending.__nβ how many characters to append.
- Returns β a reference to this string. π
append(size_type __n, _CharT __c) β copy-paste that character πΈ
template<typename _CharT, typename _Traits, typename _Alloc, template<typename, typename, typename> class _Base>
__versa_string & __gnu_cxx::__versa_string<_CharT, _Traits, _Alloc, _Base>::append(size_type __n, _CharT __c) [inline]
Append multiple characters.
- Parameters
__nβ how many characters to append.__cβ which character to use.
- Returns β a reference to this string.
Appends n copies of c to this string. Yes, it's literally just spam but make it β¨intentionalβ¨.
append(std::initializer_list< _CharT > __l) β brace-init girls rise π¦
template<typename _CharT, typename _Traits, typename _Alloc, template<typename, typename, typename> class _Base>
__versa_string & __gnu_cxx::__versa_string<_CharT, _Traits, _Alloc, _Base>::append(std::initializer_list< _CharT > __l) [inline]
Append an initializer_list of characters.
- Parameters
__lβ theinitializer_listof characters to append.
- Returns β a reference to this string.
the assign era π«Ά
assign(__versa_string && __str) β move it, don't copy it
template<typename _CharT, typename _Traits, typename _Alloc, template<typename, typename, typename> class _Base>
__versa_string & __gnu_cxx::__versa_string<_CharT, _Traits, _Alloc, _Base>::assign(__versa_string<_CharT, _Traits, _Alloc, _Base> && __str) [inline], [noexcept]
Set value to contents of another string.
- Parameters
__strβ the source string to use.
- Returns β a reference to this string.
This function sets this string to the exact contents of __str. And listen β __str is a valid, but unspecified string after this. So like, it still exists, it's just not giving anything anymore. Don't come for it. π
assign(_InputIterator __first, _InputIterator __last) β iterator range vibes π
template<typename _CharT, typename _Traits, typename _Alloc, template<typename, typename, typename> class _Base>
template<class _InputIterator, typename = std::_RequireInputIter<_InputIterator>>
__versa_string & __gnu_cxx::__versa_string<_CharT, _Traits, _Alloc, _Base>::assign(_InputIterator __first, _InputIterator __last) [inline]
Set value to a range of characters.
- Parameters
__firstβ iterator referencing the first character to append.__lastβ iterator marking the end of the range.
- Returns β a reference to this string.
Sets the value of the string to the characters in the range [first,last). Note the half-open bracket energy β first is in, last is not. Periodt.
assign(const __versa_string & __str) β the classic copy π
template<typename _CharT, typename _Traits, typename _Alloc, template<typename, typename, typename> class _Base>
__versa_string & __gnu_cxx::__versa_string<_CharT, _Traits, _Alloc, _Base>::assign(const __versa_string<_CharT, _Traits, _Alloc, _Base> & __str) [inline]
Set value to contents of another string.
- Parameters
__strβ the source string to use.
- Returns β a reference to this string.
Referenced by__gnu_cxx::__versa_string< char >::assign(),__gnu_cxx::__versa_string< char >::operator=(),__gnu_cxx::__versa_string< char >::operator=(),__gnu_cxx::__versa_string< char >::operator=(), and__gnu_cxx::__versa_string< char >::operator=(). So basically everyone in the group chat calls on her. π
assign(const __versa_string & __str, size_type __pos, size_type __n) β the glow-up slice β¨
template<typename _CharT, typename _Traits, typename _Alloc, template<typename, typename, typename> class _Base>
__versa_string & __gnu_cxx::__versa_string<_CharT, _Traits, _Alloc, _Base>::assign(const __versa_string<_CharT, _Traits, _Alloc, _Base> & __str, size_type __pos, size_type __n) [inline]
Set value to a substring of a string.
- Parameters
__strβ the string to use.__posβ index of the first character ofstr.__nβ number of characters to use.
- Returns β a 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. And if __n is larger than the number of available characters in __str, the remainder of __str is used. No drama, it just takes what's left. π
assign(const _CharT * __s) β straight from C string town
template<typename _CharT, typename _Traits, typename _Alloc, template<typename, typename, typename> class _Base>
__versa_string & __gnu_cxx::__versa_string<_CharT, _Traits, _Alloc, _Base>::assign(const _CharT * __s) [inline]
Set value to contents of a C string.
- Parameters
__sβ the C string to use.
- Returns β a reference to this string.
This function sets the value of this string to the value of __s. The data is copied, so there is no dependence on __s once the function returns. So you can go ahead and free __s, she already moved on. π
assign(const _CharT * __s, size_type __n) β C substring, but for assigning π
template<typename _CharT, typename _Traits, typename _Alloc, template<typename, typename, typename> class _Base>
__versa_string & __gnu_cxx::__versa_string<_CharT, _Traits, _Alloc, _Base>::assign(const _CharT * __s, size_type __n) [inline]
Set value to a C substring.
- Parameters
__sβ the C string to use.__nβ number of characters to use.
- Returns β a reference to this string.
This function sets the value of this string to the first __n characters of __s. If __n is larger than the number of available characters in __s, the remainder of __s is used. Same "take what you can get" rule as above, she's consistent. π«Ά
assign(size_type __n, _CharT __c) β fill mode activated π₯
template<typename _CharT, typename _Traits, typename _Alloc, template<typename, typename, typename> class _Base>
__versa_string & __gnu_cxx::__versa_string<_CharT, _Traits, _Alloc, _Base>::assign(size_type __n, _CharT __c) [inline]
Set value to multiple characters.
- Parameters
__nβ length of the resulting string.__cβ the character to use.
- Returns β a reference to this string.
This function sets the value of this string to __n copies of character __c. It's giving "I only know one letter and I'm committing to it."
assign(std::initializer_list< _CharT > __l) β brace list bestie π
template<typename _CharT, typename _Traits, typename _Alloc, template<typename, typename, typename> class _Base>
__versa_string & __gnu_cxx::__versa_string<_CharT, _Traits, _Alloc, _Base>::assign(std::initializer_list< _CharT > __l) [inline]
Set value to an initializer_list of characters.
- Parameters
__lβ theinitializer_listof characters to assign.
- Returns β a reference to this string.
at β the safe one, lowkey the responsible sibling πΈ
at(size_type __n) β read/write access
template<typename _CharT, typename _Traits, typename _Alloc, template<typename, typename, typename> class _Base>
reference __gnu_cxx::__versa_string<_CharT, _Traits, _Alloc, _Base>::at(size_type __n) [inline]
Provides access to the data contained in the string.
- Parameters
__nβ the index of the character to access.
- Returns β a read/write reference to the character.
- Exceptions
std::out_of_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. So she's safe and she's independent now. Iconic.
at(size_type __n) const β read-only queen π
template<typename _CharT, typename _Traits, typename _Alloc, template<typename, typename, typename> class _Base>
const_reference __gnu_cxx::__versa_string<_CharT, _Traits, _Alloc, _Base>::at(size_type __n) const [inline]
Provides access to the data contained in the string.
- Parameters
__nβ the index of the character to access.
- Returns β a read-only (
const) reference to the character. - Exceptions
std::out_of_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. Same energy, just no editing privileges. π
back() const β peek at the last one, no touching
template<typename _CharT, typename _Traits, typename _Alloc, template<typename, typename, typename> class _Base>
const_reference __gnu_cxx::__versa_string<_CharT, _Traits, _Alloc, _Base>::back() const [inline], [noexcept]
Returns a read-only (constant) reference to the data at the last element of the string. Just looking. π
back() β okay now you can touch it
template<typename _CharT, typename _Traits, typename _Alloc, template<typename, typename, typename> class _Base>
reference __gnu_cxx::__versa_string<_CharT, _Traits, _Alloc, _Base>::back() [inline], [noexcept]
Returns a read/write reference to the data at the last element of the string.
begin() const β the first character, but make it const
template<typename _CharT, typename _Traits, typename _Alloc, template<typename, typename, typename> class _Base>
const_iterator __gnu_cxx::__versa_string<_CharT, _Traits, _Alloc, _Base>::begin() const [inline], [noexcept]
Returns a read-only (constant) iterator that points to the first character in the string.
begin() β the first character, full access π
template<typename _CharT, typename _Traits, typename _Alloc, template<typename, typename, typename> class _Base>
iterator __gnu_cxx::__versa_string<_CharT, _Traits, _Alloc, _Base>::begin() [inline], [noexcept]
Returns a read/write iterator that points to the first character in the string. Unshares the string.
Referenced by__gnu_cxx::__versa_string< char >::crend(),__gnu_cxx::__versa_string< char >::rend(), and__gnu_cxx::__versa_string< char >::rend(). Reverse iterators? Yeah, they're built off this one. iykyk.
c_str() const β the raw pointer moment β
template<typename _CharT, typename _Traits, typename _Alloc, template<typename, typename, typename> class _Base>
const _CharT * __gnu_cxx::__versa_string<_CharT, _Traits, _Alloc, _Base>::c_str() const [inline], [noexcept]
Return const pointer to null-terminated contents. This is a handle to internal data. Do not modify or dire things may happen. π¨
Fr fr, that's a direct quote from the source. Not me exaggerating. Do NOT modify it. Dire. Things. May. Happen. π
capacity() const β how much room before the reallocation jumpscare
template<typename _CharT, typename _Traits, typename _Alloc, template<typename, typename, typename> class _Base>
size_type __gnu_cxx::__versa_string<_CharT, _Traits, _Alloc, _Base>::capacity() const [inline], [noexcept]
Returns the total number of characters that the string can hold before needing to allocate more memory.
Referenced by__gnu_cxx::__versa_string< char >::push_back(), and__gnu_cxx::__versa_string< char >::shrink_to_fit(). She's the number everyone checks before deciding whether to spend money. πΈ
cbegin() const β const iterator, but make it fashion
template<typename _CharT, typename _Traits, typename _Alloc, template<typename, typename, typename> class _Base>
const_iterator __gnu_cxx::__versa_string<_CharT, _Traits, _Alloc, _Base>::cbegin() const [inline], [noexcept]
Returns a read-only (constant) iterator that points to the first character in the string.
cend() const β one past the last one, still const
template<typename _CharT, typename _Traits, typename _Alloc, template<typename, typename, typename> class _Base>
const_iterator __gnu_cxx::__versa_string<_CharT, _Traits, _Alloc, _Base>::cend() const [inline], [noexcept]
Returns a read-only (constant) iterator that points one past the last character in the string. (Yes, one past. That's how the range works. [begin, end). We been knew.) π¦
clear() β the reset button π§
template<typename _CharT, typename _Traits, typename _Alloc, template<typename, typename, typename> class _Base>
void __gnu_cxx::__versa_string<_CharT, _Traits, _Alloc, _Base>::clear() [inline], [noexcept]
Erases the string, making it empty. Clean slate, fresh start, we love a rebirth arc. β¨
πΈ compare β the whole entire compare family, bestie
Ok so compare has six overloads and they're all just "who's first in the alphabet" energy. Let's go one by one, no skipping. π
π¦ compare to another __versa_string
template<typename _CharT, typename _Traits, typename _Alloc, template<
typename, typename, typename > class _Base> int
__gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base >::compare
(const __versa_string< _CharT, _Traits, _Alloc, _Base > & __str) const
[inline]
Compare to a string.
- Parameters
__strβ the string you're comparing against, queen.
- Returns
- Integer
< 0,0, or> 0. That's it, that's the whole vibe check.
- Integer
So here's the tea β: you get an integer < 0 if this string is ordered before __str, 0 if their values are equivalent (twins, basically), or > 0 if this string is ordered after __str. It figures out the effective length rlen of the strings to compare as the smallest of size() and str.size(). Then it compares the two strings by calling traits::compare(data(), str.data(),rlen). If the result of the comparison is nonzero it returns it, otherwise the shorter one is ordered first. Short king behavior, honestly. π
Referenced by __gnu_cxx::operator<(), __gnu_cxx::operator<(), __gnu_cxx::operator<(), __gnu_cxx::operator<(), __gnu_cxx::operator<=(), __gnu_cxx::operator<=(), __gnu_cxx::operator<=(), __gnu_cxx::operator>(), __gnu_cxx::operator>(), __gnu_cxx::operator>(), __gnu_cxx::operator>=(), __gnu_cxx::operator>=(), and __gnu_cxx::operator>=(). (yes bestie, that many. they're all obsessed with it. π)
π compare to a C string
template<typename _CharT, typename _Traits, typename _Alloc, template<
typename, typename, typename > class _Base> int
__gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base >::compare
(const _CharT * __s) const
Compare to a C string.
- Parameters
__sβ the C string to compare against.
- Returns
- Integer
< 0,0, or> 0.
- Integer
Returns an integer < 0 if this string is ordered before __s, 0 if their values are equivalent, or > 0 if this string is ordered after __s. It determines the effective length rlen of the strings to compare as the smallest of size() and the length of a string constructed from __s. Then it compares the two strings by calling traits::compare(data(),s,rlen). If the result of the comparison is nonzero it returns it, otherwise the shorter one is ordered first. β¨
References std::min(), and size().
π compare a substring to a string
template<typename _CharT, typename _Traits, typename _Alloc, template<
typename, typename, typename > class _Base> int
__gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base >::compare
(size_type __pos, size_type __n, const __versa_string< _CharT, _Traits,
_Alloc, _Base > & __str) const
Compare substring to a string.
- Parameters
__posβ index of first character of substring.__nβ number of characters in substring.__strβ string to compare against.
- Returns
- Integer
< 0,0, or> 0.
- Integer
Form the substring of this string from the __n characters starting at __pos. Returns an integer < 0 if the substring is ordered before __str, 0 if their values are equivalent, or > 0 if the substring is ordered after __str. Determines the effective length rlen of the strings to compare as the smallest of the length of the substring and __str.size(). The function then compares the two strings by calling traits::compare(substring.data(),str.data(),rlen). If the result of the comparison is nonzero returns it, otherwise the shorter one is ordered first. π«Ά
References __versa_string(), data(), std::min(), and size().
π compare a substring to a C string
template<typename _CharT, typename _Traits, typename _Alloc, template<
typename, typename, typename > class _Base> int
__gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base >::compare
(size_type __pos, size_type __n1, const _CharT * __s) const
Compare substring to a C string.
- Parameters
__posβ index of first character of substring.__n1β number of characters in substring.__sβ C string to compare against.
- Returns
- Integer
< 0,0, or> 0.
- Integer
Form the substring of this string from the __n1 characters starting at __pos. Returns an integer < 0 if the substring is ordered before __s, 0 if their values are equivalent, or > 0 if the substring is ordered after __s. Determines the effective length rlen of the strings to compare as the smallest of the length of the substring and the length of a string constructed from __s. The function then compares the two string by calling traits::compare(substring.data(),s,rlen). If the result of the comparison is nonzero returns it, otherwise the shorter one is ordered first. π
References std::min().
π compare a substring against a character array
template<typename _CharT, typename _Traits, typename _Alloc, template<
typename, typename, typename > class _Base> int
__gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base >::compare
(size_type __pos, size_type __n1, const _CharT * __s, size_type __n2)
const
Compare substring against a character array.
- Parameters
__posβ index of first character of substring.__n1β number of characters in substring.__sβ character array to compare against.__n2β number of characters of s.
- Returns
- Integer
< 0,0, or> 0.
- Integer
Form the substring of this string from the __n1 characters starting at __pos. Form a string from the first __n2 characters of __s. Returns an integer < 0 if this substring is ordered before the string from __s, 0 if their values are equivalent, or > 0 if this substring is ordered after the string from __s. Determines the effective length rlen of the strings to compare as the smallest of the length of the substring and __n2. The function then compares the two strings by calling traits::compare(substring.data(),__s,rlen). If the result of the comparison is nonzero returns it, otherwise the shorter one is ordered first. π₯
NB:__smust have at leastn2characters,\0has no special meaning. (the null terminator is NOT the main character here, bestie, it gets no special treatment π)
References std::min().
π compare a substring to a substring
template<typename _CharT, typename _Traits, typename _Alloc, template<
typename, typename, typename > class _Base> int
__gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base >::compare
(size_type __pos1, size_type __n1, const __versa_string< _CharT,
_Traits, _Alloc, _Base > & __str, size_type __pos2, size_type __n2)
const
Compare substring to a substring.
- Parameters
__pos1β index of first character of substring.__n1β number of characters in substring.__strβ string to compare against.__pos2β index of first character of substring of str.__n2β number of characters in substring of str.
- Returns
- Integer
< 0,0, or> 0.
- Integer
Form the substring of this string from the __n1 characters starting at __pos1. Form the substring of __str from the __n2 characters starting at __pos2. Returns an integer < 0 if this substring is ordered before the substring of __str, 0 if their values are equivalent, or > 0 if this substring is ordered after the substring of __str. Determines the effective length rlen of the strings to compare as the smallest of the lengths of the substrings. The function then compares the two strings by calling traits::compare(substring.data(),str.substr(pos2,n2).data(),rlen). If the result of the comparison is nonzero returns it, otherwise the shorter one is ordered first. β¨
References __versa_string(), data(), and std::min().
π copy β putting a substring into a C string
template<typename _CharT, typename _Traits, typename _Alloc, template<
typename, typename, typename > class _Base> __versa_string< _CharT,
_Traits, _Alloc, _Base >::size_type __gnu_cxx::__versa_string< _CharT,
_Traits, _Alloc, _Base >::copy (_CharT * __s, size_type __n, size_type
__pos = 0) const
Copy substring into C string.
- Parameters
__sβ C string to copy value into.__nβ number of characters to copy.__posβ index of first character to copy.
- Returns
- Number of characters actually copied
- Exceptions
std::out_of_rangeβ ifpos > size().
Copies up to __n characters starting at __pos into the C string s. If __pos is greater than size(), out_of_range is thrown. So like, if you're trying to grab characters from a spot that doesn't even exist, it's gonna throw hands. π
Note the default: __pos = 0. iykyk.
π crbegin β reverse iterator, but make it const
template<typename _CharT, typename _Traits, typename _Alloc, template<
typename, typename, typename > class _Base> const_reverse_iterator
__gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base >::crbegin ()
const [inline], [noexcept]
Returns a read-only (constant) reverse iterator that points to the last character in the string. Iteration is done in reverse element order. So you're walking the string backwards, no editing allowed, purely for the vibes. π¦
π crend β reverse iterator, const, the end
template<typename _CharT, typename _Traits, typename _Alloc, template<
typename, typename, typename > class _Base> const_reverse_iterator
__gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base >::crend ()
const [inline], [noexcept]
Returns a read-only (constant) reverse iterator that points to one before the first character in the string. Iteration is done in reverse element order. It's the "you've reached the end, go home" iterator. π
π data β the raw pointer moment
template<typename _CharT, typename _Traits, typename _Alloc, template<
typename, typename, typename > class _Base> const _CharT *
__gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base >::data ()
const [inline], [noexcept]
Return const pointer to contents.
This is a handle to internal data. Do not modify or dire things may happen. π
fr fr bestie, that's the actual warning. it's giving "touch grass, not my internal buffer". undefined behavior said hi.
Referenced by compare(), compare(), __gnu_cxx::__versa_string< char >::compare(), __gnu_cxx::__versa_string< char >::find(), __gnu_cxx::__versa_string< char >::find_first_not_of(), __gnu_cxx::__versa_string< char >::find_first_of(), __gnu_cxx::__versa_string< char >::find_last_of(), __gnu_cxx::operator==(), and __gnu_cxx::operator==().
π«§ empty β is it giving nothing
template<typename _CharT, typename _Traits, typename _Alloc, template<
typename, typename, typename > class _Base> bool
__gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base >::empty ()
const [inline], [nodiscard], [noexcept]
Returns true if the string is empty. Equivalent to *this == "". That's the whole thing. <nodiscard> is there because ignoring this return value is a crime against humanity. π
π end β const version
template<typename _CharT, typename _Traits, typename _Alloc, template<
typename, typename, typename > class _Base> const_iterator
__gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base >::end ()
const [inline], [noexcept]
Returns a read-only (constant) iterator that points one past the last character in the string. Classic one-past-the-end energy, she's iconic for that. β
π end β the read/write one
template<typename _CharT, typename _Traits, typename _Alloc, template<
typename, typename, typename > class _Base> iterator
__gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base >::end ()
[inline], [noexcept]
Returns a read/write iterator that points one past the last character in the string. Unshares the string. (yes, calling this one has side effects on the internal sharing situation, not me making that up, it's literally in the docs π« )
Referenced by __gnu_cxx::__versa_string< char >::crbegin(), __gnu_cxx::__versa_string< char >::rbegin(), and __gnu_cxx::__versa_string< char >::rbegin().
βοΈ erase β remove a range of characters
template<typename _CharT, typename _Traits, typename _Alloc, template<
typename, typename, typename > class _Base> iterator
__gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base >::erase
(const_iterator __first, const_iterator __last) [inline]
Remove a range of characters.
- Parameters
__firstβ iterator referencing the first character to remove.__lastβ iterator referencing the end of the range.
- Returns
- Iterator referencing location of first after removal.
Removes the characters in the range [first,last) from this string. The value of the string doesn't change if an error is thrown. π Strong exception guarantee behavior, she's safe and she's proud of it.
erase(const_iterator __position)β yeet exactly one character π
template<typename _CharT, typename _Traits, typename _Alloc, template<
typename, typename, typename > class _Base> iterator
__gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base >::erase
(const_iterator __position) [inline]
okay so bestie, this one is the surgical version β it removes one character, not a whole range. Sneaky little single-target delete. π―
__positionβ an iterator pointing at the character you want gone.
Returns: an iterator referencing the same location, but after the removal. So like, the spot where that character used to be is now occupied by whatever came next. Slay.
It removes the character at __position from this string. And the best part? The value of the string doesn't change if an error is thrown. No half-deleted chaos, no messy vibes. If it blows up, your string is untouched. π«Ά
erase(size_type __pos = 0, size_type __n = npos)β the big sweep π§Ήβ¨
template<typename _CharT, typename _Traits, typename _Alloc, template<
typename, typename, typename > class _Base> __versa_string &
__gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base >::erase
(size_type __pos = 0, size_type __n = npos) [inline]
__posβ index of the first character to remove (default0).__nβ how many characters to remove (default is the whole remainder, i.e.npos).
Returns: a reference to this string. Chainable. Iconic. π
Exceptions:
std::out_of_rangeif__posis beyond the end of this string.
So what's happening: it removes __n characters from this string starting at __pos, and the length of the string goes down by __n. If there are fewer than __n characters left to remove, then the remainder of the string just gets truncated β no drama, no error. But if __p is beyond the end of the string, out_of_range gets thrown. And once again, the golden rule: the value of the string doesn't change if an error is thrown. Periodt. π
Referenced by std::getline().
find(_CharT __c, size_type __pos = 0) constβ where my little character at? π
template<typename _CharT, typename _Traits, typename _Alloc, template<
typename, typename, typename > class _Base> __versa_string< _CharT,
_Traits, _Alloc, _Base >::size_type __gnu_cxx::__versa_string< _CharT,
_Traits, _Alloc, _Base >::find (_CharT __c, size_type __pos = 0) const
[noexcept]
__cβ the character to locate.__posβ index of the character to search from (default0).
Returns: the index of the first occurrence.
Starting from __pos, it searches forward for __c within this string. Found it? Returns the index where it was found. Not found? Returns npos. That's the whole story, no notes. β¨
Referencesnpos, andsize().
find(const __versa_string< _CharT, _Traits, _Alloc, _Base > & __str, size_type __pos = 0) constβ but make it a whole string π
template<typename _CharT, typename _Traits, typename _Alloc, template<
typename, typename, typename > class _Base> size_type
__gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base >::find (const
__versa_string< _CharT, _Traits, _Alloc, _Base > & __str, size_type
__pos = 0) const [inline], [noexcept]
__strβ the string to locate.__posβ index of the character to search from (default0).
Returns: the index of the start of the first occurrence.
Starting from __pos, searches forward for the value of __str within this string. If found, it returns the index where it begins β note, the beginning, not the end, we're not chaotic here. If not found, returns npos. πΈ
find(const _CharT * __s, size_type __pos, size_type __n) constβ C substring hunt, limited edition π¦
template<typename _CharT, typename _Traits, typename _Alloc, template<
typename, typename, typename > class _Base> __versa_string< _CharT,
_Traits, _Alloc, _Base >::size_type __gnu_cxx::__versa_string< _CharT,
_Traits, _Alloc, _Base >::find (const _CharT * __s, size_type __pos,
size_type __n) const
__sβ the C string to locate.__posβ index of the character to search from.__nβ number of characters from__sto search for.
Returns: the index of the start of the first occurrence.
Starting from __pos, searches forward for the first __n characters in __s within this string. If found, returns the index where it begins. If not found, returns npos. π«
Referencesnpos, andsize().
Referenced by__gnu_cxx::__versa_string< char >::find(),__gnu_cxx::__versa_string< char >::find(), and__gnu_cxx::__versa_string< char >::find_first_of().
find(const _CharT * __s, size_type __pos = 0) constβ the chill C-string version π
template<typename _CharT, typename _Traits, typename _Alloc, template<
typename, typename, typename > class _Base> size_type
__gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base >::find (const
_CharT * __s, size_type __pos = 0) const [inline]
__sβ the C string to locate.__posβ index of the character to search from (default0).
Returns: the index of the start of the first occurrence.
Starting from __pos, searches forward for the value of __s within this string. Found it? Index of where it begins. Didn't find it? npos. That's it bestie, no __n here, we're taking the whole string. π
find_first_not_of(_CharT __c, size_type __pos = 0) constβ find me literally anyone else π
template<typename _CharT, typename _Traits, typename _Alloc, template<
typename, typename, typename > class _Base> __versa_string< _CharT,
_Traits, _Alloc, _Base >::size_type __gnu_cxx::__versa_string< _CharT,
_Traits, _Alloc, _Base >::find_first_not_of (_CharT __c, size_type __pos
= 0) const [noexcept]
__cβ the character to avoid.__posβ index of the character to search from (default0).
Returns: the index of the first occurrence.
Starting from __pos, searches forward for a character that is not __c within this string. If it finds one, it returns the index where it was found. If literally every character is __c (or there's nothing left to check), it returns npos. π
Referencesnpos, andsize().
find_first_not_of(const __versa_string< _CharT, _Traits, _Alloc, _Base > & __str, size_type __pos = 0) constβ not-any-of-these energy β¨
template<typename _CharT, typename _Traits, typename _Alloc, template<
typename, typename, typename > class _Base> size_type
__gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base
>::find_first_not_of (const __versa_string< _CharT, _Traits, _Alloc,
_Base > & __str, size_type __pos = 0) const [inline], [noexcept]
__strβ the string containing the characters to avoid.__posβ index of the character to search from (default0).
Returns: the index of the first occurrence.
Starting from __pos, searches forward for a character that is not contained in __str, inside this string. Found one? Returns its index. None? npos. Lowkey this is the "find me something new" function. π§
Referenced by__gnu_cxx::__versa_string< char >::find_first_not_of(), and__gnu_cxx::__versa_string< char >::find_first_not_of().
find_first_not_of(const _CharT * __s, size_type __pos, size_type __n) constβ C substring, but make it avoidance π
template<typename _CharT, typename _Traits, typename _Alloc, template<
typename, typename, typename > class _Base> __versa_string< _CharT,
_Traits, _Alloc, _Base >::size_type __gnu_cxx::__versa_string< _CharT,
_Traits, _Alloc, _Base >::find_first_not_of (const _CharT * __s,
size_type __pos, size_type __n) const
__sβ the C string containing the characters to avoid.__posβ index of the character to search from.__nβ number of characters fromsto consider.
Returns: the index of the first occurrence.
Starting from __pos, searches forward for a character that is not contained in the first __n characters of __s, within this string. If found, returns the index where it was found. If not found, returns npos. π
Referencesnpos, andsize().
find_first_not_of(const _CharT * __s, size_type __pos = 0) constβ the full C-string avoid list πΈ
template<typename _CharT, typename _Traits, typename _Alloc, template<
typename, typename, typename > class _Base> size_type
__gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base
>::find_first_not_of (const _CharT * __s, size_type __pos = 0) const
[inline]
__sβ the C string containing the characters to avoid.__posβ index of the character to search from (default0).
Returns: the index of the first occurrence.
Starting from __pos, searches forward for a character not contained in __s within this string. Found it β returns the index where it was found. Not found β npos. Simple as. π«Ά
find_first_of(_CharT __c, size_type __pos = 0) constβ the little single-char one that's justfindin a wig π
template<typename _CharT, typename _Traits, typename _Alloc, template<
typename, typename, typename > class _Base> size_type
__gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base
>::find_first_of (_CharT __c, size_type __pos = 0) const [inline],
[noexcept]
__cβ the character to locate.__posβ index of the character to search from (default0).
Returns: the index of the first occurrence.
Starting from __pos, searches forward for the character __c within this string. Found β index of where it was found. Not found β npos.
Note: equivalent to find(c, pos). Yes bestie, literally the same thing. We love a redundant glow-up. β¨
find_first_of(const __versa_string< _CharT, _Traits, _Alloc, _Base > & __str, size_type __pos = 0) constβ any-of-these hunt π₯
template<typename _CharT, typename _Traits, typename _Alloc, template<
typename, typename, typename > class _Base> size_type
__gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base
>::find_first_of (const __versa_string< _CharT, _Traits, _Alloc, _Base >
& __str, size_type __pos = 0) const [inline], [noexcept]
__strβ the string containing the characters to locate.__posβ index of the character to search from (default0).
Returns: the index of the first occurrence.
Starting from __pos, searches forward for one of the characters of __str within this string. Any single one of them counts. Found β index where it was found. Not found β npos. π
Referenced by__gnu_cxx::__versa_string< char >::find_first_of(), and__gnu_cxx::__versa_string< char >::find_first_of().
find_first_of(const _CharT * __s, size_type __pos, size_type __n) constβ C substring, choose-your-fighter edition π¦
template<typename _CharT, typename _Traits, typename _Alloc, template<
typename, typename, typename > class _Base> __versa_string< _CharT,
_Traits, _Alloc, _Base >::size_type __gnu_cxx::__versa_string< _CharT,
_Traits, _Alloc, _Base >::find_first_of (const _CharT * __s, size_type
__pos, size_type __n) const
__sβ the string containing the characters to locate.__posβ index of the character to search from.__nβ number of characters fromsto search for.
Returns: the index of the first occurrence.
Starting from __pos, searches forward for one of the first __n characters of __s within this string. If found, returns the index where it was found. If not found, returns npos. π
Referencesnpos, andsize().
find_first_of(const _CharT * __s, size_type __pos = 0) constβ full C-string, any character counts π
template<typename _CharT, typename _Traits, typename _Alloc, template<
typename, typename, typename > class _Base> size_type
__gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base
>::find_first_of (const _CharT * __s, size_type __pos = 0) const
[inline]
__sβ the string containing the characters to locate.__posβ index of the character to search from (default0).
Returns: the index of the first occurrence.
Starting from __pos, searches forward for one of the characters of __s within this string. Found β the index where it was found. Not found β npos. π―
find_last_not_of(_CharT __c, size_type __pos = npos) constβ going backwards, avoiding the vibe π
template<typename _CharT, typename _Traits, typename _Alloc, template<
typename, typename, typename > class _Base> __versa_string< _CharT,
_Traits, _Alloc, _Base >::size_type __gnu_cxx::__versa_string< _CharT,
_Traits, _Alloc, _Base >::find_last_not_of (_CharT __c, size_type __pos
= npos) const [noexcept]
__cβ the character to avoid.__posβ index of the character to search back from (default: the end).
Returns: the index of the last occurrence.
Starting from __pos, searches backward for a character other than __c within this string. If found, returns the index where it was found. If not found, returns npos. Note the default is npos, not 0 β because we're going the other way, bestie. Reverse main character energy. π
π
find_last_not_of β the "find me the last vibe that ISN'T in this set" girlies
template<typename _CharT, typename _Traits, typename _Alloc,
template<typename, typename, typename> class _Base>
size_type
__gnu_cxx::__versa_string<_CharT, _Traits, _Alloc, _Base>::
find_last_not_of(const __versa_string<_CharT, _Traits, _Alloc, _Base>& __str,
size_type __pos = npos) const [inline], [noexcept]
okay so this one is giving "Find last position of a character not in string." π¦
Parameters:
__strβ the string holding all the characters you wanna AVOID, bestie.__posβ index of the character to search back from (defaults to the end, slay).
Returns: index of the last occurrence. π
Starting from __pos, it searches backward for a character that is not contained in __str within this string. Found one? You get the index where it lives. Not found? You get npos. Periodt. π
References npos, and size().
template<typename _CharT, typename _Traits, typename _Alloc,
template<typename, typename, typename> class _Base>
__versa_string<_CharT, _Traits, _Alloc, _Base>::size_type
__gnu_cxx::__versa_string<_CharT, _Traits, _Alloc, _Base>::
find_last_not_of(const _CharT* __s, size_type __pos, size_type __n) const
Find last position of a character not in C substring. πΈ
Parameters:
__sβ C string containing characters to avoid.__posβ index of the character to search back from.__nβ number of characters fromsto consider.
Returns: index of the last occurrence. β¨
Starting from __pos, it searches backward for a character not contained in the first __n characters of __s within this string. Found it β index. Didn't find it β npos. No cap.
References npos, and size().
template<typename _CharT, typename _Traits, typename _Alloc,
template<typename, typename, typename> class _Base>
size_type
__gnu_cxx::__versa_string<_CharT, _Traits, _Alloc, _Base>::
find_last_not_of(const _CharT* __s, size_type __pos = npos) const [inline]
Find last position of a character not in C string. π
Parameters:
__sβ C string containing characters to avoid.__posβ index of the character to search back from (default end).
Returns: index of the last occurrence. π
Starting from __pos, searches backward for a character not contained in __s within this string. If found, returns the index where it was found. If not found, returns npos. That's the whole plot, fr fr.
π₯ find_last_of β the "last one of THESE specific characters" era
template<typename _CharT, typename _Traits, typename _Alloc,
template<typename, typename, typename> class _Base>
size_type
__gnu_cxx::__versa_string<_CharT, _Traits, _Alloc, _Base>::
find_last_of(_CharT __c, size_type __pos = npos) const [inline], [noexcept]
Find last position of a character. π
Parameters:
__cβ the character to locate.__posβ index of the character to search back from (default end).
Returns: index of the last occurrence.
Starting from __pos, it searches backward for __c within this string. Found it? Index. Not found? npos. Iconic behaviour honestly.
Note: equivalent to rfind(c, pos). π«Ά
template<typename _CharT, typename _Traits, typename _Alloc,
template<typename, typename, typename> class _Base>
size_type
__gnu_cxx::__versa_string<_CharT, _Traits, _Alloc, _Base>::
find_last_of(const __versa_string<_CharT, _Traits, _Alloc, _Base>& __str,
size_type __pos = npos) const [inline], [noexcept]
Find last position of a character of string. π
Parameters:
__strβ string containing characters to locate.__posβ index of the character to search back from (default end).
Returns: index of the last occurrence.
Starting from __pos, searches backward for one of the characters of __str within this string. If found, returns the index where it was found. If not found, returns npos. Simple as that, bestie.
Referenced by __gnu_cxx::__versa_string< char >::find_last_of(), and __gnu_cxx::__versa_string< char >::find_last_of().
template<typename _CharT, typename _Traits, typename _Alloc,
template<typename, typename, typename> class _Base>
__versa_string<_CharT, _Traits, _Alloc, _Base>::size_type
__gnu_cxx::__versa_string<_CharT, _Traits, _Alloc, _Base>::
find_last_of(const _CharT* __s, size_type __pos, size_type __n) const
Find last position of a character of C substring. π
Parameters:
__sβ C string containing characters to locate.__posβ index of the character to search back from.__nβ number of characters fromsto search for.
Returns: index of the last occurrence.
Starting from __pos, searches backward for one of the first __n characters of __s within this string. If found, returns the index where it was found. If not found, returns npos.
References npos, and size().
template<typename _CharT, typename _Traits, typename _Alloc,
template<typename, typename, typename> class _Base>
size_type
__gnu_cxx::__versa_string<_CharT, _Traits, _Alloc, _Base>::
find_last_of(const _CharT* __s, size_type __pos = npos) const [inline]
Find last position of a character of C string. β
Parameters:
__sβ C string containing characters to locate.__posβ index of the character to search back from (default end).
Returns: index of the last occurrence.
Starting from __pos, searches backward for one of the characters of __s within this string. If found, returns the index where it was found. If not found, returns npos. Slay.
π front() β the first character, read-only edition
template<typename _CharT, typename _Traits, typename _Alloc,
template<typename, typename, typename> class _Base>
const_reference
__gnu_cxx::__versa_string<_CharT, _Traits, _Alloc, _Base>::
front() const [inline], [noexcept]
Returns a read-only (constant) reference to the data at the first element of the string. Look but don't touch, babe. π
π front() β the first character, but make it writable
template<typename _CharT, typename _Traits, typename _Alloc,
template<typename, typename, typename> class _Base>
reference
__gnu_cxx::__versa_string<_CharT, _Traits, _Alloc, _Base>::
front() [inline], [noexcept]
Returns a read/write reference to the data at the first element of the string. Now you can actually edit it. Main character energy. π
πΈ get_allocator() β hand me the receipts of who built this
template<typename _CharT, typename _Traits, typename _Alloc,
template<typename, typename, typename> class _Base>
allocator_type
__gnu_cxx::__versa_string<_CharT, _Traits, _Alloc, _Base>::
get_allocator() const [inline], [noexcept]
Return a copy of the allocator used to construct this string. That's it, that's the function. π«Ά
β¨ insert() β the glow-up section, starting with one lil character
template<typename _CharT, typename _Traits, typename _Alloc,
template<typename, typename, typename> class _Base>
iterator
__gnu_cxx::__versa_string<_CharT, _Traits, _Alloc, _Base>::
insert(const_iterator __p, _CharT __c) [inline]
Insert one character. π
Parameters:
__pβ iterator referencing the position in the string to insert at.__cβ the character to insert.
Returns: iterator referencing the newly inserted char. π
Exceptions:
std::length_errorβ if the new length exceedsmax_size().
Inserts character __c at the position referenced by __p. If adding the character causes the length to exceed max_size(), length_error gets thrown. If __p is beyond the end of the string, out_of_range gets thrown. The value of the string doesn't change if an error is thrown β so no half-done glow-up, bestie. β¨
π¦ insert() β a whole range of characters, come through
template<typename _CharT, typename _Traits, typename _Alloc,
template<typename, typename, typename> class _Base>
template<class _InputIterator, typename = std::_RequireInputIter<_InputIterator>>
iterator
__gnu_cxx::__versa_string<_CharT, _Traits, _Alloc, _Base>::
insert(const_iterator __p, _InputIterator __beg, _InputIterator __end) [inline]
Insert a range of characters. π
Parameters:
__pβ const_iterator referencing the location in the string to insert at.__begβ start of range.__endβ end of range.
Returns: iterator referencing the first inserted char.
Exceptions:
std::length_errorβ if the new length exceedsmax_size().
Inserts the characters in the range [beg,end). If adding characters causes the length to exceed max_size(), length_error is thrown. The value of the string doesn't change if an error is thrown. Periodt. π
π insert() β __n copies of one character, go off
template<typename _CharT, typename _Traits, typename _Alloc,
template<typename, typename, typename> class _Base>
iterator
__gnu_cxx::__versa_string<_CharT, _Traits, _Alloc, _Base>::
insert(const_iterator __p, size_type __n, _CharT __c) [inline]
Insert multiple characters. π₯
Parameters:
__pβ const_iterator referencing the location in the string to insert at.__nβ number of characters to insert.__cβ the character to insert.
Returns: iterator referencing the first inserted char.
Exceptions:
std::length_errorβ if the new length 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. The value of the string doesn't change if an error is thrown. No cap. π
Referenced by __gnu_cxx::__versa_string< char >::insert().
π insert() β initializer_list edition, very modern of you
template<typename _CharT, typename _Traits, typename _Alloc,
template<typename, typename, typename> class _Base>
iterator
__gnu_cxx::__versa_string<_CharT, _Traits, _Alloc, _Base>::
insert(const_iterator __p, std::initializer_list<_CharT> __l) [inline]
Insert an initializer_list of characters. π«
Parameters:
__pβ const_iterator referencing the location in the string to insert at.__lβ theinitializer_listof characters to insert.
Returns: iterator referencing the first inserted char.
Exceptions:
std::length_errorβ if the new length exceedsmax_size().
π insert() β the C string enters the chat
template<typename _CharT, typename _Traits, typename _Alloc,
template<typename, typename, typename> class _Base>
__versa_string&
__gnu_cxx::__versa_string<_CharT, _Traits, _Alloc, _Base>::
insert(size_type __pos, const _CharT* __s) [inline]
Insert a C string. πΈ
Parameters:
__posβ iterator referencing the location in the string to insert at.__sβ the C string to insert.
Returns: reference to this string.
Exceptions:
std::length_errorβ if the new length 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. The value of the string doesn't change if an error is thrown. So dramatic but so correct. π
π insert() β C substring, but with a length limit
template<typename _CharT, typename _Traits, typename _Alloc,
template<typename, typename, typename> class _Base>
__versa_string&
__gnu_cxx::__versa_string<_CharT, _Traits, _Alloc, _Base>::
insert(size_type __pos, const _CharT* __s, size_type __n) [inline]
Insert a C substring. π
Parameters:
__posβ iterator referencing the location in the string to insert at.__sβ the C string to insert.__nβ the number of characters to insert.
Returns: reference to this string.
Exceptions:
std::length_errorβ if the new length exceedsmax_size().std::out_of_rangeβ if__posis beyond the end of this string.
...continues where the last one left off, so like: it drops the first __n characters of __s, starting at __pos, into your string. If that push makes the length go over max_size(), a length_error gets yeeted. And if __pos is past end(), you get an out_of_range instead. Either way, if something blows up, your string stays exactly how it was β no half-edits, no mess, we love a clean rollback. π
β¨ insert (multiple characters, but make it repetitive) β¨
template<typename _CharT, typename _Traits, typename _Alloc, template<typename, typename, typename > class _Base> __versa_string & __gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base >::insert(size_type __pos, size_type __n, _CharT __c)
[inline]
okay bestie, this one is "Insert multiple characters." Same character, __n times, we're committing to the bit.
Parameters π
__posβ the index in the string where you're inserting.__nβ how many characters you want to insert.__cβ the character you're inserting.
Returns
- A reference to this string. (Yes, back to you. Chainable, iconic. π)
Exceptions
std::length_errorβ if the new length exceedsmax_size().std::out_of_rangeβ if__posis beyond the end of this string.
So fr: it inserts __n copies of the character __c, starting at index __pos. If adding all those characters makes the length exceed max_size(), length_error is thrown. And if __pos > length(), that's out_of_range, bestie. And again β the value of the string doesn't change if an error is thrown. Safe queen behavior. π‘οΈ
β¨ insert (a whole other string, no cap) β¨
template<typename _CharT, typename _Traits, typename _Alloc, template<typename, typename, typename > class _Base> __versa_string & __gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base >::insert(size_type __pos1, const __versa_string< _CharT, _Traits, _Alloc, _Base > & __str)
[inline]
"Insert value of a string." Like, the entire vibe of another string, dropped into yours. π
Parameters
__pos1β iterator referencing the location in the string to insert at. (Yeah, the docs say iterator, we're just reporting the lore. π)__strβ the string you're inserting.
Returns
- A reference to this string. π«Ά
Exceptions
std::length_errorβ if the new length exceedsmax_size().
It inserts the value of __str starting at __pos1. If adding those characters pushes the length past max_size(), length_error is thrown. And if an error gets thrown, the string's value stays untouched. periodt.
β¨ insert (a substring, so specific) β¨
template<typename _CharT, typename _Traits, typename _Alloc, template<typename, typename, typename > class _Base> __versa_string & __gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base >::insert(size_type __pos1, const __versa_string< _CharT, _Traits, _Alloc, _Base > & __str, size_type __pos2, size_type __n)
[inline]
"Insert a substring." Snipping a little piece out of one string and tucking it into another. π
Parameters
__pos1β iterator referencing the location in the string to insert at.__strβ the string you're inserting from.__pos2β where the characters you want start, insidestr.__nβ how many characters to insert.
Returns
- A 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, it inserts __n characters of __str, beginning with __pos2. If adding characters makes the length exceed max_size(), length_error is thrown. If __pos1 is beyond the end of this string, or __pos2 is beyond the end of __str, it's out_of_range. And bestie, if an error is thrown, the value of the string does not change. Clean. πΈ
β¨ length β¨
template<typename _CharT, typename _Traits, typename _Alloc, template<typename, typename, typename > class _Base> size_type __gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base >::length() const
[inline], [noexcept]
Returns the number of characters in the string β and specifically NOT counting any null-termination. So like, the actual characters, the real ones, the main characters. π
β¨ max_size β¨
template<typename _CharT, typename _Traits, typename _Alloc, template<typename, typename, typename > class _Base> size_type __gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base >::max_size() const
[inline], [noexcept]
Returns the size() of the largest possible string. Like the absolute ceiling, the final boss, the theoretical max. π
Referenced by std::getline(). iykyk.
β¨ operator+= (character edition) β¨
template<typename _CharT, typename _Traits, typename _Alloc, template<typename, typename, typename > class _Base> __versa_string & __gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base >::operator+=(_CharT __c)
[inline]
"Append a character." One little guy, tacked on the end. π
Parameters
__cβ the character to append.
Returns
- A reference to this string. π«Ά
β¨ operator+= (string edition) β¨
template<typename _CharT, typename _Traits, typename _Alloc, template<typename, typename, typename > class _Base> __versa_string & __gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base >::operator+=(const __versa_string< _CharT, _Traits, _Alloc, _Base > & __str)
[inline]
"Append a string to this string." String plus string, they're besties now, they live together. π
Parameters
__strβ the string to append.
Returns
- A reference to this string. β¨
β¨ operator+= (C string edition) β¨
template<typename _CharT, typename _Traits, typename _Alloc, template<typename, typename, typename > class _Base> __versa_string & __gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base >::operator+=(const _CharT * __s)
[inline]
"Append a C string." The raw, unbothered, null-terminated kind. π
Parameters
__sβ the C string to append.
Returns
- A reference to this string. π
β¨ operator+= (initializer_list edition) β¨
template<typename _CharT, typename _Traits, typename _Alloc, template<typename, typename, typename > class _Base> __versa_string & __gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base >::operator+=(std::initializer_list< _CharT > __l)
[inline]
"Append an initializer_list of characters." Brace-init girlies, this one's for you. πΈ
Parameters
__lβ theinitializer_listof characters to be appended.
Returns
- A reference to this string. π«Ά
β¨ operator= (move assignment) β¨
template<typename _CharT, typename _Traits, typename _Alloc, template<typename, typename, typename > class _Base> __versa_string & __gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base >::operator=(__versa_string< _CharT, _Traits, _Alloc, _Base > && __str)
[inline], [noexcept]
"String move assignment operator." The glow-up where nobody copies anything. π
Parameters
__strβ the source string.
The contents of __str are moved into this string (without copying). And then __str is a valid, but unspecified string. Like, it's alive, it's legal, but bestie... do not ask what's inside it. π
β¨ operator= (single character) β¨
template<typename _CharT, typename _Traits, typename _Alloc, template<typename, typename, typename > class _Base> __versa_string & __gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base >::operator=(_CharT __c)
[inline]
"Set value to string of length 1." Shrinking the whole thing down to one iconic little character. π
Parameters
__cβ the source character.
Assigning to a character makes this string length 1 and (*this)[0] == __c. Fr fr, that's the whole deal. β¨
β¨ operator= (copy assignment) β¨
template<typename _CharT, typename _Traits, typename _Alloc, template<typename, typename, typename > class _Base> __versa_string & __gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base >::operator=(const __versa_string< _CharT, _Traits, _Alloc, _Base > & __str)
[inline]
"Assign the value of str to this string."
Parameters
__strβ the source string.
Copy it, paste it, slay it. π
β¨ operator= (C string) β¨
template<typename _CharT, typename _Traits, typename _Alloc, template<typename, typename, typename > class _Base> __versa_string & __gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base >::operator=(const _CharT * __s)
[inline]
"Copy contents of __s into this string."
Parameters
__sβ the source null-terminated string.
Yes bestie, null-terminated, it knows when to stop. π
β¨ operator= (initializer_list) β¨
template<typename _CharT, typename _Traits, typename _Alloc, template<typename, typename, typename > class _Base> __versa_string & __gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base >::operator=(std::initializer_list< _CharT > __l)
[inline]
"Set value to string constructed from initializer list." Brace yourself. π
Parameters
__lβstd::initializer_list.
β¨ operator[] (the read-only one) β¨
template<typename _CharT, typename _Traits, typename _Alloc, template<typename, typename, typename > class _Base> const_reference __gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base >::operator[](size_type __pos) const
[inline], [noexcept]
"Subscript access to the data contained in the string."
Parameters
__posβ the index of the character to access.
Returns
- A read-only (constant) reference to the character.
This operator allows for easy, array-style, data access. But heads up bestie: data access with this operator is unchecked, and out-of-range lookups are not defined. (For checked lookups, see at().) π
Referenced by__gnu_cxx::__versa_string< char >::back(),__gnu_cxx::__versa_string< char >::back(),__gnu_cxx::__versa_string< char >::front(), and__gnu_cxx::__versa_string< char >::front().
β¨ operator[] (the read/write one) β¨
template<typename _CharT, typename _Traits, typename _Alloc, template<typename, typename, typename > class _Base> reference __gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base >::operator[](size_type __pos)
[inline], [noexcept]
"Subscript access to the data contained in the string."
Parameters
__posβ the index of the character to access.
Returns
- A read/write reference to the character.
This operator allows for easy, array-style, data access. Note that data access with this operator is unchecked and out_of_range lookups are not defined. (For checked lookups see at().) Oh and β Unshares the string. π
β¨ pop_back β¨
template<typename _CharT, typename _Traits, typename _Alloc, template<typename, typename, typename > class _Base> void __gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base >::pop_back()
[inline]
"Remove the last character." Goodbye to the final little guy. π
The string must be non-empty. Do not come for an empty string, she has nothing to give you. π
β¨ push_back β¨
template<typename _CharT, typename _Traits, typename _Alloc, template<typename, typename, typename > class _Base> void __gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base >::push_back(_CharT __c)
[inline]
"Append a single character." One character. One. That's it. Simple. Iconic. β¨
Parameters
__cβ the character to append.
Referenced by__gnu_cxx::operator+(),__gnu_cxx::operator+(), and__gnu_cxx::__versa_string< char >::operator+=().
β¨ rbegin (const) β¨
template<typename _CharT, typename _Traits, typename _Alloc, template<typename, typename, typename > class _Base> const_reverse_iterator __gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base >::rbegin() const
[inline], [noexcept]
Returns a read-only (constant) reverse iterator that points to the last character in the string. And iteration is done in reverse element order, so you're walking it backwards, bestie. π¦
β¨ rbegin (mutable) β¨
template<typename _CharT, typename _Traits, typename _Alloc, template<typename, typename, typename > class _Base> reverse_iterator __gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base >::rbegin()
[inline], [noexcept]
Returns a read/write reverse iterator that points to the last character in the string. Iteration is done in reverse element order. And β Unshares the string. π
β¨ rend (const) β¨
template<typename _CharT, typename _Traits, typename _Alloc, template<typename, typename, typename > class _Base> const_reverse_iterator __gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base >::rend() const
[inline], [noexcept]
Returns a read-only (constant) reverse iterator that points to one before the first character in the string. Iteration is done in reverse element order. The end-of-the-road marker, but backwards. π
β¨ rend (mutable) β¨
template<typename _CharT, typename _Traits, typename _Alloc, template<typename, typename, typename > class _Base> reverse_iterator __gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base >::rend()
[inline], [noexcept]
Returns a read/write reverse iterator that points to one before the first character in the string. Iteration is done in reverse element order. And yes β Unshares the string. β¨
πΈ replace() β the overload era begins (part 2 of the replace saga)
template<typename _CharT, typename _Traits, typename _Alloc,
template<typename, typename, typename> class _Base>
template<class _InputIterator,
typename = std::_RequireInputIter<_InputIterator>>
__versa_string&
__gnu_cxx::__versa_string<_CharT, _Traits, _Alloc, _Base>::
replace(const_iterator __i1, const_iterator __i2,
_InputIterator __k1, _InputIterator __k2) [inline]
Replace range of characters with range. bestie it's a swap-out but make it fashion π
Parameters
__i1β iterator pointing at the start of the range you're yeeting out ποΈ__i2β iterator pointing at the end of the range you're yeeting out__k1β iterator pointing at the start of the range you're putting in β¨__k2β iterator pointing at the end of the range you're putting in
Returns
A reference to this string. (Yes, back to you. Main character energy π)
Exceptions
std::length_errorβ thrown if the new length goes overmax_size()
So like: the characters in the range [i1,i2) get removed, and in their place the characters in the range [k1,k2) get inserted. If the resulting length is more than max_size(), length_error is thrown. And the important bit β the value of the string does not change if an error is thrown, so no half-melted string, we stay unbothered π
π and another one
template<typename _CharT, typename _Traits, typename _Alloc,
template<typename, typename, typename> class _Base>
__versa_string&
__gnu_cxx::__versa_string<_CharT, _Traits, _Alloc, _Base>::
replace(const_iterator __i1, const_iterator __i2,
const __versa_string<_CharT, _Traits, _Alloc, _Base>& __str) [inline]
Replace range of characters with string. π
Parameters
__i1β iterator referencing start of range to replace__i2β iterator referencing end of range to replace__strβ the string value to insert
Returns
Reference to this string π«Ά
Exceptions
std::length_errorβ if new length exceedsmax_size()
Removes the characters in [i1,i2), and in place, the value of __str is inserted. Too long? length_error. Something goes wrong? the string stays exactly how it was. Periodt.
π¦ C string edition
template<typename _CharT, typename _Traits, typename _Alloc,
template<typename, typename, typename> class _Base>
__versa_string&
__gnu_cxx::__versa_string<_CharT, _Traits, _Alloc, _Base>::
replace(const_iterator __i1, const_iterator __i2, const _CharT* __s) [inline]
Replace range of characters with C string. πΈ
Parameters
__i1β iterator referencing start of range to replace__i2β iterator referencing end of range to replace__sβ C string value to insert
Returns
Reference to this string β¨
Exceptions
std::length_errorβ if new length exceedsmax_size()
Removes [i1,i2), drops the characters of __s in their place. If it all gets too long β length_error. If an error is thrown, the string's value doesn't change. no cap π§
π C substring edition
template<typename _CharT, typename _Traits, typename _Alloc,
template<typename, typename, typename> class _Base>
__versa_string&
__gnu_cxx::__versa_string<_CharT, _Traits, _Alloc, _Base>::
replace(const_iterator __i1, const_iterator __i2,
const _CharT* __s, size_type __n) [inline]
Replace range of characters with C substring. π
Parameters
__i1β iterator referencing start of range to replace__i2β iterator referencing end of range to replace__sβ C string value to insert__nβ number of characters fromsto insert
Returns
Reference to this string π
Exceptions
std::length_errorβ if new length exceedsmax_size()
Removes the characters in [i1,i2), and in place, the first n characters of __s are inserted. Length blows past max_size()? length_error. Error thrown? Value unchanged, we're fine π
β multiple characters, why not
template<typename _CharT, typename _Traits, typename _Alloc,
template<typename, typename, typename> class _Base>
__versa_string&
__gnu_cxx::__versa_string<_CharT, _Traits, _Alloc, _Base>::
replace(const_iterator __i1, const_iterator __i2,
size_type __n, _CharT __c) [inline]
Replace range of characters with multiple characters. π₯
Parameters
__i1β iterator referencing start of range to replace__i2β iterator referencing end of range to replace__nβ number of characters to insert__cβ character to insert
Returns
Reference to this string π«Ά
Exceptions
std::length_errorβ if new length exceedsmax_size()
Removes [i1,i2), and in place, __n copies of __c get inserted. If the result exceeds max_size(), length_error gets thrown. And yeah β value unchanged if an error is thrown, iconic behaviour honestly π
π initializer_list girlies rise
template<typename _CharT, typename _Traits, typename _Alloc,
template<typename, typename, typename> class _Base>
__versa_string&
__gnu_cxx::__versa_string<_CharT, _Traits, _Alloc, _Base>::
replace(const_iterator __i1, const_iterator __i2,
std::initializer_list<_CharT> __l) [inline]
Replace range of characters with initializer_list. π
Parameters
__i1β iterator referencing start of range to replace__i2β iterator referencing end of range to replace__lβ theinitializer_listof characters to insert
Returns
Reference to this string β¨
Exceptions
std::length_errorβ if new length exceedsmax_size()
Removes the characters in [i1,i2). In place, characters in the range [k1,k2) are inserted. If the length of the result exceeds max_size(), length_error is thrown. The value of the string doesn't change if an error is thrown. (Yes bestie, the doc really does say [k1,k2) here even though there's no __k1/__k2 in this overload β I'm just the messenger π)
π« position-based replace, the classic
template<typename _CharT, typename _Traits, typename _Alloc,
template<typename, typename, typename> class _Base>
__versa_string&
__gnu_cxx::__versa_string<_CharT, _Traits, _Alloc, _Base>::
replace(size_type __pos, size_type __n,
const __versa_string<_CharT, _Traits, _Alloc, _Base>& __str) [inline]
Replace characters with value from another string. π
Parameters
__posβ index of first character to replace__nβ number of characters to be replaced__strβ string to insert
Returns
Reference to this string πΈ
Exceptions
std::out_of_rangeβ if__posis beyond the end of this stringstd::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 the end of the string, out_of_range gets thrown. If the length of the result exceeds max_size(), length_error gets thrown. And of course, the value of the string doesn't change if an error is thrown π§
Referenced by
__gnu_cxx::__versa_string< char >::append()__gnu_cxx::__versa_string< char >::assign()__gnu_cxx::__versa_string< char >::insert()__gnu_cxx::__versa_string< char >::insert()__gnu_cxx::__versa_string< char >::insert()__gnu_cxx::__versa_string< char >::insert()__gnu_cxx::__versa_string< char >::insert()__gnu_cxx::__versa_string< char >::insert()__gnu_cxx::__versa_string< char >::replace()__gnu_cxx::__versa_string< char >::replace()__gnu_cxx::__versa_string< char >::replace()__gnu_cxx::__versa_string< char >::replace()__gnu_cxx::__versa_string< char >::replace()__gnu_cxx::__versa_string< char >::replace()- and
__gnu_cxx::__versa_string< char >::replace()
(that's a lot of internal glow-up happening behind the scenes, they're all leaning on this one π)
π C string, but with position
template<typename _CharT, typename _Traits, typename _Alloc,
template<typename, typename, typename> class _Base>
__versa_string&
__gnu_cxx::__versa_string<_CharT, _Traits, _Alloc, _Base>::
replace(size_type __pos, size_type __n1, const _CharT* __s) [inline]
Replace characters with value of a C string. πΈ
Parameters
__posβ index of first character to replace__n1β number of characters to be replaced__sβ C string to insert
Returns
Reference to this string π
Exceptions
std::out_of_rangeβ if__pos > size()std::length_errorβ if new length 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 the end of the string, out_of_range is thrown. If the length of the result exceeds max_size(), length_error is thrown. The value of the string doesn't change if an error is thrown. slay π«Ά
π¦ C substring, but with position
template<typename _CharT, typename _Traits, typename _Alloc,
template<typename, typename, typename> class _Base>
__versa_string&
__gnu_cxx::__versa_string<_CharT, _Traits, _Alloc, _Base>::
replace(size_type __pos, size_type __n1,
const _CharT* __s, size_type __n2) [inline]
Replace characters with value of a C substring. β¨
Parameters
__posβ index of first character to replace__n1β number of characters to be replaced__sβ C string to insert__n2β number of characters from__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, if __n2 is too large, all of __s. If __pos is beyond the end of the string, out_of_range is thrown. If the length of the result exceeds max_size(), length_error is thrown. The value of the string doesn't change if an error is thrown. (and yes, the doc says __pos1 in the exception line and __pos everywhere else β we love a little inconsistency, it's giving chaos π)
β n2 copies of a character, positioned
template<typename _CharT, typename _Traits, typename _Alloc,
template<typename, typename, typename> class _Base>
__versa_string&
__gnu_cxx::__versa_string<_CharT, _Traits, _Alloc, _Base>::
replace(size_type __pos, size_type __n1, size_type __n2, _CharT __c) [inline]
Replace characters with multiple characters. π₯
Parameters
__posβ index of first character to replace__n1β number of characters to be replaced__n2β number of characters to insert__cβ character to insert
Returns
Reference to this string π
Exceptions
std::out_of_rangeβ if__pos > size()std::length_errorβ if new length 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 the end of the string, out_of_range is thrown. If the length of the result exceeds max_size(), length_error is thrown. The value of the string doesn't change if an error is thrown. π
π string-into-string, fully positioned (the deluxe version)
template<typename _CharT, typename _Traits, typename _Alloc,
template<typename, typename, typename> class _Base>
__versa_string&
__gnu_cxx::__versa_string<_CharT, _Traits, _Alloc, _Base>::
replace(size_type __pos1, size_type __n1,
const __versa_string<_CharT, _Traits, _Alloc, _Base>& __str,
size_type __pos2, size_type __n2) [inline]
Replace characters with value from another string. π
Parameters
__pos1β index of first character to replace__n1β number of characters to be replaced__strβ string to insert__pos2β index of first character 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().
okay bestie, so this function is out here removing the characters in the range [pos1,pos1 + n) from this string. In place, the value of __str is inserted. If __pos is beyond end of string, out_of_range is thrown. If the length of the result exceeds max_size(), length_error is thrown. The value of the string doesn't change if an error is thrown. no cap, it stays put if it throws. π
reserve β¨
template<typename _CharT, typename _Traits, typename _Alloc, template<
typename, typename, typename > class _Base> void
__gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base >::reserve
(size_type __res_arg = 0) [inline]
Attempt to preallocate enough memory for specified number of characters. it's giving βlet me get my space ready before the party startsβ.
Parameters
__res_argβ Number of characters required.
Exceptions
std::length_errorβ If__res_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. so if you know how long your string is gonna be, reserve it and avoid the reallocation jump scare.
Referenced by __gnu_cxx::operator+(), __gnu_cxx::operator+(), __gnu_cxx::operator+(), and __gnu_cxx::__versa_string< char >::shrink_to_fit().
resize (size_type __n) π¦
template<typename _CharT, typename _Traits, typename _Alloc, template<
typename, typename, typename > class _Base> void
__gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base >::resize
(size_type __n) [inline]
Resizes the string to the specified number of characters. slay.
Parameters
__nβ Number of characters the string should contain.
This function will resize the string to the specified length. If the new size is smaller than the string's current size the string is truncated, otherwise the string is extended and new characters are default-constructed. For basic types such as char, this means setting them to 0. so if it grows, new chars are default-constructed, and for basic types like char, that means 0. periodt.
resize (size_type __n, _CharT __c) πΈ
template<typename _CharT, typename _Traits, typename _Alloc, template<
typename, typename, typename > class _Base> void
__gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base >::resize
(size_type __n, _CharT __c)
Resizes the string to the specified number of characters.
Parameters
__nβ Number of characters the string should contain.__cβ Character to fill any new elements.
This function will resize the string to the specified number of characters. If the number is smaller than the string's current size the string is truncated, otherwise the string is extended and new elements are set to __c. so you get to pick the filler char, cute.
References append(), and size().
Referenced by __gnu_cxx::__versa_string< char >::resize().
rfind (_CharT __c, size_type __pos = npos) const [noexcept] π
template<typename _CharT, typename _Traits, typename _Alloc, template<
typename, typename, typename > class _Base> __versa_string< _CharT,
_Traits, _Alloc, _Base >::size_type __gnu_cxx::__versa_string< _CharT,
_Traits, _Alloc, _Base >::rfind (_CharT __c, size_type __pos = npos)
const [noexcept]
Find last position of a character.
Parameters
__cβ Character to locate.__posβ Index of character to search back from (default end).
Returns
- Index of last occurrence.
Starting from __pos, searches backward for __c within this string. If found, returns the index where it was found. If not found, returns npos. so it's the reverse search queen, looking back from __pos.
References npos, and size().
rfind (const __versa_string< _CharT, _Traits, _Alloc, _Base > & __str, size_type __pos = npos) const [inline], [noexcept] π
template<typename _CharT, typename _Traits, typename _Alloc, template<
typename, typename, typename > class _Base> size_type
__gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base >::rfind
(const __versa_string< _CharT, _Traits, _Alloc, _Base > & __str,
size_type __pos = npos) const [inline], [noexcept]
Find last position of a string.
Parameters
__strβ String to locate.__posβ Index of character to search back from (default end).
Returns
- Index of start of last occurrence.
Starting from __pos, searches backward for value of __str within this string. If found, returns the index where it begins. If not found, returns npos.
Referenced by __gnu_cxx::__versa_string< char >::find_last_of(), __gnu_cxx::__versa_string< char >::rfind(), and __gnu_cxx::__versa_string< char >::rfind().
rfind (const _CharT * __s, size_type __pos, size_type __n) const π
template<typename _CharT, typename _Traits, typename _Alloc, template<
typename, typename, typename > class _Base> __versa_string< _CharT,
_Traits, _Alloc, _Base >::size_type __gnu_cxx::__versa_string< _CharT,
_Traits, _Alloc, _Base >::rfind (const _CharT * __s, size_type __pos,
size_type __n) const
Find last position of a C substring.
Parameters
__sβ C string to locate.__posβ Index of character to search back from.__nβ Number of characters from s to search for.
Returns
- Index of start of last occurrence.
Starting from __pos, searches backward for the first __n characters in __s within this string. If found, returns the index where it begins. If not found, returns npos.
References std::min(), npos, and size().
rfind (const _CharT * __s, size_type __pos = npos) const [inline] β
template<typename _CharT, typename _Traits, typename _Alloc, template<
typename, typename, typename > class _Base> size_type
__gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base >::rfind
(const _CharT * __s, size_type __pos = npos) const [inline]
Find last position of a C string.
Parameters
__sβ C string to locate.__posβ Index of character to start search at (default end).
Returns
- Index of start of last occurrence.
Starting from __pos, searches backward for the value of __s within this string. If found, returns the index where it begins. If not found, returns npos.
shrink_to_fit () [inline], [noexcept] π§
template<typename _CharT, typename _Traits, typename _Alloc, template<
typename, typename, typename > class _Base> void
__gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base
>::shrink_to_fit () [inline], [noexcept]
A non-binding request to reduce capacity() to size(). it's giving βpls shrink, but no pressureβ.
size () const [inline], [noexcept] π
template<typename _CharT, typename _Traits, typename _Alloc, template<
typename, typename, typename > class _Base> size_type
__gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base >::size ()
const [inline], [noexcept]
Returns the number of characters in the string, not including any null-termination. bestie, it's the actual char count, no null terminator included.
Referenced by __gnu_cxx::__versa_string< char >::append(), __gnu_cxx::__versa_string< char >::append(), __gnu_cxx::__versa_string< char >::assign(), __gnu_cxx::__versa_string< char >::assign(), __gnu_cxx::__versa_string< char >::assign(), __gnu_cxx::__versa_string< char >::assign(), __gnu_cxx::__versa_string< char >::at(), __gnu_cxx::__versa_string< char >::at(), __gnu_cxx::__versa_string< char >::back(), __gnu_cxx::__versa_string< char >::back(), __gnu_cxx::__versa_string< char >::cend(), compare(), compare(), __gnu_cxx::__versa_string< char >::compare(), __gnu_cxx::__versa_string< char >::empty(), __gnu_cxx::__versa_string< char >::end(), __gnu_cxx::__versa_string< char >::end(), find(), find(), __gnu_cxx::__versa_string< char >::find(), find_first_not_of(), find_first_not_of(), __gnu_cxx::__versa_string< char >::find_first_not_of(), find_first_of(), __gnu_cxx::__versa_string< char >::find_first_of(), find_last_not_of(), find_last_not_of(), find_last_of(), __gnu_cxx::__versa_string< char >::find_last_of(), __gnu_cxx::__versa_string< char >::insert(), __gnu_cxx::operator+(), __gnu_cxx::operator+(), __gnu_cxx::operator+(), __gnu_cxx::operator+(), __gnu_cxx::operator+(), __gnu_cxx::operator==(), __gnu_cxx::operator==(), __gnu_cxx::__versa_string< char >::operator[](), __gnu_cxx::__versa_string< char >::operator[](), __gnu_cxx::__versa_string< char >::pop_back(), __gnu_cxx::__versa_string< char >::push_back(), __gnu_cxx::__versa_string< char >::replace(), __gnu_cxx::__versa_string< char >::replace(), resize(), rfind(), rfind(), and __gnu_cxx::__versa_string< char >::shrink_to_fit().
substr (size_type __pos = 0, size_type __n = npos) const [inline] π
template<typename _CharT, typename _Traits, typename _Alloc, template<
typename, typename, typename > class _Base> __versa_string
__gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base >::substr
(size_type __pos = 0, size_type __n = npos) const [inline]
Get a substring.
Parameters
__posβ Index of first character (default 0).__nβ Number of characters in substring (default remainder).
Returns
- The new string.
Exceptions
std::out_of_rangeβ Ifpos > size().
Construct and return a new string using the __n characters starting at __pos. If the string is too short, use the remainder of the characters. If __pos is beyond the end of the string, out_of_range is thrown. so it's a little slice of the string, and if you ask for too much it throws. π
swap (__versa_string< _CharT, _Traits, _Alloc, _Base > & __s) [inline], [noexcept] π₯
template<typename _CharT, typename _Traits, typename _Alloc, template<
typename, typename, typename > class _Base> void
__gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base >::swap
(__versa_string< _CharT, _Traits, _Alloc, _Base > & __s) [inline],
[noexcept]
Swap contents with another string.
Parameters
__sβ String to swap with.
Exchanges the contents of this string with that of __s in constant time. it's giving instant trade, no copying stress.
Referenced by __gnu_cxx::__versa_string< char >::assign(), __gnu_cxx::__versa_string< char >::operator=(), and __gnu_cxx::swap().
π Member Data Documentation π
npos [static] π
template<typename _CharT, typename _Traits, typename _Alloc, template<
typename, typename, typename > class _Base> const size_type
__gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base >::npos
[static]
Value returned by various member functions when they fail. so when the search functions are like βnot found bestieβ, they return this.
Referenced by find(), find(), find_first_not_of(), find_first_not_of(), find_first_of(), find_last_not_of(), find_last_not_of(), find_last_of(), rfind(), and rfind().
β¨ Author β¨
Generated automatically by Doxygen for libstdc++ from the source code. so yeah, the robots wrote it, not a human. π
and that's the tea, bestie π«Ά this page came from libstdc++ and its man page tag is __gnu_cxx:...oc, _Base >(3). stay iconic, keep your strings safe, and don't forget to reserve. πβ¨
π¦ where this page comes from
- arch rolling: gcc 16.2.1+r23+gd564253eb6c8-1 Β· GPL-3.0-or-later WITH GCC-exception-3.1 AND GFDL-1.3-or-later
- fedora 44: libstdc++-docs 16.0.1-0.10.fc44 Β· GPL-3.0-or-later AND LGPL-3.0-or-later AND (GPL-3.0-or-later WITH GCC-exception-3.1) AND (GPL-3.0-or-later WITH Texinfo-exception) AND (LGPL-2.1-or-later WITH GCC-exception-2.0) AND (GPL-2.0-or-later WITH GCC-exception-2.0) AND (GPL-2.0-or-later WITH GNU-compiler-exception) AND BSL-1.0 AND GFDL-1.3-or-later AND Linux-man-pages-copyleft-2-para AND SunPro AND BSD-1-Clause AND BSD-2-Clause AND BSD-2-Clause-Views AND BSD-3-Clause AND BSD-4-Clause AND BSD-Source-Code AND Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 WITH LLVM-Exception) AND ZPL-2.1 AND ISC AND LicenseRef-Fedora-Public-Domain AND HP-1986 AND curl AND Martin-Birgmeier AND HPND-Markus-Kuhn AND dtoa AND SMLNJ AND AMD-newlib AND OAR AND HPND-merchantability-variant AND HPND-Intel
- fedora 44: libstdc++-docs 16.2.1-2.fc44
- fedora 44: libstdc++-docs 16.2.1-3.fc44 Β· GPL-3.0-or-later AND LGPL-3.0-or-later AND (GPL-3.0-or-later WITH GCC-exception-3.1) AND (GPL-3.0-or-later WITH Texinfo-exception) AND (LGPL-2.1-or-later WITH GCC-exception-2.0) AND (GPL-2.0-or-later WITH GCC-exception-2.0) AND (GPL-2.0-or-later WITH GNU-compiler-exception) AND BSL-1.0 AND GFDL-1.3-or-later AND Linux-man-pages-copyleft-2-para AND SunPro AND BSD-1-Clause AND BSD-2-Clause AND BSD-2-Clause-Views AND BSD-3-Clause AND BSD-4-Clause AND BSD-Source-Code AND Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 WITH LLVM-Exception) AND ZPL-2.1 AND ISC AND LicenseRef-Fedora-Public-Domain AND HP-1986 AND curl AND Martin-Birgmeier AND HPND-Markus-Kuhn AND dtoa AND SMLNJ AND AMD-newlib AND OAR AND HPND-merchantability-variant AND HPND-Intel
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms