__GNU_CXX::ROPE(3cxx)
π NAME π
so like β this is the 3cxx manual page for __gnu_cxx::rope< _CharT, _Alloc >, bestie π
yes the whole thing is literally just that class template and its entire entourage, and we're gonna get through it together, no cap π«Ά
β¨ SYNOPSIS β¨
okay so first things first, you pull this bad boy in like this π
#include <rope>
and plot twist β it inherits from __gnu_cxx::_Rope_base< _CharT, _Alloc >. Yup. That's the family tree. π³
πΈ Public Types πΈ
the type-definition portion of the roster, and honestly there are a LOT of them, the way this class has a whole friend group π
__Cβtypedef _Rope_RopeConcatenation< _CharT, _Alloc > __Cβ the concatenation one, living under a one-letter nickname__Fβtypedef _Rope_RopeFunction< _CharT, _Alloc > __Fβ the function one__Lβtypedef _Rope_RopeLeaf< _CharT, _Alloc > __Lβ the leaf one π__Sβtypedef _Rope_RopeSubstring< _CharT, _Alloc > __Sβ the substring one_CAllocβtypedef __alloc_traits< _Alloc >::template rebind< __C >::other _CAllocβ allocator, but rebound for__C_DataAllocβtypedef __alloc_traits< _Alloc >::template rebind< _CharT >::other _DataAllocβ allocator, but rebound for_CharT_FAllocβtypedef __alloc_traits< _Alloc >::template rebind< __F >::other _FAllocβ allocator, but rebound for__F_LAllocβtypedef __alloc_traits< _Alloc >::template rebind< __L >::other _LAllocβ allocator, but rebound for__L_SAllocβtypedef __alloc_traits< _Alloc >::template rebind< __S >::other _SAllocβ allocator, but rebound for__Sconst_iteratorβtypedef _Rope_const_iterator< _CharT, _Alloc > const_iteratorβ the const iterator, iconic πconst_pointerβtypedef const _CharT * const_pointerβ a const pointer, literallyconst_referenceβtypedef _CharT const_referenceβ const reference energyconst_reverse_iteratorβtypedef std::reverse_iterator< const_iterator > const_reverse_iteratorβ a const iterator but backwards, and it ate πdifference_typeβtypedef std::ptrdiff_t difference_typeβ it'sptrdiff_t, periodtiteratorβtypedef _Rope_iterator< _CharT, _Alloc > iteratorβ the regular iterator, main character energypointerβtypedef _Rope_char_ptr_proxy< _CharT, _Alloc > pointerβ a proxy pointer, lowkey fancyreferenceβtypedef _Rope_char_ref_proxy< _CharT, _Alloc > referenceβ a proxy reference, also fancyreverse_iteratorβtypedef std::reverse_iterator< iterator > reverse_iteratorβ the iterator's backwards twinsize_typeβtypedef std::size_t size_typeβ it'ssize_t, we been knewvalue_typeβtypedef _CharT value_typeβ the character type itself, the moment β¨
π Public Member Functions π
okay this is the big one, the whole entire cast, strap in bestie π’
π the constructors π
every possible way to birth a rope, no notes:
rope (_CharT __c, const allocator_type &__a=allocator_type())β from a char + allocator (defaulted, cute)rope (char_producer< _CharT > *__fn, size_type __len, bool __delete_fn, const allocator_type &__a=allocator_type())β from achar_producerpointer, a length, and aboolfor deleting it, plus the defaulted allocatorrope (const _CharT *__s, const _CharT *__e, const allocator_type &__a=allocator_type())β from a[__s, __e)rangerope (const _CharT *__s, const allocator_type &__a=allocator_type())β from a plain C stringrope (const _CharT *__s, size_type __len, const allocator_type &__a=allocator_type())β from a pointer + lengthrope (const allocator_type &__a=allocator_type())β the no-args one, allocator onlyrope (const const_iterator &__s, const const_iterator &__e, const allocator_type &__a=allocator_type())β from a const_iterator rangerope (const iterator &__s, const iterator &__e, const allocator_type &__a=allocator_type())β from a regular iterator rangerope (const rope &__x, const allocator_type &__a=allocator_type())β copy constructor, but with allocatorrope (size_type __n, _CharT __c, const allocator_type &__a=allocator_type())β__ncopies of__c, slay
π¦ allocator access π¦
allocator_type & _M_get_allocator ()β grab the allocatorconst allocator_type & _M_get_allocator () constβ grab it, but const
π the append squad π
nine-ish ways to say "add it to the end", and they all return rope & so you can keep chaining, obsessed:
rope & append ()β append nothing?! yes. it exists. it's valid. πrope & append (_CharT __c)β append one charrope & append (const _CharT *__c_string)β append a C stringrope & append (const _CharT *__iter, size_type __n)β append__nchars from a pointerrope & append (const _CharT *__s, const _CharT *__e)β append the[__s, __e)rangerope & append (const rope &__y)β append another rope, rope-on-roperope & append (const_iterator __s, const_iterator __e)β append a const_iterator rangerope & append (size_type __n, _CharT __c)β append__ncopies of__c
π the middle bits π
void apply_to_pieces (size_type __begin, size_type __end, _Rope_char_consumer< _CharT > &__c) constβ run a char consumer over the[__begin, __end)stretch_CharT at (size_type __pos) constβ the char at__pos_CharT back () constβ the last char, the rear, the behind πvoid balance ()β balance it, as one doesconst_iterator begin ()β start of the iterator partyconst_iterator begin () constβ same party, const editionconst _CharT * c_str () constβ hand you a C stringvoid clear ()β yeet everythingint compare (const rope &__y) constβ compare against__y, returns anintconst_iterator const_begin () constβ the const beginningconst_iterator const_end () constβ the const endconst_reverse_iterator const_rbegin () constβ const reverse beginningconst_reverse_iterator const_rend () constβ const reverse endvoid copy (_CharT *__buffer) constβ copy into__buffersize_type copy (size_type __pos, size_type __n, _CharT *__buffer) constβ copy__nfrom__posinto__buffer, returns asize_typevoid delete_c_str ()β delete the C string, dramatic πvoid dump ()β dump it (yes, that's the whole description, it's giving mysterious)bool empty () constβ is it empty?bool. that's it.const_iterator end ()β the end, obviouslyconst_iterator end () constβ the const end, obviously
π erase π
iterator erase (const iterator &__p)β erase at__p, hands you back aniteratoriterator erase (const iterator &__p, const iterator &__q)β erase the[__p, __q)range, returns aniteratorvoid erase (size_type __p, size_type __n)β erase__nstarting at__p, returnsvoid
π₯ find π₯
size_type find (_CharT __c, size_type __pos=0) constβ find char__c, starting at__pos(defaults to0)size_type find (const _CharT *__s, size_type __pos=0) constβ find string__s, starting at__pos(defaults to0)
πΈ front / length / max_size / get_allocator πΈ
_CharT front () constβ the first char, front and centersize_type length () constβ how long it issize_type max_size () constβ the absolute max, the limitallocator_type get_allocator () constβ the allocator, but this time by value, no reference
π§ insert (the iterator-returning club) π§
every one of these gives you back an iterator, generous:
iterator insert (const iterator &__p)β insert at__p, nothing elseiterator insert (const iterator &__p, _CharT __c)β insert a char at__piterator insert (const iterator &__p, const _CharT *__i, const _CharT *__j)β insert[__i, __j)at__piterator insert (const iterator &__p, const _CharT *__i, size_type __n)β insert__nfrom__iat__piterator insert (const iterator &__p, const _CharT *c_string)β insert a C string at__piterator insert (const iterator &__p, const const_iterator &__i, const const_iterator &__j)β insert a const_iterator range at__piterator insert (const iterator &__p, const iterator &__i, const iterator &__j)β insert an iterator range at__piterator insert (const iterator &__p, const rope &__r)β insert rope__rat__piterator insert (const iterator &__p, size_type __n, _CharT __c)β insert__ncopies of__cat__p
π insert (the void club) π
same energy, but they return nothing, respectfully:
void insert (size_type __p)β insert at index__pvoid insert (size_type __p, _CharT __c)β insert a char at__pvoid insert (size_type __p, const _CharT *__c_string)β insert a C string at__pvoid insert (size_type __p, const _CharT *__i, const _CharT *__j)β insert[__i, __j)at__pvoid insert (size_type __p, const _CharT *__i, size_type __n)β insert__nfrom__iat__pvoid insert (size_type __p, const const_iterator &__i, const const_iterator &__j)β insert a const_iterator range at__pvoid insert (size_type __p, const iterator &__i, const iterator &__j)β insert an iterator range at__pvoid insert (size_type __p, const rope &__r)β insert rope__rat__pvoid insert (size_type __p, size_type __n, _CharT __c)β insert__ncopies of__cat__p
π« the mutable crew π«
mutable = you can actually touch it, bestie, be careful:
iterator mutable_begin ()β mutable beginningiterator mutable_end ()β mutable endreverse_iterator mutable_rbegin ()β mutable reverse beginningreference mutable_reference_at (size_type __pos)β a mutablereferenceat__posreverse_iterator mutable_rend ()β mutable reverse end
β operators & the rest β
rope & operator= (const rope &__x)β assignment from__x, returnsrope &_CharT operator[] (size_type __pos) constβ subscript at__pos, gives you a_CharTvoid pop_back ()β remove from the backvoid pop_front ()β remove from the frontvoid push_back (_CharT __x)β push__xonto the backvoid push_front (_CharT __x)β push__xonto the frontconst_reverse_iterator rbegin ()β reverse beginningconst_reverse_iterator rbegin () constβ const reverse beginningconst_reverse_iterator rend ()β reverse endconst_reverse_iterator rend () constβ const reverse end
π replace (all 28 of them, and yes I counted) π
this is the longest guest list at the party, but we're not skipping a single one π€
iterator-based replace:
void replace (const iterator &__p, _CharT __c)β replace at__pwith char__cvoid replace (const iterator &__p, const _CharT *__c_string)β replace at__pwith a C stringvoid replace (const iterator &__p, const _CharT *__i, const _CharT *__j)β replace at__pwith[__i, __j)void replace (const iterator &__p, const _CharT *__i, size_type __n)β replace at__pwith__nfrom__ivoid replace (const iterator &__p, const iterator &__q, _CharT __c)β replace the[__p, __q)range with char__cvoid replace (const iterator &__p, const iterator &__q, const _CharT *__c_string)β replace[__p, __q)with a C stringvoid replace (const iterator &__p, const iterator &__q, const _CharT *__i, const _CharT *__j)β replace[__p, __q)with[__i, __j)void replace (const iterator &__p, const iterator &__q, const _CharT *__i, size_type __n)β replace[__p, __q)with__nfrom__ivoid replace (const iterator &__p, const iterator &__q, const const_iterator &__i, const const_iterator &__j)β replace[__p, __q)with a const_iterator rangevoid replace (const iterator &__p, const iterator &__q, const iterator &__i, const iterator &__j)β replace[__p, __q)with an iterator rangevoid replace (const iterator &__p, const iterator &__q, const rope &__r)β replace[__p, __q)with rope__rvoid replace (const iterator &__p, const rope &__r)β replace at__pwith rope__rvoid replace (const iterator &__p, const_iterator __i, const_iterator __j)β replace at__pwith the[__i, __j)const_iteratorsvoid replace (const iterator &__p, iterator __i, iterator __j)β replace at__pwith the[__i, __j)iterators
index-based replace:
void replace (size_type __p, _CharT __c)β replace at index__pwith char__cvoid replace (size_type __p, const _CharT *__c_string)β replace at__pwith a C stringvoid replace (size_type __p, const _CharT *__i, const _CharT *__j)β replace at__pwith[__i, __j)void replace (size_type __p, const _CharT *__i, size_type __i_len)β replace at__pwith__i_lenfrom__ivoid replace (size_type __p, const const_iterator &__i, const const_iterator &__j)β replace at__pwith a const_iterator rangevoid replace (size_type __p, const iterator &__i, const iterator &__j)β replace at__pwith an iterator rangevoid replace (size_type __p, const rope &__r)β replace at__pwith rope__rvoid replace (size_type __p, size_type __n, _CharT __c)β replace__nat__pwith char__cvoid replace (size_type __p, size_type __n, const _CharT *__c_string)β replace__nat__pwith a C stringvoid replace (size_type __p, size_type __n, const _CharT *__i, const _CharT *__j)β replace__nat__pwith[__i, __j)void replace (size_type __p, size_type __n, const _CharT *__i, size_type __i_len)β replace__nat__pwith__i_lenfrom__ivoid replace (size_type __p, size_type __n, const const_iterator &__i, const const_iterator &__j)β replace__nat__pwith a const_iterator rangevoid replace (size_type __p, size_type __n, const iterator &__i, const iterator &__j)β replace__nat__pwith an iterator rangevoid replace (size_type __p, size_type __n, const rope &__r)β replace__nat__pwith rope__r
π«Ά c_str, size, substr, swap π«Ά
const _CharT * replace_with_c_str ()β swap it out for a C string, returnsconst _CharT *size_type size () constβ the size, the number, the amountrope< _CharT, _Alloc > substr (const_iterator __start)β substring from__start, note the return type is spelled out fully here, she's extra πrope substr (const_iterator __start, const_iterator __end) constβ substring from__startto__end, constrope substr (iterator __start) constβ substring from__start, constrope substr (iterator __start, iterator __end) constβ substring from__startto__end, constrope substr (size_type __start, size_type __len=1) constβ substring of__len(defaults to1, cute) from__startvoid swap (rope &__b)β swap with__b, trading places π
π₯ Static Public Member Functions π₯
static, so no instance needed, they're self-sufficient kings and queens π
static __C * _C_allocate (std::size_t __n)β allocate__nof__Cstatic void _C_deallocate (__C *__p, std::size_t __n)β deallocate__nat__pfor__Cstatic _CharT * _Data_allocate (std::size_t __n)β allocate__nof_CharTstatic void _Data_deallocate (_CharT *__p, std::size_t __n)β deallocate__nat__pfor_CharTstatic __F * _F_allocate (std::size_t __n)β allocate__nof__Fstatic void _F_deallocate (__F *__p, std::size_t __n)β deallocate__nat__pfor__Fstatic __L * _L_allocate (std::size_t __n)β allocate__nof__Lstatic void _L_deallocate (__L *__p, std::size_t __n)β deallocate__nat__pfor__Lstatic __S * _S_allocate (std::size_t __n)β allocate__nof__Sstatic void _S_deallocate (__S *__p, std::size_t __n)β deallocate__nat__pfor__S
π Public Attributes π
_M_tree_ptrβ_RopeRep * _M_tree_ptrβ the tree pointer, the actual heart of the whole operation, protect her at all costs π
π Static Public Attributes π
nposβstatic const size_type nposβ the classic, the legend, the not-found value we all know and love
π§ Protected Types π§
the backstage crew, protected, so hands off unless you're family:
enum { _S_copy_max }β an anonymous enum holding_S_copy_max_Baseβtypedef _Rope_base< _CharT, _Alloc > _Baseβ yup, the base class again, from the inside this time_Cstrptrβtypedef _CharT * _Cstrptrβ a pointer meant for C strings_RopeConcatenationβtypedef _Rope_RopeConcatenation< _CharT, _Alloc > _RopeConcatenation_RopeFunctionβtypedef _Rope_RopeFunction< _CharT, _Alloc > _RopeFunction_RopeLeafβtypedef _Rope_RopeLeaf< _CharT, _Alloc > _RopeLeafπ_RopeRepβtypedef _Rope_RopeRep< _CharT, _Alloc > _RopeRep_RopeSubstringβtypedef _Rope_RopeSubstring< _CharT, _Alloc > _RopeSubstring_Self_destruct_ptrβtypedef _Rope_self_destruct_ptr< _CharT, _Alloc > _Self_destruct_ptrβ a self-destruct pointer, which is exactly as dramatic as it sounds π₯allocator_typeβtypedef _Base::allocator_type allocator_typeβ the allocator type, inherited from_Baseand finally named plainly
π οΈ Static Protected Member Functions π οΈ
okay so here's the thing, bestie β the original page lists these bad boys as names and signatures only. no descriptions, no little notes, nothing π the entry is literally just the signature and we move on. so I'm giving you the exact lineup, character for character, and keeping my commentary strictly to "omg look at that signature" territory. no invented facts, no cap π«Ά
static size_type _S_allocated_capacity (size_type __n)β that's the whole entry, bestie. signature only, no notes πstatic bool _S_apply_to_pieces (_Rope_char_consumer< _CharT > &__c, const _RopeRep *__r, size_type __begin, size_type __end)β again, the source page gives you the signature and dips β¨static _RopeRep * _S_concat (_RopeRep *__left, _RopeRep *__right)β name's right there, signature's right there, that's the full tea βstatic _RopeRep * _S_concat_char_iter (_RopeRep *__r, const _CharT *__iter, size_type __slen, allocator_type &__a)β five params, zero explanation, iconic honestly πstatic _RopeRep * _S_destr_concat_char_iter (_RopeRep *__r, const _CharT *__iter, size_type __slen, allocator_type &__a)β same deal, signature only πΈstatic _RopeLeaf * _S_destr_leaf_concat_char_iter (_RopeLeaf *__r, const _CharT *__iter, size_type __slen)β no description in the source, just vibes and a return type πstatic _CharT _S_fetch (_RopeRep *__r, size_type __pos)β the source page says nothing beyond this line, fr frstatic _CharT * _S_fetch_ptr (_RopeRep *__r, size_type __pos)β pointer-flavoured, still zero commentary from the original πstatic bool _S_is0 (_CharT __c)β returnsbool, takes one_CharT, and that's genuinely all she wrote β¨static _RopeLeaf * _S_leaf_concat_char_iter (_RopeLeaf *__r, const _CharT *__iter, size_type __slen)β signature only, bestie π¦static _RopeConcatenation * _S_new_RopeConcatenation (_RopeRep *__left, _RopeRep *__right, allocator_type &__a)β the page gives you the shape of it and nothing more πstatic _RopeFunction * _S_new_RopeFunction (char_producer< _CharT > *__f, size_type __size, bool __d, allocator_type &__a)β again: no description in the original, this is the entire entry πstatic _RopeLeaf * _S_new_RopeLeaf (_CharT *__s, size_type __size, allocator_type &__a)β signature and that's it, periodt πstatic _RopeSubstring * _S_new_RopeSubstring (_Rope_RopeRep< _CharT, _Alloc > *__b, size_type __s, size_type __l, allocator_type &__a)β the source lists it, I list it, we're all caught up π«Άstatic void _S_ref (_RopeRep *__t)β returnsvoid, takes one pointer, no notes from the original βstatic _RopeLeaf * _S_RopeLeaf_from_unowned_char_ptr (const _CharT *__s, size_type __size, allocator_type &__a)β exact name, exact params, zero extra words πstatic size_type _S_rounded_up_size (size_type __n)β that's the line, bestie, that's all of it π§static _RopeRep * _S_substring (_RopeRep *__base, size_type __start, size_type __endp1)β note that third param really is spelled__endp1and I am not touching it πstatic _RopeRep * _S_tree_concat (_RopeRep *__left, _RopeRep *__right)β signature only, as always π₯static void _S_unref (_RopeRep *__t)βvoidin,voidout (well,voidreturned), no commentary πΈstatic _RopeRep * replace (_RopeRep *__old, size_type __pos1, size_type __pos2, _RopeRep *__r)β yep, that is a lowercasereplaceand no underscore prefix, and yes I copied it exactly π
π Static Protected Attributes π
static _CharT _S_empty_c_str [1]β that's the whole entry: type, name, and the array size[1], no description attached in the source π
π Friends π
the guest list π these classes and functions get to come behind the velvet rope:
class _Rope_char_ptr_proxy< _CharT, _Alloc >class _Rope_char_ref_proxy< _CharT, _Alloc >class _Rope_const_iterator< _CharT, _Alloc >class _Rope_iterator< _CharT, _Alloc >class _Rope_iterator_base< _CharT, _Alloc >struct _Rope_RopeRep< _CharT, _Alloc >struct _Rope_RopeSubstring< _CharT, _Alloc >template<class _CharT2 , class _Alloc2 > rope< _CharT2, _Alloc2 > operator+ (const rope< _CharT2, _Alloc2 > &__left, _CharT2 __right)template<class _CharT2 , class _Alloc2 > rope< _CharT2, _Alloc2 > operator+ (const rope< _CharT2, _Alloc2 > &__left, const _CharT2 *__right)template<class _CharT2 , class _Alloc2 > rope< _CharT2, _Alloc2 > operator+ (const rope< _CharT2, _Alloc2 > &__left, const rope< _CharT2, _Alloc2 > &__right)
π Detailed Description π
okay so the actual declared shape is:
template<class _CharT, class _Alloc>
class __gnu_cxx::rope< _CharT, _Alloc >
and the description attached to it is β and I quote, verbatim β "This is an SGI extension."
that's it. that's the detailed description. it's giving "we said what we said" π
Todo: Needs documentation! See http://gcc.gnu.org/onlinedocs/libstdc++/manual/documentation_style.html
so yeah β straight from the source, this one is still waiting on its documentation glow-up. the manpage itself is telling you that the manpage needs work π iconic honestly, we love transparency π«Ά
π Author π
Generated automatically by Doxygen for libstdc++ from the source code.
that's the whole page bestie, you made it to the end π this edition was signed off as libst__gnu_cxx::rope< _CharT, _Alloc >(3cxx) β auto-generated by Doxygen for libstdc++ straight from the source code, and yes the page title really does that little libstβlib truncation thing at the top π
go forth and rope responsibly β¨π
π¦ where this page comes from
- debian trixie: libstdc++-12-doc 12.4.0-5
- debian trixie: libstdc++-13-doc 13.3.0-16
- ubuntu noble: libstdc++-12-doc 12.3.0-17ubuntu1
- ubuntu noble: libstdc++-12-doc 12.4.0-2ubuntu1~24.04.1
- ubuntu noble: libstdc++-13-doc 13.2.0-23ubuntu4
- ubuntu noble: libstdc++-13-doc 13.3.0-6ubuntu2~24.04.1
- ubuntu noble: libstdc++-14-doc 14-20240412-0ubuntu1
- ubuntu questing: libstdc++-12-doc 12.5.0-6ubuntu1
- ubuntu questing: libstdc++-13-doc 13.4.0-4ubuntu1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms