[iterator.synopsis] (original) (raw)

23 Iterators library [iterators]

#include
#include

namespace std { template using with-reference = T&;
template concept can-reference
= requires { typename with-reference; }; template concept dereferenceable
= requires(T& t) { { *t } -> can-reference;
};

template struct incrementable_traits; template using iter_difference_t = see below;

template struct indirectly_readable_traits; template using iter_value_t = see below;

template struct iterator_traits; template requires is_object_v struct iterator_traits<T*>;

template using iter_reference_t = decltype(*declval<T&>());

namespace ranges {

inline namespace unspecified {
  
  inline constexpr unspecified iter_move = unspecified;

  
  inline constexpr unspecified iter_swap = unspecified;
}

}

template requires requires(T& t) { { ranges::iter_move(t) } -> can-reference; } using iter_rvalue_reference_t = decltype(ranges::iter_move(declval<T&>()));

template concept indirectly_readable = see below;

template using iter_common_reference_t = common_reference_t<iter_reference_t, iter_value_t&>;

template<class Out, class T> concept indirectly_writable = see below;

template concept weakly_incrementable = see below;

template concept incrementable = see below;

template concept input_or_output_iterator = see below;

template<class S, class I> concept sentinel_for = see below;

template<class S, class I> inline constexpr bool disable_sized_sentinel_for = false;

template<class S, class I> concept sized_sentinel_for = see below;

template concept input_iterator = see below;

template<class I, class T> concept output_iterator = see below;

template concept forward_iterator = see below;

template concept bidirectional_iterator = see below;

template concept random_access_iterator = see below;

template concept contiguous_iterator = see below;

template<class F, class I> concept indirectly_unary_invocable = see below;

template<class F, class I> concept indirectly_regular_unary_invocable = see below;

template<class F, class I> concept indirect_unary_predicate = see below;

template<class F, class I1, class I2> concept indirect_binary_predicate = see below;

template<class F, class I1, class I2 = I1> concept indirect_equivalence_relation = see below;

template<class F, class I1, class I2 = I1> concept indirect_strict_weak_order = see below;

template<class F, class... Is> requires (indirectly_readable && ...) && invocable<F, iter_reference_t...> using indirect_result_t = invoke_result_t<F, iter_reference_t...>;

template<indirectly_readable I, indirectly_regular_unary_invocable Proj> struct projected;

template<weakly_incrementable I, class Proj> struct incrementable_traits<projected<I, Proj>>;

template<class In, class Out> concept indirectly_movable = see below;

template<class In, class Out> concept indirectly_movable_storable = see below;

template<class In, class Out> concept indirectly_copyable = see below;

template<class In, class Out> concept indirectly_copyable_storable = see below;

template<class I1, class I2 = I1> concept indirectly_swappable = see below;

template<class I1, class I2, class R, class P1 = identity, class P2 = identity> concept indirectly_comparable = see below;

template concept permutable = see below;

template<class I1, class I2, class Out, class R = ranges::less, class P1 = identity, class P2 = identity> concept mergeable = see below;

template<class I, class R = ranges::less, class P = identity> concept sortable = see below;

struct input_iterator_tag { }; struct output_iterator_tag { }; struct forward_iterator_tag: public input_iterator_tag { }; struct bidirectional_iterator_tag: public forward_iterator_tag { }; struct random_access_iterator_tag: public bidirectional_iterator_tag { }; struct contiguous_iterator_tag: public random_access_iterator_tag { };

template<class InputIterator, class Distance> constexpr void advance(InputIterator& i, Distance n); template constexpr typename iterator_traits::difference_type distance(InputIterator first, InputIterator last); template constexpr InputIterator next(InputIterator x, typename iterator_traits::difference_type n = 1); template constexpr BidirectionalIterator prev(BidirectionalIterator x, typename iterator_traits::difference_type n = 1);

namespace ranges {

template<input_or_output_iterator I>
  constexpr void advance(I& i, iter_difference_t<I> n);
template<input_or_output_iterator I, sentinel_for<I> S>
  constexpr void advance(I& i, S bound);
template<input_or_output_iterator I, sentinel_for<I> S>
  constexpr iter_difference_t<I> advance(I& i, iter_difference_t<I> n, S bound);


template<input_or_output_iterator I, sentinel_for<I> S>
  constexpr iter_difference_t<I> distance(I first, S last);
template<range R>
  constexpr range_difference_t<R> distance(R&& r);


template<input_or_output_iterator I>
  constexpr I next(I x);
template<input_or_output_iterator I>
  constexpr I next(I x, iter_difference_t<I> n);
template<input_or_output_iterator I, sentinel_for<I> S>
  constexpr I next(I x, S bound);
template<input_or_output_iterator I, sentinel_for<I> S>
  constexpr I next(I x, iter_difference_t<I> n, S bound);


template<bidirectional_iterator I>
  constexpr I prev(I x);
template<bidirectional_iterator I>
  constexpr I prev(I x, iter_difference_t<I> n);
template<bidirectional_iterator I>
  constexpr I prev(I x, iter_difference_t<I> n, I bound);

}

template class reverse_iterator;

template<class Iterator1, class Iterator2> constexpr bool operator==( const reverse_iterator& x, const reverse_iterator& y); template<class Iterator1, class Iterator2> constexpr bool operator!=( const reverse_iterator& x, const reverse_iterator& y); template<class Iterator1, class Iterator2> constexpr bool operator<( const reverse_iterator& x, const reverse_iterator& y); template<class Iterator1, class Iterator2> constexpr bool operator>( const reverse_iterator& x, const reverse_iterator& y); template<class Iterator1, class Iterator2> constexpr bool operator<=( const reverse_iterator& x, const reverse_iterator& y); template<class Iterator1, class Iterator2> constexpr bool operator>=( const reverse_iterator& x, const reverse_iterator& y); template<class Iterator1, three_way_comparable_with Iterator2> constexpr compare_three_way_result_t<Iterator1, Iterator2> operator<=>(const reverse_iterator& x, const reverse_iterator& y);

template<class Iterator1, class Iterator2> constexpr auto operator-( const reverse_iterator& x, const reverse_iterator& y) -> decltype(y.base() - x.base()); template constexpr reverse_iterator operator+( typename reverse_iterator::difference_type n, const reverse_iterator& x);

template constexpr reverse_iterator make_reverse_iterator(Iterator i);

template<class Iterator1, class Iterator2> requires (!sized_sentinel_for<Iterator1, Iterator2>) inline constexpr bool disable_sized_sentinel_for<reverse_iterator, reverse_iterator> = true;

template class back_insert_iterator; template constexpr back_insert_iterator back_inserter(Container& x);

template class front_insert_iterator; template constexpr front_insert_iterator front_inserter(Container& x);

template class insert_iterator; template constexpr insert_iterator inserter(Container& x, ranges::iterator_t i);

template class move_iterator;

template<class Iterator1, class Iterator2> constexpr bool operator==( const move_iterator& x, const move_iterator& y); template<class Iterator1, class Iterator2> constexpr bool operator<( const move_iterator& x, const move_iterator& y); template<class Iterator1, class Iterator2> constexpr bool operator>( const move_iterator& x, const move_iterator& y); template<class Iterator1, class Iterator2> constexpr bool operator<=( const move_iterator& x, const move_iterator& y); template<class Iterator1, class Iterator2> constexpr bool operator>=( const move_iterator& x, const move_iterator& y); template<class Iterator1, three_way_comparable_with Iterator2> constexpr compare_three_way_result_t<Iterator1, Iterator2> operator<=>(const move_iterator& x, const move_iterator& y);

template<class Iterator1, class Iterator2> constexpr auto operator-( const move_iterator& x, const move_iterator& y) -> decltype(x.base() - y.base()); template constexpr move_iterator operator+( typename move_iterator::difference_type n, const move_iterator& x);

template constexpr move_iterator make_move_iterator(Iterator i);

template class move_sentinel;

template<input_or_output_iterator I, sentinel_for S> requires (!same_as<I, S> && copyable) class common_iterator;

template<class I, class S> struct incrementable_traits<common_iterator<I, S>>;

template<input_iterator I, class S> struct iterator_traits<common_iterator<I, S>>;

struct default_sentinel_t; inline constexpr default_sentinel_t default_sentinel{};

template class counted_iterator;

template struct incrementable_traits<counted_iterator>;

template struct iterator_traits<counted_iterator>;

struct unreachable_sentinel_t; inline constexpr unreachable_sentinel_t unreachable_sentinel{};

template<class T, class charT = char, class traits = char_traits, 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> class ostream_iterator;

template<class charT, class traits = char_traits> 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> class ostreambuf_iterator;

template constexpr auto begin(C& c) -> decltype(c.begin()); template constexpr auto begin(const C& c) -> decltype(c.begin()); template constexpr auto end(C& c) -> decltype(c.end()); template constexpr auto end(const C& c) -> decltype(c.end()); template<class T, size_t N> constexpr T* begin(T (&array)[N]) noexcept; template<class T, size_t N> constexpr T* end(T (&array)[N]) noexcept; template constexpr auto cbegin(const C& c) noexcept(noexcept(std::begin(c))) -> decltype(std::begin(c)); template constexpr auto cend(const C& c) noexcept(noexcept(std::end(c))) -> decltype(std::end(c)); template constexpr auto rbegin(C& c) -> decltype(c.rbegin()); template constexpr auto rbegin(const C& c) -> decltype(c.rbegin()); template constexpr auto rend(C& c) -> decltype(c.rend()); template constexpr auto rend(const C& c) -> decltype(c.rend()); template<class T, size_t N> constexpr reverse_iterator<T*> rbegin(T (&array)[N]); template<class T, size_t N> constexpr reverse_iterator<T*> rend(T (&array)[N]); template constexpr reverse_iterator<const E*> rbegin(initializer_list il); template constexpr reverse_iterator<const E*> rend(initializer_list il); template constexpr auto crbegin(const C& c) -> decltype(std::rbegin(c)); template constexpr auto crend(const C& c) -> decltype(std::rend(c));

template constexpr auto size(const C& c) -> decltype(c.size()); template<class T, size_t N> constexpr size_t size(const T (&array)[N]) noexcept; template constexpr auto ssize(const C& c) -> common_type_t<ptrdiff_t, make_signed_t<decltype(c.size())>>; template<class T, ptrdiff_t N> constexpr ptrdiff_t ssize(const T (&array)[N]) noexcept; template [[nodiscard]] constexpr auto empty(const C& c) -> decltype(c.empty()); template<class T, size_t N> [[nodiscard]] constexpr bool empty(const T (&array)[N]) noexcept; template [[nodiscard]] constexpr bool empty(initializer_list il) noexcept; template constexpr auto data(C& c) -> decltype(c.data()); template constexpr auto data(const C& c) -> decltype(c.data()); template<class T, size_t N> constexpr T* data(T (&array)[N]) noexcept; template constexpr const E* data(initializer_list il) noexcept; }