[iterator.synopsis]

# 24 Iterators library [[iterators]](./#iterators)

## 24.2 Header <iterator> synopsis [iterator.synopsis]

[ð](#header:%3citerator%3e)

#include <compare> // see [[compare.syn]](compare.syn "17.12.1 Header <compare> synopsis")#include <concepts> // see [[concepts.syn]](concepts.syn "18.3 Header <concepts> synopsis")namespace std {template<class T> using *with-reference* = T&; // *exposition only*template<class T> concept [*can-reference*](#concept:can-reference "24.2 Header <iterator>&nbsp;synopsis [iterator.synopsis]") // *exposition only*= requires { typename *with-reference*<T>; }; template<class T> concept [*dereferenceable*](#concept:dereferenceable "24.2 Header <iterator>&nbsp;synopsis [iterator.synopsis]") // *exposition only*= requires(T& t) {{ *t } -> [*can-reference*](#concept:can-reference "24.2 Header <iterator>&nbsp;synopsis [iterator.synopsis]"); // not required to be equality-preserving}; // [[iterator.assoc.types]](iterator.assoc.types "24.3.2 Associated types"), associated types// [[incrementable.traits]](incrementable.traits "24.3.2.1 Incrementable traits"), incrementable traitstemplate<class> struct incrementable_traits; // freestandingtemplate<class T>using iter_difference_t = *see below*; // freestanding// [[readable.traits]](readable.traits "24.3.2.2 Indirectly readable traits"), indirectly readable traitstemplate<class> struct indirectly_readable_traits; // freestandingtemplate<class T>using iter_value_t = *see below*; // freestanding// [[iterator.traits]](iterator.traits "24.3.2.3 Iterator traits"), iterator traitstemplate<class I> struct iterator_traits; // freestandingtemplate<class T> requires is_object_v<T> struct iterator_traits<T*>; // freestandingtemplate<[*dereferenceable*](#concept:dereferenceable "24.2 Header <iterator>&nbsp;synopsis [iterator.synopsis]") T>using [iter_reference_t](#lib:iter_reference_t "24.2 Header <iterator>&nbsp;synopsis [iterator.synopsis]") = decltype(*declval<T&>()); // freestandingnamespace ranges {// [[iterator.cust]](iterator.cust "24.3.3 Customization point objects"), customization point objectsinline namespace *unspecified* {// [[iterator.cust.move]](iterator.cust.move "24.3.3.1 ranges​::​iter_­move"), ranges​::​iter_moveinline constexpr *unspecified* iter_move = *unspecified*; // freestanding// [[iterator.cust.swap]](iterator.cust.swap "24.3.3.2 ranges​::​iter_­swap"), ranges​::​iter_swapinline constexpr *unspecified* iter_swap = *unspecified*; // freestanding}}template<[*dereferenceable*](#concept:dereferenceable "24.2 Header <iterator>&nbsp;synopsis [iterator.synopsis]") T>requires requires(T& t) {{ ranges::iter_move(t) } -> [*can-reference*](#concept:can-reference "24.2 Header <iterator>&nbsp;synopsis [iterator.synopsis]"); }using [iter_rvalue_reference_t](#lib:iter_rvalue_reference_t "24.2 Header <iterator>&nbsp;synopsis [iterator.synopsis]") // freestanding= decltype(ranges::iter_move(declval<T&>())); // [[iterator.concepts]](iterator.concepts "24.3.4 Iterator concepts"), iterator concepts// [[iterator.concept.readable]](iterator.concept.readable "24.3.4.2 Concept indirectly_­readable"), concept [indirectly_readable](iterator.concept.readable#concept:indirectly_readable "24.3.4.2 Concept indirectly_­readable [iterator.concept.readable]")template<class In>concept indirectly_readable = *see below*; // freestanding// [[indirectcallable.traits]](indirectcallable.traits "24.3.6.2 Indirect callable traits"), indirect callable traitstemplate<[indirectly_readable](iterator.concept.readable#concept:indirectly_readable "24.3.4.2 Concept indirectly_­readable [iterator.concept.readable]") T>using *indirect-value-t* = *see below*; // *exposition only*template<[indirectly_readable](iterator.concept.readable#concept:indirectly_readable "24.3.4.2 Concept indirectly_­readable [iterator.concept.readable]") T>using [iter_common_reference_t](#lib:iter_common_reference_t "24.2 Header <iterator>&nbsp;synopsis [iterator.synopsis]") = // freestanding common_reference_t<iter_reference_t<T>, *indirect-value-t*<T>>; // [[iterator.concept.writable]](iterator.concept.writable "24.3.4.3 Concept indirectly_­writable"), concept [indirectly_writable](iterator.concept.writable#concept:indirectly_writable "24.3.4.3 Concept indirectly_­writable [iterator.concept.writable]")template<class Out, class T>concept indirectly_writable = *see below*; // freestanding// [[iterator.concept.winc]](iterator.concept.winc "24.3.4.4 Concept weakly_­incrementable"), concept [weakly_incrementable](iterator.concept.winc#concept:weakly_incrementable "24.3.4.4 Concept weakly_­incrementable [iterator.concept.winc]")template<class I>concept weakly_incrementable = *see below*; // freestanding// [[iterator.concept.inc]](iterator.concept.inc "24.3.4.5 Concept incrementable"), concept [incrementable](iterator.concept.inc#concept:incrementable "24.3.4.5 Concept incrementable [iterator.concept.inc]")template<class I>concept incrementable = *see below*; // freestanding// [[iterator.concept.iterator]](iterator.concept.iterator "24.3.4.6 Concept input_­or_­output_­iterator"), concept [input_or_output_iterator](iterator.concept.iterator#concept:input_or_output_iterator "24.3.4.6 Concept input_­or_­output_­iterator [iterator.concept.iterator]")template<class I>concept input_or_output_iterator = *see below*; // freestanding// [[iterator.concept.sentinel]](iterator.concept.sentinel "24.3.4.7 Concept sentinel_­for"), concept [sentinel_for](iterator.concept.sentinel#concept:sentinel_for "24.3.4.7 Concept sentinel_­for [iterator.concept.sentinel]")template<class S, class I>concept sentinel_for = *see below*; // freestanding// [[iterator.concept.sizedsentinel]](iterator.concept.sizedsentinel "24.3.4.8 Concept sized_­sentinel_­for"), concept [sized_sentinel_for](iterator.concept.sizedsentinel#concept:sized_sentinel_for "24.3.4.8 Concept sized_­sentinel_­for [iterator.concept.sizedsentinel]")template<class S, class I>constexpr bool disable_sized_sentinel_for = false; // freestandingtemplate<class S, class I>concept sized_sentinel_for = *see below*; // freestanding// [[iterator.concept.input]](iterator.concept.input "24.3.4.9 Concept input_­iterator"), concept [input_iterator](iterator.concept.input#concept:input_iterator "24.3.4.9 Concept input_­iterator [iterator.concept.input]")template<class I>concept input_iterator = *see below*; // freestanding// [[iterator.concept.output]](iterator.concept.output "24.3.4.10 Concept output_­iterator"), concept [output_iterator](iterator.concept.output#concept:output_iterator "24.3.4.10 Concept output_­iterator [iterator.concept.output]")template<class I, class T>concept output_iterator = *see below*; // freestanding// [[iterator.concept.forward]](iterator.concept.forward "24.3.4.11 Concept forward_­iterator"), concept [forward_iterator](iterator.concept.forward#concept:forward_iterator "24.3.4.11 Concept forward_­iterator [iterator.concept.forward]")template<class I>concept forward_iterator = *see below*; // freestanding// [[iterator.concept.bidir]](iterator.concept.bidir "24.3.4.12 Concept bidirectional_­iterator"), concept [bidirectional_iterator](iterator.concept.bidir#concept:bidirectional_iterator "24.3.4.12 Concept bidirectional_­iterator [iterator.concept.bidir]")template<class I>concept bidirectional_iterator = *see below*; // freestanding// [[iterator.concept.random.access]](iterator.concept.random.access "24.3.4.13 Concept random_­access_­iterator"), concept [random_access_iterator](iterator.concept.random.access#concept:random_access_iterator "24.3.4.13 Concept random_­access_­iterator [iterator.concept.random.access]")template<class I>concept random_access_iterator = *see below*; // freestanding// [[iterator.concept.contiguous]](iterator.concept.contiguous "24.3.4.14 Concept contiguous_­iterator"), concept [contiguous_iterator](iterator.concept.contiguous#concept:contiguous_iterator "24.3.4.14 Concept contiguous_­iterator [iterator.concept.contiguous]")template<class I>concept contiguous_iterator = *see below*; // freestanding// [[indirectcallable]](indirectcallable "24.3.6 Indirect callable requirements"), indirect callable requirements// [[indirectcallable.indirectinvocable]](indirectcallable.indirectinvocable "24.3.6.3 Indirect callables"), indirect callablestemplate<class F, class I>concept indirectly_unary_invocable = *see below*; // freestandingtemplate<class F, class I>concept indirectly_regular_unary_invocable = *see below*; // freestandingtemplate<class F, class I>concept indirect_unary_predicate = *see below*; // freestandingtemplate<class F, class I1, class I2>concept indirect_binary_predicate = *see below*; // freestandingtemplate<class F, class I1, class I2 = I1>concept indirect_equivalence_relation = *see below*; // freestandingtemplate<class F, class I1, class I2 = I1>concept indirect_strict_weak_order = *see below*; // freestandingtemplate<class F, class... Is>requires ([indirectly_readable](iterator.concept.readable#concept:indirectly_readable "24.3.4.2 Concept indirectly_­readable [iterator.concept.readable]")<Is> && ...) && [invocable](concept.invocable#concept:invocable "18.7.2 Concept invocable [concept.invocable]")<F, iter_reference_t<Is>...>using [indirect_result_t](#lib:indirect_result_t "24.2 Header <iterator>&nbsp;synopsis [iterator.synopsis]") = invoke_result_t<F, iter_reference_t<Is>...>; // freestanding// [[projected]](projected "24.3.6.4 Alias template projected"), projectedtemplate<[indirectly_readable](iterator.concept.readable#concept:indirectly_readable "24.3.4.2 Concept indirectly_­readable [iterator.concept.readable]") I, [indirectly_regular_unary_invocable](indirectcallable.indirectinvocable#concept:indirectly_regular_unary_invocable "24.3.6.3 Indirect callables [indirectcallable.indirectinvocable]")<I> Proj>using projected = *see below*; // freestandingtemplate<[indirectly_readable](iterator.concept.readable#concept:indirectly_readable "24.3.4.2 Concept indirectly_­readable [iterator.concept.readable]") I, [indirectly_regular_unary_invocable](indirectcallable.indirectinvocable#concept:indirectly_regular_unary_invocable "24.3.6.3 Indirect callables [indirectcallable.indirectinvocable]")<I> Proj>using projected_value_t = // freestanding remove_cvref_t<invoke_result_t<Proj&, iter_value_t<I>&>>; // [[alg.req]](alg.req "24.3.7 Common algorithm requirements"), common algorithm requirements// [[alg.req.ind.move]](alg.req.ind.move "24.3.7.2 Concept indirectly_­movable"), concept [indirectly_movable](alg.req.ind.move#concept:indirectly_movable "24.3.7.2 Concept indirectly_­movable [alg.req.ind.move]")template<class In, class Out>concept indirectly_movable = *see below*; // freestandingtemplate<class In, class Out>concept indirectly_movable_storable = *see below*; // freestanding// [[alg.req.ind.copy]](alg.req.ind.copy "24.3.7.3 Concept indirectly_­copyable"), concept [indirectly_copyable](alg.req.ind.copy#concept:indirectly_copyable "24.3.7.3 Concept indirectly_­copyable [alg.req.ind.copy]")template<class In, class Out>concept indirectly_copyable = *see below*; // freestandingtemplate<class In, class Out>concept indirectly_copyable_storable = *see below*; // freestanding// [[alg.req.ind.swap]](alg.req.ind.swap "24.3.7.4 Concept indirectly_­swappable"), concept [indirectly_swappable](alg.req.ind.swap#concept:indirectly_swappable "24.3.7.4 Concept indirectly_­swappable [alg.req.ind.swap]")template<class I1, class I2 = I1>concept indirectly_swappable = *see below*; // freestanding// [[alg.req.ind.cmp]](alg.req.ind.cmp "24.3.7.5 Concept indirectly_­comparable"), concept [indirectly_comparable](alg.req.ind.cmp#concept:indirectly_comparable "24.3.7.5 Concept indirectly_­comparable [alg.req.ind.cmp]")template<class I1, class I2, class R, class P1 = identity, class P2 = identity>concept indirectly_comparable = *see below*; // freestanding// [[alg.req.permutable]](alg.req.permutable "24.3.7.6 Concept permutable"), concept [permutable](alg.req.permutable#concept:permutable "24.3.7.6 Concept permutable [alg.req.permutable]")template<class I>concept permutable = *see below*; // freestanding// [[alg.req.mergeable]](alg.req.mergeable "24.3.7.7 Concept mergeable"), concept [mergeable](alg.req.mergeable#concept:mergeable "24.3.7.7 Concept mergeable [alg.req.mergeable]")template<class I1, class I2, class Out, class R = ranges::less, class P1 = identity, class P2 = identity>concept mergeable = *see below*; // freestanding// [[alg.req.sortable]](alg.req.sortable "24.3.7.8 Concept sortable"), concept [sortable](alg.req.sortable#concept:sortable "24.3.7.8 Concept sortable [alg.req.sortable]")template<class I, class R = ranges::less, class P = identity>concept sortable = *see below*; // freestanding// [[iterator.primitives]](iterator.primitives "24.4 Iterator primitives"), primitives// [[std.iterator.tags]](std.iterator.tags "24.4.2 Standard iterator tags"), iterator tagsstruct input_iterator_tag { }; // freestandingstruct output_iterator_tag { }; // freestandingstruct forward_iterator_tag: public input_iterator_tag { }; // freestandingstruct bidirectional_iterator_tag: public forward_iterator_tag { }; // freestandingstruct random_access_iterator_tag: public bidirectional_iterator_tag { }; // freestandingstruct contiguous_iterator_tag: public random_access_iterator_tag { }; // freestanding// [[iterator.operations]](iterator.operations "24.4.3 Iterator operations"), iterator operationstemplate<class InputIterator, class Distance>constexpr void advance(InputIterator& i, Distance n); // freestandingtemplate<class InputIterator>constexpr typename iterator_traits<InputIterator>::difference_type
 distance(InputIterator first, InputIterator last); // freestandingtemplate<class InputIterator>constexpr InputIterator
 next(InputIterator x, // freestandingtypename iterator_traits<InputIterator>::difference_type n = 1); template<class BidirectionalIterator>constexpr BidirectionalIterator
 prev(BidirectionalIterator x, // freestandingtypename iterator_traits<BidirectionalIterator>::difference_type n = 1); // [[range.iter.ops]](range.iter.ops "24.4.4 Range iterator operations"), range iterator operationsnamespace ranges {// [[range.iter.op.advance]](range.iter.op.advance "24.4.4.2 ranges​::​advance"), ranges​::​advancetemplate<[input_or_output_iterator](iterator.concept.iterator#concept:input_or_output_iterator "24.3.4.6 Concept input_­or_­output_­iterator [iterator.concept.iterator]") I>constexpr void advance(I& i, iter_difference_t<I> n); // freestandingtemplate<[input_or_output_iterator](iterator.concept.iterator#concept:input_or_output_iterator "24.3.4.6 Concept input_­or_­output_­iterator [iterator.concept.iterator]") I, [sentinel_for](iterator.concept.sentinel#concept:sentinel_for "24.3.4.7 Concept sentinel_­for [iterator.concept.sentinel]")<I> S>constexpr void advance(I& i, S bound); // freestandingtemplate<[input_or_output_iterator](iterator.concept.iterator#concept:input_or_output_iterator "24.3.4.6 Concept input_­or_­output_­iterator [iterator.concept.iterator]") I, [sentinel_for](iterator.concept.sentinel#concept:sentinel_for "24.3.4.7 Concept sentinel_­for [iterator.concept.sentinel]")<I> S>constexpr iter_difference_t<I> advance(I& i, iter_difference_t<I> n, // freestanding S bound); // [[range.iter.op.distance]](range.iter.op.distance "24.4.4.3 ranges​::​distance"), ranges​::​distancetemplate<class I, [sentinel_for](iterator.concept.sentinel#concept:sentinel_for "24.3.4.7 Concept sentinel_­for [iterator.concept.sentinel]")<I> S>requires (![sized_sentinel_for](iterator.concept.sizedsentinel#concept:sized_sentinel_for "24.3.4.8 Concept sized_­sentinel_­for [iterator.concept.sizedsentinel]")<S, I>)constexpr iter_difference_t<I> distance(I first, S last); // freestandingtemplate<class I, [sized_sentinel_for](iterator.concept.sizedsentinel#concept:sized_sentinel_for "24.3.4.8 Concept sized_­sentinel_­for [iterator.concept.sizedsentinel]")<decay_t<I>> S>constexpr iter_difference_t<decay_t<I>> distance(I&& first, S last); // freestandingtemplate<[range](range.range#concept:range "25.4.2 Ranges [range.range]") R>constexpr range_difference_t<R> distance(R&& r); // freestanding// [[range.iter.op.next]](range.iter.op.next "24.4.4.4 ranges​::​next"), ranges​::​nexttemplate<[input_or_output_iterator](iterator.concept.iterator#concept:input_or_output_iterator "24.3.4.6 Concept input_­or_­output_­iterator [iterator.concept.iterator]") I>constexpr I next(I x); // freestandingtemplate<[input_or_output_iterator](iterator.concept.iterator#concept:input_or_output_iterator "24.3.4.6 Concept input_­or_­output_­iterator [iterator.concept.iterator]") I>constexpr I next(I x, iter_difference_t<I> n); // freestandingtemplate<[input_or_output_iterator](iterator.concept.iterator#concept:input_or_output_iterator "24.3.4.6 Concept input_­or_­output_­iterator [iterator.concept.iterator]") I, [sentinel_for](iterator.concept.sentinel#concept:sentinel_for "24.3.4.7 Concept sentinel_­for [iterator.concept.sentinel]")<I> S>constexpr I next(I x, S bound); // freestandingtemplate<[input_or_output_iterator](iterator.concept.iterator#concept:input_or_output_iterator "24.3.4.6 Concept input_­or_­output_­iterator [iterator.concept.iterator]") I, [sentinel_for](iterator.concept.sentinel#concept:sentinel_for "24.3.4.7 Concept sentinel_­for [iterator.concept.sentinel]")<I> S>constexpr I next(I x, iter_difference_t<I> n, S bound); // freestanding// [[range.iter.op.prev]](range.iter.op.prev "24.4.4.5 ranges​::​prev"), ranges​::​prevtemplate<[bidirectional_iterator](iterator.concept.bidir#concept:bidirectional_iterator "24.3.4.12 Concept bidirectional_­iterator [iterator.concept.bidir]") I>constexpr I prev(I x); // freestandingtemplate<[bidirectional_iterator](iterator.concept.bidir#concept:bidirectional_iterator "24.3.4.12 Concept bidirectional_­iterator [iterator.concept.bidir]") I>constexpr I prev(I x, iter_difference_t<I> n); // freestandingtemplate<[bidirectional_iterator](iterator.concept.bidir#concept:bidirectional_iterator "24.3.4.12 Concept bidirectional_­iterator [iterator.concept.bidir]") I>constexpr I prev(I x, iter_difference_t<I> n, I bound); // freestanding}// [[predef.iterators]](predef.iterators "24.5 Iterator adaptors"), predefined iterators and sentinels// [[reverse.iterators]](reverse.iterators "24.5.1 Reverse iterators"), reverse iteratorstemplate<class Iterator> class reverse_iterator; // freestandingtemplate<class Iterator1, class Iterator2>constexpr bool operator==( // freestandingconst reverse_iterator<Iterator1>& x, const reverse_iterator<Iterator2>& y); template<class Iterator1, class Iterator2>constexpr bool operator!=( // freestandingconst reverse_iterator<Iterator1>& x, const reverse_iterator<Iterator2>& y); template<class Iterator1, class Iterator2>constexpr bool operator<( // freestandingconst reverse_iterator<Iterator1>& x, const reverse_iterator<Iterator2>& y); template<class Iterator1, class Iterator2>constexpr bool operator>( // freestandingconst reverse_iterator<Iterator1>& x, const reverse_iterator<Iterator2>& y); template<class Iterator1, class Iterator2>constexpr bool operator<=( // freestandingconst reverse_iterator<Iterator1>& x, const reverse_iterator<Iterator2>& y); template<class Iterator1, class Iterator2>constexpr bool operator>=( // freestandingconst reverse_iterator<Iterator1>& x, const reverse_iterator<Iterator2>& y); template<class Iterator1, [three_way_comparable_with](cmp.concept#concept:three_way_comparable_with "17.12.4 Concept three_­way_­comparable [cmp.concept]")<Iterator1> Iterator2>constexpr compare_three_way_result_t<Iterator1, Iterator2>operator<=>(const reverse_iterator<Iterator1>& x, // freestandingconst reverse_iterator<Iterator2>& y); template<class Iterator1, class Iterator2>constexpr auto operator-( // freestandingconst reverse_iterator<Iterator1>& x, const reverse_iterator<Iterator2>& y) -> decltype(y.base() - x.base()); template<class Iterator>constexpr reverse_iterator<Iterator> operator+( // freestanding iter_difference_t<Iterator> n, const reverse_iterator<Iterator>& x); template<class Iterator>constexpr reverse_iterator<Iterator> make_reverse_iterator(Iterator i); // freestandingtemplate<class Iterator1, class Iterator2>requires (![sized_sentinel_for](iterator.concept.sizedsentinel#concept:sized_sentinel_for "24.3.4.8 Concept sized_­sentinel_­for [iterator.concept.sizedsentinel]")<Iterator1, Iterator2>)constexpr bool disable_sized_sentinel_for<reverse_iterator<Iterator1>, // freestanding reverse_iterator<Iterator2>> = true; // [[insert.iterators]](insert.iterators "24.5.2 Insert iterators"), insert iteratorstemplate<class Container> class back_insert_iterator; // freestandingtemplate<class Container>constexpr back_insert_iterator<Container> back_inserter(Container& x); // freestandingtemplate<class Container> class front_insert_iterator; // freestandingtemplate<class Container>constexpr front_insert_iterator<Container> front_inserter(Container& x); // freestandingtemplate<class Container> class insert_iterator; // freestandingtemplate<class Container>constexpr insert_iterator<Container> inserter(Container& x, ranges::iterator_t<Container> i); // freestanding// [[const.iterators]](const.iterators "24.5.3 Constant iterators and sentinels"), constant iterators and sentinels// [[const.iterators.alias]](const.iterators.alias "24.5.3.2 Alias templates"), alias templatestemplate<[indirectly_readable](iterator.concept.readable#concept:indirectly_readable "24.3.4.2 Concept indirectly_­readable [iterator.concept.readable]") I>using iter_const_reference_t = *see below*; // freestandingtemplate<class Iterator>concept [*constant-iterator*](const.iterators.alias#concept:constant-iterator "24.5.3.2 Alias templates [const.iterators.alias]") = *see below*; // *exposition only*template<[input_iterator](iterator.concept.input#concept:input_iterator "24.3.4.9 Concept input_­iterator [iterator.concept.input]") I>using const_iterator = *see below*; // freestandingtemplate<[semiregular](concepts.object#concept:semiregular "18.6 Object concepts [concepts.object]") S>using const_sentinel = *see below*; // freestanding// [[const.iterators.iterator]](const.iterators.iterator "24.5.3.3 Class template basic_­const_­iterator"), class template basic_const_iteratortemplate<[input_iterator](iterator.concept.input#concept:input_iterator "24.3.4.9 Concept input_­iterator [iterator.concept.input]") Iterator>class basic_const_iterator; // freestandingtemplate<class T, [common_with](concept.common#concept:common_with "18.4.6 Concept common_­with [concept.common]")<T> U>requires [input_iterator](iterator.concept.input#concept:input_iterator "24.3.4.9 Concept input_­iterator [iterator.concept.input]")<common_type_t<T, U>>struct common_type<basic_const_iterator<T>, U> { // freestandingusing type = basic_const_iterator<common_type_t<T, U>>; }; template<class T, [common_with](concept.common#concept:common_with "18.4.6 Concept common_­with [concept.common]")<T> U>requires [input_iterator](iterator.concept.input#concept:input_iterator "24.3.4.9 Concept input_­iterator [iterator.concept.input]")<common_type_t<T, U>>struct common_type<U, basic_const_iterator<T>> { // freestandingusing type = basic_const_iterator<common_type_t<T, U>>; }; template<class T, [common_with](concept.common#concept:common_with "18.4.6 Concept common_­with [concept.common]")<T> U>requires [input_iterator](iterator.concept.input#concept:input_iterator "24.3.4.9 Concept input_­iterator [iterator.concept.input]")<common_type_t<T, U>>struct common_type<basic_const_iterator<T>, basic_const_iterator<U>> { // freestandingusing type = basic_const_iterator<common_type_t<T, U>>; }; template<[input_iterator](iterator.concept.input#concept:input_iterator "24.3.4.9 Concept input_­iterator [iterator.concept.input]") I>constexpr const_iterator<I> [make_const_iterator](#lib:make_const_iterator "24.2 Header <iterator>&nbsp;synopsis [iterator.synopsis]")(I it) { return it; } // freestandingtemplate<[semiregular](concepts.object#concept:semiregular "18.6 Object concepts [concepts.object]") S>constexpr const_sentinel<S> [make_const_sentinel](#lib:make_const_sentinel "24.2 Header <iterator>&nbsp;synopsis [iterator.synopsis]")(S s) { return s; } // freestanding// [[move.iterators]](move.iterators "24.5.4 Move iterators and sentinels"), move iterators and sentinelstemplate<class Iterator> class move_iterator; // freestandingtemplate<class Iterator1, class Iterator2>constexpr bool operator==( // freestandingconst move_iterator<Iterator1>& x, const move_iterator<Iterator2>& y); template<class Iterator1, class Iterator2>constexpr bool operator<( // freestandingconst move_iterator<Iterator1>& x, const move_iterator<Iterator2>& y); template<class Iterator1, class Iterator2>constexpr bool operator>( // freestandingconst move_iterator<Iterator1>& x, const move_iterator<Iterator2>& y); template<class Iterator1, class Iterator2>constexpr bool operator<=( // freestandingconst move_iterator<Iterator1>& x, const move_iterator<Iterator2>& y); template<class Iterator1, class Iterator2>constexpr bool operator>=( // freestandingconst move_iterator<Iterator1>& x, const move_iterator<Iterator2>& y); template<class Iterator1, [three_way_comparable_with](cmp.concept#concept:three_way_comparable_with "17.12.4 Concept three_­way_­comparable [cmp.concept]")<Iterator1> Iterator2>constexpr compare_three_way_result_t<Iterator1, Iterator2>operator<=>(const move_iterator<Iterator1>& x, // freestandingconst move_iterator<Iterator2>& y); template<class Iterator1, class Iterator2>constexpr auto operator-( // freestandingconst move_iterator<Iterator1>& x, const move_iterator<Iterator2>& y)-> decltype(x.base() - y.base()); template<class Iterator>constexpr move_iterator<Iterator>operator+(iter_difference_t<Iterator> n, const move_iterator<Iterator>& x); // freestandingtemplate<class Iterator>constexpr move_iterator<Iterator> make_move_iterator(Iterator i); // freestandingtemplate<class Iterator1, class Iterator2>requires (![sized_sentinel_for](iterator.concept.sizedsentinel#concept:sized_sentinel_for "24.3.4.8 Concept sized_­sentinel_­for [iterator.concept.sizedsentinel]")<Iterator1, Iterator2>)constexpr bool disable_sized_sentinel_for<move_iterator<Iterator1>, // freestanding move_iterator<Iterator2>> = true; template<[semiregular](concepts.object#concept:semiregular "18.6 Object concepts [concepts.object]") S> class move_sentinel; // freestanding// [[iterators.common]](iterators.common "24.5.5 Common iterators"), common iteratorstemplate<[input_or_output_iterator](iterator.concept.iterator#concept:input_or_output_iterator "24.3.4.6 Concept input_­or_­output_­iterator [iterator.concept.iterator]") I, [sentinel_for](iterator.concept.sentinel#concept:sentinel_for "24.3.4.7 Concept sentinel_­for [iterator.concept.sentinel]")<I> S>requires (![same_as](concept.same#concept:same_as "18.4.2 Concept same_­as [concept.same]")<I, S> && [copyable](concepts.object#concept:copyable "18.6 Object concepts [concepts.object]")<I>)class common_iterator; // freestandingtemplate<class I, class S>struct incrementable_traits<common_iterator<I, S>>; // freestandingtemplate<[input_iterator](iterator.concept.input#concept:input_iterator "24.3.4.9 Concept input_­iterator [iterator.concept.input]") I, class S>struct iterator_traits<common_iterator<I, S>>; // freestanding// [[default.sentinel]](default.sentinel "24.5.6 Default sentinel"), default sentinelstruct default_sentinel_t; // freestandinginline constexpr default_sentinel_t [default_sentinel](#lib:default_sentinel "24.2 Header <iterator>&nbsp;synopsis [iterator.synopsis]"){}; // freestanding// [[iterators.counted]](iterators.counted "24.5.7 Counted iterators"), counted iteratorstemplate<[input_or_output_iterator](iterator.concept.iterator#concept:input_or_output_iterator "24.3.4.6 Concept input_­or_­output_­iterator [iterator.concept.iterator]") I> class counted_iterator; // freestandingtemplate<[input_iterator](iterator.concept.input#concept:input_iterator "24.3.4.9 Concept input_­iterator [iterator.concept.input]") I>requires *see below*struct iterator_traits<counted_iterator<I>>; // freestanding// [[unreachable.sentinel]](unreachable.sentinel "24.5.8 Unreachable sentinel"), unreachable sentinelstruct unreachable_sentinel_t; // freestandinginline constexpr unreachable_sentinel_t [unreachable_sentinel](#lib:unreachable_sentinel "24.2 Header <iterator>&nbsp;synopsis [iterator.synopsis]"){}; // freestanding// [[stream.iterators]](stream.iterators "24.6 Stream iterators"), stream iteratorstemplate<class T, class charT = char, class traits = char_traits<charT>, class Distance = ptrdiff_t>class istream_iterator; template<class T, class charT, class traits, class Distance>bool operator==(const istream_iterator<T,charT,traits,Distance>& x, const istream_iterator<T,charT,traits,Distance>& y); template<class T, class charT = char, class traits = char_traits<charT>>class ostream_iterator; template<class charT, class traits = char_traits<charT>>class istreambuf_iterator; template<class charT, class traits>bool operator==(const istreambuf_iterator<charT,traits>& a, const istreambuf_iterator<charT,traits>& b); template<class charT, class traits = char_traits<charT>>class ostreambuf_iterator; // [[iterator.range]](iterator.range "24.7 Range access"), range accesstemplate<class C> constexpr auto begin(C& c) -> decltype(c.begin()); // freestandingtemplate<class C> constexpr auto begin(const C& c) -> decltype(c.begin()); // freestandingtemplate<class C> constexpr auto end(C& c) -> decltype(c.end()); // freestandingtemplate<class C> constexpr auto end(const C& c) -> decltype(c.end()); // freestandingtemplate<class T, size_t N> constexpr T* begin(T (&array)[N]) noexcept; // freestandingtemplate<class T, size_t N> constexpr T* end(T (&array)[N]) noexcept; // freestandingtemplate<class C> constexpr auto cbegin(const C& c) // freestandingnoexcept(noexcept(std::begin(c))) -> decltype(std::begin(c)); template<class C> constexpr auto cend(const C& c) // freestandingnoexcept(noexcept(std::end(c))) -> decltype(std::end(c)); template<class C> constexpr auto rbegin(C& c) -> decltype(c.rbegin()); // freestandingtemplate<class C> constexpr auto rbegin(const C& c) -> decltype(c.rbegin()); // freestandingtemplate<class C> constexpr auto rend(C& c) -> decltype(c.rend()); // freestandingtemplate<class C> constexpr auto rend(const C& c) -> decltype(c.rend()); // freestandingtemplate<class T, size_t N> constexpr reverse_iterator<T*> rbegin(T (&array)[N]) // freestandingtemplate<class T, size_t N> constexpr reverse_iterator<T*> rend(T (&array)[N]); // freestandingtemplate<class E> constexpr reverse_iterator<const E*> rbegin(initializer_list<E> il); // freestandingtemplate<class E> constexpr reverse_iterator<const E*> rend(initializer_list<E> il); // freestandingtemplate<class C> constexpr auto crbegin(const C& c) -> decltype(std::rbegin(c)); // freestandingtemplate<class C> constexpr auto crend(const C& c) -> decltype(std::rend(c)); // freestandingtemplate<class C> constexpr auto size(const C& c) -> decltype(c.size()); // freestandingtemplate<class T, size_t N> constexpr size_t
 size(const T (&array)[N]) noexcept; // freestandingtemplate<class C> constexpr auto ssize(const C& c)-> common_type_t<ptrdiff_t, make_signed_t<decltype(c.size())>>; // freestandingtemplate<class T, ptrdiff_t N> constexpr ptrdiff_t
 ssize(const T (&array)[N]) noexcept; // freestandingtemplate<class C> constexpr auto empty(const C& c) -> decltype(c.empty()); // freestandingtemplate<class T, size_t N> constexpr bool empty(const T (&array)[N]) noexcept; // freestandingtemplate<class E> constexpr bool empty(initializer_list<E> il) noexcept; // freestandingtemplate<class C> constexpr auto data(C& c) -> decltype(c.data()); // freestandingtemplate<class C> constexpr auto data(const C& c) -> decltype(c.data()); // freestandingtemplate<class T, size_t N> constexpr T* data(T (&array)[N]) noexcept; // freestandingtemplate<class E> constexpr const E* data(initializer_list<E> il) noexcept; // freestanding}
