Returns a Cord::ChunkRange for iterating over the chunks of a Cord with a range‐based for‐loop.

Synopsis

Declared in <absl/strings/cord.h>

Cord::ChunkRange
Chunks() const;

Description

For most iteration tasks on a Cord, use Cord::Chunks() to retrieve this iterator.

Example:

void ProcessChunks(const Cord& cord) { for (absl::string_view chunk : cord.Chunks()) { ... } }

Note that the ordinary caveats of temporary lifetime extension apply:

void Process() { for (absl::string_view chunk : CordFactory().Chunks()) { // The temporary Cord returned by CordFactory has been destroyed! } }

Return Value

A range over the chunks of the Cord.

Created with MrDocs