Files
2025-10-25 03:02:53 +03:00

47 lines
1.7 KiB
Markdown
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

[depr.iterator]
# Annex D (normative) Compatibility features [[depr]](./#depr)
## D.17 Deprecated iterator class template [depr.iterator]
[1](#1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/future.tex#L638)
The header [<iterator>](iterator.synopsis#header:%3citerator%3e "24.2Header <iterator>&nbsp;synopsis[iterator.synopsis]") has the following addition:
[🔗](#lib:iterator)
namespace std {template<class Category, class T, class Distance = ptrdiff_t, class Pointer = T*, class Reference = T&>struct iterator {using iterator_category = Category; using value_type = T; using difference_type = Distance; using pointer = Pointer; using reference = Reference; };}
[2](#2)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/future.tex#L655)
Theiterator template may be used as a base class to ease the definition of required types
for new iterators[.](#2.sentence-1)
[3](#3)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/future.tex#L661)
[*Note [1](#note-1)*:
If the new iterator type is a class template, then these aliases
will not be visible from within the iterator class's template definition, but
only to callers of that class[.](#3.sentence-1)
— *end note*]
[4](#4)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/future.tex#L668)
[*Example [1](#example-1)*:
If a C++ program wants to define a bidirectional iterator for some data
structure containing double and such that it works on a large memory
model of the implementation, it can do so with:class MyIterator :public iterator<bidirectional_iterator_tag, double, long, T*, T&> {// code implementing ++, etc.};
— *end example*]