[#absl-Cord] = xref:absl.adoc[absl]::Cord :relfileprefix: ../ :mrdocs: A sequence of characters stored as a tree of buffers. == Synopsis Declared in `<absl/strings/cord.h>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- class Cord; ---- == Types [cols="1,4"] |=== | Name| Description | xref:absl/Cord/CharIterator.adoc[`CharIterator`] | Iterates over the constituent characters of a `Cord`. | xref:absl/Cord/CharRange.adoc[`CharRange`] | A range over the characters of a `Cord`, usable in a range‐based for loop. | xref:absl/Cord/ChunkIterator.adoc[`ChunkIterator`] | Iterates over the constituent chunks of a `Cord`. | xref:absl/Cord/ChunkRange.adoc[`ChunkRange`] | A range over the chunks of a `Cord`, usable in a range‐based for loop. |=== == Member Functions [cols="1,4"] |=== | Name| Description | xref:absl/Cord/2constructor-06.adoc[`Cord`] [.small]#[constructor]# | Constructors | xref:absl/Cord/2destructor.adoc[`~Cord`] [.small]#[destructor]# | Destructs the Cord. | xref:absl/Cord/operator_assign-0f9.adoc[`operator=`] | Assignment operators | xref:absl/Cord/Append-078.adoc[`Append`] | `Append` overloads | xref:absl/Cord/Chars.adoc[`Chars`] | Returns a `Cord::CharRange` for iterating over the characters of a `Cord` with a range‐based for‐loop. | xref:absl/Cord/Chunks.adoc[`Chunks`] | Returns a `Cord::ChunkRange` for iterating over the chunks of a `Cord` with a range‐based for‐loop. | xref:absl/Cord/Clear.adoc[`Clear`] | Releases the Cord data. | xref:absl/Cord/Compare-023.adoc[`Compare`] | `Compare` overloads | xref:absl/Cord/Contains-0e.adoc[`Contains`] | `Contains` overloads | xref:absl/Cord/EndsWith-08.adoc[`EndsWith`] | `EndsWith` overloads | xref:absl/Cord/EstimatedMemoryUsage.adoc[`EstimatedMemoryUsage`] | Returns the _approximate_ number of bytes held by this cord. | xref:absl/Cord/ExpectedChecksum.adoc[`ExpectedChecksum`] | Returns this cord's expected checksum, if it has one. Otherwise, returns nullopt. | xref:absl/Cord/Find-00.adoc[`Find`] | `Find` overloads | xref:absl/Cord/Flatten.adoc[`Flatten`] | Flattens the cord into a single array and returns a view of the data. | xref:absl/Cord/GetAppendBuffer.adoc[`GetAppendBuffer`] | Returns a CordBuffer, re‐using potential existing capacity in this cord. | xref:absl/Cord/GetCustomAppendBuffer.adoc[`GetCustomAppendBuffer`] | Returns a CordBuffer, re‐using potential existing capacity in this cord. | xref:absl/Cord/Prepend-0fa.adoc[`Prepend`] | `Prepend` overloads | xref:absl/Cord/RemovePrefix.adoc[`RemovePrefix`] | Removes the first `n` bytes of a Cord. | xref:absl/Cord/RemoveSuffix.adoc[`RemoveSuffix`] | Removes the last `n` bytes of a Cord. | xref:absl/Cord/SetExpectedChecksum.adoc[`SetExpectedChecksum`] | Stores a checksum value with this non‐empty cord instance, for later retrieval. | xref:absl/Cord/StartsWith-07.adoc[`StartsWith`] | `StartsWith` overloads | xref:absl/Cord/Subcord.adoc[`Subcord`] | Returns a new Cord representing the subrange [pos, pos + new_size) of] *this. | xref:absl/Cord/TryFlat.adoc[`TryFlat`] | If this cord's representation is a single flat array, returns a string_view referencing that array. Otherwise returns nullopt. | xref:absl/Cord/char_begin.adoc[`char_begin`] | Returns an iterator to the first character of the `Cord`. | xref:absl/Cord/char_end.adoc[`char_end`] | Returns an iterator to one past the last character of the `Cord`. | xref:absl/Cord/chunk_begin.adoc[`chunk_begin`] | Returns an iterator to the first chunk of the `Cord`. | xref:absl/Cord/chunk_end.adoc[`chunk_end`] | Returns an iterator one increment past the last chunk of the `Cord`. | xref:absl/Cord/empty.adoc[`empty`] | Determines whether the given Cord is empty, returning `true` if so. | xref:absl/Cord/operator_subs.adoc[`operator[]`] | Gets the "i"th character of the Cord and returns it, provided that 0 <= i < Cord.size(). | xref:absl/Cord/size.adoc[`size`] | Returns the size of the Cord. | xref:absl/Cord/swap.adoc[`swap`] | Swaps the contents of the Cord with `other`. | xref:absl/Cord/2conversion.adoc[`operator std::string`] | Converts a Cord into a `std::string()`. |=== == Static Member Functions [cols="1,4"] |=== | Name| Description | xref:absl/Cord/Advance.adoc[`Advance`] | Advances the `Cord::CharIterator` by `n_bytes`. | xref:absl/Cord/AdvanceAndRead.adoc[`AdvanceAndRead`] | Advances the `Cord::CharIterator` by `n_bytes` and returns the bytes advanced as a separate `Cord`. | xref:absl/Cord/ChunkRemaining.adoc[`ChunkRemaining`] | Returns the longest contiguous view starting at the iterator's position. | xref:absl/Cord/Distance.adoc[`Distance`] | Returns the distance between `first` and `last`, as if `std::distance(first, last)` was called. |=== == Friends [cols="1,4"] |=== | Name| Description | `absl::CrcCord` | | `xref:absl/GenericCompare.adoc[absl::GenericCompare]` | Compares `lhs` and `rhs` over the first `size_to_compare` bytes. | `xref:absl/GetCordzInfoForTesting.adoc[absl::GetCordzInfoForTesting]` | Returns the internal Cordz sampling info for `cord`, for testing. | `xref:absl/operator_3way-09.adoc[absl::operator<=>]` | Three‐way compares string data with a Cord. | `xref:absl/operator_3way-0c.adoc[absl::operator<=>]` | Three‐way compares a Cord with string data. | `xref:absl/operator_3way-030.adoc[absl::operator<=>]` | Three‐way compares two Cords. | `xref:absl/operator_eq-073.adoc[absl::operator==]` | Compares a Cord with string data for equality. | `xref:absl/operator_eq-0f7.adoc[absl::operator==]` | Compares two Cords for equality. | `xref:absl/CordTestPeer.adoc[absl::CordTestPeer]` | Test‐only accessor granting access to `Cord` internals. | `strings::CordReader` | | `xref:absl/AbslHashValue-02.adoc[absl::AbslHashValue]` | Combines the Cord's contents into a hash state. | `xref:absl/AbslStringify-0d.adoc[absl::AbslStringify]` | Supports automatic stringification with absl::StrCat and absl::StrFormat. | `xref:absl/AbslFormatFlush-08.adoc[absl::AbslFormatFlush]` | Supports absl::Cord as a sink object for absl::Format(). | `xref:absl/CopyCordToSpan.adoc[absl::CopyCordToSpan]` | Copies up to `dst.size()` bytes starting from the beginning of `src` to `dst`. | `xref:absl/AppendCordToString.adoc[absl::AppendCordToString]` | Appends the contents of a `src` Cord to a `*dst` string. | `xref:absl/CopyCordToString.adoc[absl::CopyCordToString]` | Copies the contents of a `src` Cord into a `*dst` string. | `xref:absl/swap-0d.adoc[absl::swap]` | Swaps the contents of two Cords. | `xref:absl/MakeCordFromExternal.adoc[absl::MakeCordFromExternal]` | Creates a Cord that takes ownership of external string memory. |=== == Non-Member Functions [cols="1,4"] |=== | Name| Description | xref:absl/operator_not_eq-04b.adoc[`operator!=`] | Compares two Cords for inequality. | xref:absl/operator_not_eq-0bf.adoc[`operator!=`] | Compares a Cord with string data for inequality. | xref:absl/operator_lt-0ce.adoc[`operator<`] | Orders one Cord before another. | xref:absl/operator_lt-0f.adoc[`operator<`] | Orders a Cord before string data. | xref:absl/operator_le-07a.adoc[`operator<=`] | Tests whether a Cord is ordered at or before string data. | xref:absl/operator_le-0b5.adoc[`operator<=`] | Tests whether one Cord is ordered at or before another. | xref:absl/operator_gt-02e.adoc[`operator>`] | Orders one Cord after another. | xref:absl/operator_gt-061.adoc[`operator>`] | Orders a Cord after string data. | xref:absl/operator_ge-04f.adoc[`operator>=`] | Tests whether one Cord is ordered at or after another. | xref:absl/operator_ge-05.adoc[`operator>=`] | Tests whether a Cord is ordered at or after string data. |=== [.small]#Created with https://www.mrdocs.com[MrDocs]#