[#absl-Cord-ChunkIterator]
= xref:absl.adoc[absl]::xref:absl/Cord.adoc[Cord]::ChunkIterator
:relfileprefix: ../../
:mrdocs:

Iterates over the constituent chunks of a `Cord`&period;

== Synopsis

Declared in `&lt;absl&sol;strings&sol;cord&period;h&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
class ChunkIterator;
----

== Description

A `Cord&colon;&colon;ChunkIterator` allows iteration over the constituent chunks of its Cord&period; Such iteration allows you to perform non&hyphen;const operations on the data of a Cord without modifying it&period;

Generally, you do not instantiate a `Cord&colon;&colon;ChunkIterator` directly&semi; instead, you create one implicitly through use of the `Cord&colon;&colon;Chunks()` member function&period;

The `Cord&colon;&colon;ChunkIterator` has the following properties&colon;

&ast; The iterator is invalidated after any non&hyphen;const operation on the Cord object over which it iterates&period; &ast; The `string&lowbar;view` returned by dereferencing a valid, non&hyphen;`end()` iterator is guaranteed to be non&hyphen;empty&period; &ast; Two `ChunkIterator` objects can be compared equal if and only if they remain valid and iterate over the same Cord&period; &ast; The iterator in this case is a proxy iterator&semi; the `string&lowbar;view` returned by the iterator does not live inside the Cord, and its lifetime is limited to the lifetime of the iterator itself&period; To help prevent lifetime issues, `ChunkIterator&colon;&colon;reference` is not a true reference type and is equivalent to `value&lowbar;type`&period; &ast; The iterator keeps state that can grow for Cords that contain many nodes and are imbalanced due to sharing&period; Prefer to pass this type by const reference instead of by value&period;

== Type Aliases

[cols="1,4"]
|===
| Name| Description
| xref:absl/Cord/ChunkIterator/difference_type.adoc[`difference&lowbar;type`] 
| The type used to represent distances between iterators&period;
| xref:absl/Cord/ChunkIterator/iterator_category.adoc[`iterator&lowbar;category`] 
| The iterator category tag (input iterator)&period;
| xref:absl/Cord/ChunkIterator/pointer.adoc[`pointer`] 
| The pointer type for the iterated values&period;
| xref:absl/Cord/ChunkIterator/reference.adoc[`reference`] 
| The reference type for the iterated values&period;
| xref:absl/Cord/ChunkIterator/value_type.adoc[`value&lowbar;type`] 
| The type of the values iterated over&period;
|===


== Member Functions

[cols="1,4"]
|===
| Name| Description
| xref:absl/Cord/ChunkIterator/2constructor.adoc[`ChunkIterator`]         [.small]#[constructor]#
| Constructs an iterator in the end &sol; singular state&period;
| xref:absl/Cord/ChunkIterator/operator_star.adoc[`operator&ast;`] 
| Dereferences the iterator&period;
| xref:absl/Cord/ChunkIterator/operator_inc-07.adoc[`operator&plus;&plus;`] 
| Advances the iterator to the next chunk&period;
| xref:absl/Cord/ChunkIterator/operator_ptr.adoc[`operator&hyphen;&gt;`] 
| Member&hyphen;access dereference of the iterator&period;
| xref:absl/Cord/ChunkIterator/operator_eq.adoc[`operator&equals;&equals;`] 
| Compares two iterators for equality&period;
| xref:absl/Cord/ChunkIterator/operator_not_eq.adoc[`operator!&equals;`] 
| Compares two iterators for inequality&period;
|===


== Friends

[cols="1,4"]
|===
| Name| Description
| `xref:absl/Cord/CharIterator.adoc[absl::Cord::CharIterator]`
| Iterates over the constituent characters of a `Cord`&period;
| `xref:absl/Cord.adoc[absl::Cord]`
| A sequence of characters stored as a tree of buffers&period;
|===


[.small]#Created with https://www.mrdocs.com[MrDocs]#
