std::ranges...w::iterator(3)
πΈ NAME πΈ
std::ranges::elements_view::iterator β okay bestie, the original literally says the name twice, so here it is: std::ranges::elements_view::iterator. This page is from the C++ Standard Libary manual (yes, thatβs the manual name, typo and all π«Ά), and itβs all about the /*iterator*/ type that elements_view hands out.
β¨ Synopsis β¨
template< bool Const > (exposition only*)
class /*iterator*/;
Itβs the return type of elements_view::begin, and of elements_view::end when the underlying view is a common_range.
The type /*iterator*/<true> is returned by the const-qualified overloads. The type /*iterator*/<false> is returned by the non-const-qualified overloads.
π Member types π
Base(private) βconst VifConstistrue, otherwiseV.(exposition-only member type*)iterator_conceptβ denotes:std::random_access_iterator_tag, ifBasemodelsrandom_access_range. Otherwise,std::bidirectional_iterator_tag, ifBasemodelsbidirectional_range. Otherwise,std::forward_iterator_tag, ifBasemodelsforward_range. Otherwise,std::input_iterator_tag.
iterator_categoryβ not defined, ifBasedoes not modelforward_range. Otherwise,std::input_iterator_tag, ifstd::get<N>(*current_)is an rvalue. Otherwise, letCbe the typestd::iterator_traits<std::iterator_t<Base>>::iterator_category.std::random_access_iterator_tag, ifCmodelsstd::derived_from<std::random_access_iterator_tag>. Otherwise,C.
value_typeβstd::remove_cvref_t<std::tuple_element_t<N, ranges::range_value_t<Base>>>difference_typeβranges::range_difference_t<Base>
π Data members π
current_(private) β an iterator of typeranges::iterator_t<Base>to current element of underlying sequence.(exposition-only member object*)
π Member functions π
constructor(C++20) β constructs an iterator (public member function)base(C++20) β returns the underlying iterator (public member function)operator*(C++20) β accesses theN^thtuple element (public member function)operator[](C++20) β accesses an element by index (public member function)operator++,operator++(int),operator--,operator--(int),operator+=,operator-=(C++20) β advances or decrements the underlying iterator (public member function)
π Non-member functions π
operator==,operator<,operator>,operator<=,operator>=,operator<=>(C++20) β compares the underlying iterators (function)operator+,operator-(C++20) β performs iterator arithmetic (function)
π Defect reports π
The following behavior-changing defect reports were applied retroactively to previously published C++ standards.
- P2259R1, applied to C++20 β behavior as published: "
member iterator_categoryis always defined"; correct behavior: "defined only ifBasemodelsforward_range". - LWG 3555, applied to C++20 β behavior as published: "the definition of
iterator_conceptignoresconst"; correct behavior: "made to consider".
π¦ See also π¦
iterator(C++20) β the return type ofranges::transform_view::begin, and ofranges::transform_view::endwhen the underlying view is acommon_range(private member class template).
π source/version/date: http://cppreference.com Β· 2024.06.10 Β· footer page tag: std::ranges...w::iterator(3) β byeee bestie, go slay some iterators π
β¨
π¦ where this page comes from
- nixpkgs unstable: stdman 2024.07.05
- opensuse-leap 16.0: stdman 2024.07.05-bp160.1.9 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms