[#BloombergLP-bslstl-ForwardIterator] = xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/bslstl.adoc[bslstl]::ForwardIterator :relfileprefix: ../../ :mrdocs: Given an `ITER_IMP` type that implements a minimal subset of an iterator interface, this template generates a complete iterator that meets all of the requirements of a "forward iterator" in the C++ standard. If `T` is const‐qualified, then the resulting type is a const iterator. `T` shall not be a function, reference type or void. `ITER_IMP` must provide public operations so that, for objects `i` and `j` of type `ITER_IMP`, the following operations are supported: ` ITER_IMP i; Default construction ITER_IMP j(i); Copy construction i = j Assignment ++i Increment to next element i == j // convertible to bool Equality comparison *i // reference convertible to T& Element access (dereference) ` == Synopsis Declared in `<bslstl_forwarditerator.h>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template< class T, class ITER_IMP, class TAG_TYPE = std::forward_iterator_tag> class ForwardIterator; ---- == Type Aliases [cols="1,4"] |=== | Name| Description | xref:BloombergLP/bslstl/ForwardIterator/difference_type.adoc[`difference_type`] | Iterator difference type. | xref:BloombergLP/bslstl/ForwardIterator/iterator_category.adoc[`iterator_category`] | Standard forward iterator category tag. | xref:BloombergLP/bslstl/ForwardIterator/pointer.adoc[`pointer`] | Pointer type for the iterator's value type. | xref:BloombergLP/bslstl/ForwardIterator/reference.adoc[`reference`] | Reference type for the iterator's value type. | xref:BloombergLP/bslstl/ForwardIterator/value_type.adoc[`value_type`] | Value type for this iterator. |=== == Member Functions [cols="1,4"] |=== | Name| Description | xref:BloombergLP/bslstl/ForwardIterator/2constructor-05.adoc[`ForwardIterator`] [.small]#[constructor]# | Constructors | xref:BloombergLP/bslstl/ForwardIterator/operator_assign.adoc[`operator=`] | Copy the value of the specified `rhs` of another (compatible) `ForwardIterator` type, (e.g., a mutable iterator of the same type) to this iterator. Return a reference to this modifiable object. Note that this method may be the copy‐assignment operator (inhibiting the implicit declaration of a copy‐assignment operator above), or may be an additional overload. | xref:BloombergLP/bslstl/ForwardIterator/imp-0e.adoc[`imp`] | `imp` overloads | xref:BloombergLP/bslstl/ForwardIterator/operator_star.adoc[`operator*`] | Return a reference to the current, modifiable element. The behavior is undefined if this iterator has the past‐the‐end value for an iterator over the underlying sequence. | xref:BloombergLP/bslstl/ForwardIterator/operator_inc.adoc[`operator++`] | Increment to the next element. Return a reference to this modifiable iterator. The behavior is undefined if, on entry, this iterator has the past‐the‐end value for an iterator over the underlying sequence. | xref:BloombergLP/bslstl/ForwardIterator/operator_ptr.adoc[`operator‐>`] | Return a pointer to the current, modifiable element. The behavior is undefined if this iterator has the past‐the‐end value for an iterator over the underlying sequence. |=== == Non-Member Functions [cols="1,4"] |=== | Name| Description | xref:BloombergLP/bslstl/operator_not_eq-0bc.adoc[`operator!=`] | Return `true` if the specified `lhs` iterator does not have the same value as the specified `rhs` iterator, and `false` otherwise. Two iterators do not have the same value if (1) they do not refer to the same element and (2) both do not have the past‐the‐end iterator value for the underlying sequence. The behavior is undefined unless both iterators refer to the same underlying sequence. | xref:BloombergLP/bslstl/operator_inc-008.adoc[`operator++`] | Increment the specified `iter` to the next element. Return the previous value of `iter`. The behavior is undefined if, on entry, `iter` has the past‐the‐end value for an iterator of the underlying sequence. | xref:BloombergLP/bslstl/operator_eq-066.adoc[`operator==`] | Return `true` if the specified `lhs` iterator has the same value as the specified `rhs` iterator, and `false` otherwise. Two iterators have the same value if they refer to the same element, or both have the past‐the‐ end value for the underlying sequence. The behavior is undefined unless both iterators refer to the same underlying sequence. |=== == Derived Classes [cols="1,4"] |=== | Name| Description | xref:BloombergLP/bslstl/BidirectionalIterator.adoc[`BidirectionalIterator`] | Given an `ITER_IMP` type that implements a minimal subset of an iterator interface, this template generates a complete iterator that meets all of the requirements of a "bidirectional iterator" in the C++ standard. If `T` is `const`‐qualified, then the resulting type is a constant iterator. `T` shall not be a function, reference type or void. `ITER_IMP` must provide public operations so that, for objects `i` and `j` of type `ITER_IMP`, the following operations are supported: ` ITER_IMP i; default construction ITER_IMP j(i); copy construction i = j assignment ++i increment to next element ‐‐i decrement to previous element i == j // convertible to bool equality comparison *i // reference convertible to T& element access (dereference) ` |=== [.small]#Created with https://www.mrdocs.com[MrDocs]#