25 Iterators library [iterators]

25.5 Iterator adaptors [predef.iterators]

25.5.3 Constant iterators and sentinels [const.iterators]

25.5.3.3 Class template basic_­const_­iterator [const.iterators.iterator]

namespace std { template<class I> concept not-a-const-iterator = see below; template<input_­iterator Iterator> class basic_const_iterator { Iterator current_ = Iterator(); // exposition only using reference = iter_const_reference_t<Iterator>; // exposition only public: using iterator_concept = see below; using iterator_category = see below; // not always present using value_type = iter_value_t<Iterator>; using difference_type = iter_difference_t<Iterator>; basic_const_iterator() requires default_­initializable<Iterator> = default; constexpr basic_const_iterator(Iterator current); template<convertible_­to<Iterator> U> constexpr basic_const_iterator(basic_const_iterator<U> current); template<different-from<basic_const_iterator> T> requires convertible_­to<T, Iterator> constexpr basic_const_iterator(T&& current); constexpr const Iterator& base() const & noexcept; constexpr Iterator base() &&; constexpr reference operator*() const; constexpr const value_type* operator->() const requires is_lvalue_reference_v<iter_reference_t<Iterator>> && same_­as<remove_cvref_t<iter_reference_t<Iterator>>, value_type>; constexpr basic_const_iterator& operator++(); constexpr void operator++(int); constexpr basic_const_iterator operator++(int) requires forward_­iterator<Iterator>; constexpr basic_const_iterator& operator--() requires bidirectional_­iterator<Iterator>; constexpr basic_const_iterator operator--(int) requires bidirectional_­iterator<Iterator>; constexpr basic_const_iterator& operator+=(difference_type n) requires random_­access_­iterator<Iterator>; constexpr basic_const_iterator& operator-=(difference_type n) requires random_­access_­iterator<Iterator>; constexpr reference operator[](difference_type n) const requires random_­access_­iterator<Iterator>; template<sentinel_­for<Iterator> S> friend constexpr bool operator==(const basic_const_iterator& x, const S& s); friend constexpr bool operator<(const basic_const_iterator& x, const basic_const_iterator& y) requires random_­access_­iterator<Iterator>; friend constexpr bool operator>(const basic_const_iterator& x, const basic_const_iterator& y) requires random_­access_­iterator<Iterator>; friend constexpr bool operator<=(const basic_const_iterator& x, const basic_const_iterator& y) requires random_­access_­iterator<Iterator>; friend constexpr bool operator>=(const basic_const_iterator& x, const basic_const_iterator& y) requires random_­access_­iterator<Iterator>; friend constexpr auto operator<=>(const basic_const_iterator& x, const basic_const_iterator& y) requires random_­access_­iterator<Iterator> && three_­way_­comparable<Iterator>; template<different-from<basic_const_iterator> I> friend constexpr bool operator<(const basic_const_iterator& x, const I& y) requires random_­access_­iterator<Iterator> && totally_­ordered_­with<Iterator, I>; template<different-from<basic_const_iterator> I> friend constexpr bool operator>(const basic_const_iterator& x, const I& y) requires random_­access_­iterator<Iterator> && totally_­ordered_­with<Iterator, I>; template<different-from<basic_const_iterator> I> friend constexpr bool operator<=(const basic_const_iterator& x, const I& y) requires random_­access_­iterator<Iterator> && totally_­ordered_­with<Iterator, I>; template<different-from<basic_const_iterator> I> friend constexpr bool operator>=(const basic_const_iterator& x, const I& y) requires random_­access_­iterator<Iterator> && totally_­ordered_­with<Iterator, I>; template<not-a-const-iterator I> friend constexpr bool operator<(const I& x, const basic_const_iterator& y) requires random_­access_­iterator<Iterator> && totally_­ordered_­with<Iterator, I>; template<not-a-const-iterator I> friend constexpr bool operator>(const I& x, const basic_const_iterator& y) requires random_­access_­iterator<Iterator> && totally_­ordered_­with<Iterator, I>; template<not-a-const-iterator I> friend constexpr bool operator<=(const I& x, const basic_const_iterator& y) requires random_­access_­iterator<Iterator> && totally_­ordered_­with<Iterator, I>; template<not-a-const-iterator I> friend constexpr bool operator>=(const I& x, const basic_const_iterator& y) requires random_­access_­iterator<Iterator> && totally_­ordered_­with<Iterator, I>; template<different-from<basic_const_iterator> I> friend constexpr auto operator<=>(const basic_const_iterator& x, const I& y) requires random_­access_­iterator<Iterator> && totally_­ordered_­with<Iterator, I> && three_­way_­comparable_­with<Iterator, I>; friend constexpr basic_const_iterator operator+(const basic_const_iterator& i, difference_type n) requires random_­access_­iterator<Iterator>; friend constexpr basic_const_iterator operator+(difference_type n, const basic_const_iterator& i) requires random_­access_­iterator<Iterator>; friend constexpr basic_const_iterator operator-(const basic_const_iterator& i, difference_type n) requires random_­access_­iterator<Iterator>; template<sized_­sentinel_­for<Iterator> S> friend constexpr difference_type operator-(const basic_const_iterator& x, const S& y); template<sized_­sentinel_­for<Iterator> S> requires different-from<S, basic_const_iterator> friend constexpr difference_type operator-(const S& x, const basic_const_iterator& y); }; }
Given some type I, the concept not-a-const-iterator is defined as false if I is a specialization of basic_­const_­iterator and true otherwise.