Subclause | Header | ||
Range access | <ranges> | ||
Requirements | |||
Range utilities | |||
Range factories | |||
Range adaptors |
template<class T>
concept borrowed_range =
range<T> &&
(is_lvalue_reference_v<T> || enable_borrowed_range<remove_cvref_t<T>>);
template<class>
inline constexpr bool enable_borrowed_range = false;
template<class T>
concept sized_range =
range<T> &&
requires(T& t) { ranges::size(t); };
template<class>
inline constexpr bool disable_sized_range = false;
template<class T>
concept view =
range<T> && movable<T> && default_initializable<T> && enable_view<T>;
template<class T>
inline constexpr bool enable_view = derived_from<T, view_base>;
template<class R, class T>
concept output_range =
range<R> && output_iterator<iterator_t<R>, T>;
template<class T>
concept input_range =
range<T> && input_iterator<iterator_t<T>>;
template<class T>
concept forward_range =
input_range<T> && forward_iterator<iterator_t<T>>;
template<class T>
concept bidirectional_range =
forward_range<T> && bidirectional_iterator<iterator_t<T>>;
template<class T>
concept random_access_range =
bidirectional_range<T> && random_access_iterator<iterator_t<T>>;
template<class T>
concept contiguous_range =
random_access_range<T> && contiguous_iterator<iterator_t<T>> &&
requires(T& t) {
{ ranges::data(t) } -> same_as<add_pointer_t<range_reference_t<T>>>;
};
template<class T>
concept common_range =
range<T> && same_as<iterator_t<T>, sentinel_t<T>>;
template<class T>
concept viewable_range =
range<T> && (borrowed_range<T> || view<remove_cvref_t<T>>);
constexpr decltype(auto) front() requires forward_range<D>;
constexpr decltype(auto) front() const requires forward_range<const D>;
constexpr decltype(auto) back() requires bidirectional_range<D> && common_range<D>;
constexpr decltype(auto) back() const
requires bidirectional_range<const D> && common_range<const D>;
constexpr subrange(convertible-to-non-slicing<I> auto i, S s) requires (!StoreSize);
constexpr subrange(convertible-to-non-slicing<I> auto i, S s,
make-unsigned-like-t<iter_difference_t<I>> n)
requires (K == subrange_kind::sized);
template<not-same-as<subrange> R>
requires borrowed_range<R> &&
convertible-to-non-slicing<iterator_t<R>, I> &&
convertible_to<sentinel_t<R>, S>
constexpr subrange(R&& r) requires (!StoreSize || sized_range<R>);
template<not-same-as<subrange> PairLike>
requires pair-like-convertible-from<PairLike, const I&, const S&>
constexpr operator PairLike() const;
constexpr I begin() const requires copyable<I>;
[[nodiscard]] constexpr I begin() requires (!copyable<I>);
constexpr S end() const;
constexpr bool empty() const;
constexpr make-unsigned-like-t<iter_difference_t<I>> size() const
requires (K == subrange_kind::sized);
[[nodiscard]] constexpr subrange next(iter_difference_t<I> n = 1) const &
requires forward_iterator<I>;
[[nodiscard]] constexpr subrange next(iter_difference_t<I> n = 1) &&;
[[nodiscard]] constexpr subrange prev(iter_difference_t<I> n = 1) const
requires bidirectional_iterator<I>;
constexpr subrange& advance(iter_difference_t<I> n);
template<size_t N, class I, class S, subrange_kind K>
requires (N < 2)
constexpr auto get(const subrange<I, S, K>& r);
template<size_t N, class I, class S, subrange_kind K>
requires (N < 2)
constexpr auto get(subrange<I, S, K>&& r);
constexpr explicit single_view(const T& t);
constexpr explicit single_view(T&& t);
template<class... Args>
requires constructible_from<T, Args...>
constexpr single_view(in_place_t, Args&&... args);
constexpr T* begin() noexcept;
constexpr const T* begin() const noexcept;
constexpr T* end() noexcept;
constexpr const T* end() const noexcept;
static constexpr size_t size() noexcept;
constexpr T* data() noexcept;
constexpr const T* data() const noexcept;
template<class I>
concept decrementable =
incrementable<I> && requires(I i) {
{ --i } -> same_as<I&>;
{ i-- } -> same_as<I>;
};
template<class I>
concept advanceable =
decrementable<I> && totally_ordered<I> &&
requires(I i, const I j, const IOTA-DIFF-T(I) n) {
{ i += n } -> same_as<I&>;
{ i -= n } -> same_as<I&>;
I(j + n);
I(n + j);
I(j - n);
{ j - j } -> convertible_to<IOTA-DIFF-T(I)>;
};
constexpr explicit iota_view(W value);
constexpr iota_view(type_identity_t<W> value, type_identity_t<Bound> bound);
constexpr iterator begin() const;
constexpr auto end() const;
constexpr auto size() const requires see below;
constexpr explicit iterator(W value);
constexpr W operator*() const noexcept(is_nothrow_copy_constructible_v<W>);
constexpr iterator& operator++();
constexpr void operator++(int);
constexpr iterator operator++(int) requires incrementable<W>;
constexpr iterator& operator--() requires decrementable<W>;
constexpr iterator operator--(int) requires decrementable<W>;
constexpr iterator& operator+=(difference_type n)
requires advanceable<W>;
constexpr iterator& operator-=(difference_type n)
requires advanceable<W>;
constexpr W operator[](difference_type n) const
requires advanceable<W>;
friend constexpr bool operator==(const iterator& x, const iterator& y)
requires equality_comparable<W>;
friend constexpr bool operator<(const iterator& x, const iterator& y)
requires totally_ordered<W>;
friend constexpr bool operator>(const iterator& x, const iterator& y)
requires totally_ordered<W>;
friend constexpr bool operator<=(const iterator& x, const iterator& y)
requires totally_ordered<W>;
friend constexpr bool operator>=(const iterator& x, const iterator& y)
requires totally_ordered<W>;
friend constexpr auto operator<=>(const iterator& x, const iterator& y)
requires totally_ordered<W> && three_way_comparable<W>;
friend constexpr iterator operator+(iterator i, difference_type n)
requires advanceable<W>;
friend constexpr iterator operator+(difference_type n, iterator i)
requires advanceable<W>;
friend constexpr iterator operator-(iterator i, difference_type n)
requires advanceable<W>;
friend constexpr difference_type operator-(const iterator& x, const iterator& y)
requires advanceable<W>;
constexpr explicit sentinel(Bound bound);
friend constexpr bool operator==(const iterator& x, const sentinel& y);
friend constexpr iter_difference_t<W> operator-(const iterator& x, const sentinel& y)
requires sized_sentinel_for<Bound, W>;
friend constexpr iter_difference_t<W> operator-(const sentinel& x, const iterator& y)
requires sized_sentinel_for<Bound, W>;
constexpr explicit basic_istream_view(basic_istream<CharT, Traits>& stream);
constexpr default_sentinel_t end() const noexcept;
template<class Val, class CharT, class Traits>
basic_istream_view<Val, CharT, Traits> istream_view(basic_istream<CharT, Traits>& s);
constexpr explicit iterator(basic_istream_view& parent) noexcept;
iterator& operator++();
void operator++(int);
Val& operator*() const;
friend bool operator==(const iterator& x, default_sentinel_t);
template<not-same-as<ref_view> T>
requires see below
constexpr ref_view(T&& t);
constexpr filter_view(V base, Pred pred);
constexpr const Pred& pred() const;
constexpr iterator begin();
constexpr iterator(filter_view& parent, iterator_t<V> current);
constexpr iterator_t<V> base() const &
requires copyable<iterator_t<V>>;
constexpr iterator_t<V> base() &&;
constexpr range_reference_t<V> operator*() const;
constexpr iterator& operator++();
constexpr void operator++(int);
constexpr iterator operator++(int) requires forward_range<V>;
constexpr iterator& operator--() requires bidirectional_range<V>;
constexpr iterator operator--(int) requires bidirectional_range<V>;
friend constexpr bool operator==(const iterator& x, const iterator& y)
requires equality_comparable<iterator_t<V>>;
friend constexpr range_rvalue_reference_t<V> iter_move(const iterator& i)
noexcept(noexcept(ranges::iter_move(i.current_)));
friend constexpr void iter_swap(const iterator& x, const iterator& y)
noexcept(noexcept(ranges::iter_swap(x.current_, y.current_)))
requires indirectly_swappable<iterator_t<V>>;
constexpr explicit sentinel(filter_view& parent);
constexpr sentinel_t<V> base() const;
friend constexpr bool operator==(const iterator& x, const sentinel& y);
constexpr transform_view(V base, F fun);
constexpr iterator<false> begin();
constexpr iterator<true> begin() const
requires range<const V> &&
regular_invocable<const F&, range_reference_t<const V>>;
constexpr sentinel<false> end();
constexpr iterator<false> end() requires common_range<V>;
constexpr sentinel<true> end() const
requires range<const V> &&
regular_invocable<const F&, range_reference_t<const V>>;
constexpr iterator<true> end() const
requires common_range<const V> &&
regular_invocable<const F&, range_reference_t<const V>>;
constexpr iterator(Parent& parent, iterator_t<Base> current);
constexpr iterator(iterator<!Const> i)
requires Const && convertible_to<iterator_t<V>, iterator_t<Base>>;
constexpr iterator_t<Base> base() const &
requires copyable<iterator_t<Base>>;
constexpr iterator_t<Base> base() &&;
constexpr iterator& operator++();
constexpr void operator++(int);
constexpr iterator operator++(int) requires forward_range<Base>;
constexpr iterator& operator--() requires bidirectional_range<Base>;
constexpr iterator operator--(int) requires bidirectional_range<Base>;
constexpr iterator& operator+=(difference_type n)
requires random_access_range<Base>;
constexpr iterator& operator-=(difference_type n)
requires random_access_range<Base>;
friend constexpr bool operator==(const iterator& x, const iterator& y)
requires equality_comparable<iterator_t<Base>>;
friend constexpr bool operator<(const iterator& x, const iterator& y)
requires random_access_range<Base>;
friend constexpr bool operator>(const iterator& x, const iterator& y)
requires random_access_range<Base>;
friend constexpr bool operator<=(const iterator& x, const iterator& y)
requires random_access_range<Base>;
friend constexpr bool operator>=(const iterator& x, const iterator& y)
requires random_access_range<Base>;
friend constexpr auto operator<=>(const iterator& x, const iterator& y)
requires random_access_range<Base> && three_way_comparable<iterator_t<Base>>;
friend constexpr iterator operator+(iterator i, difference_type n)
requires random_access_range<Base>;
friend constexpr iterator operator+(difference_type n, iterator i)
requires random_access_range<Base>;
friend constexpr iterator operator-(iterator i, difference_type n)
requires random_access_range<Base>;
friend constexpr difference_type operator-(const iterator& x, const iterator& y)
requires random_access_range<Base>;
friend constexpr void iter_swap(const iterator& x, const iterator& y)
noexcept(noexcept(ranges::iter_swap(x.current_, y.current_)))
requires indirectly_swappable<iterator_t<Base>>;
constexpr explicit sentinel(sentinel_t<Base> end);
constexpr sentinel(sentinel<!Const> i)
requires Const && convertible_to<sentinel_t<V>, sentinel_t<Base>>;
constexpr sentinel_t<Base> base() const;
friend constexpr bool operator==(const iterator<Const>& x, const sentinel& y);
friend constexpr range_difference_t<Base>
operator-(const iterator<Const>& x, const sentinel& y)
requires sized_sentinel_for<sentinel_t<Base>, iterator_t<Base>>;
friend constexpr range_difference_t<Base>
operator-(const sentinel& y, const iterator<Const>& x)
requires sized_sentinel_for<sentinel_t<Base>, iterator_t<Base>>;
constexpr take_view(V base, range_difference_t<V> count);
constexpr explicit sentinel(sentinel_t<Base> end);
constexpr sentinel(sentinel<!Const> s)
requires Const && convertible_to<sentinel_t<V>, sentinel_t<Base>>;
constexpr sentinel_t<Base> base() const;
friend constexpr bool operator==(const CI& y, const sentinel& x);
constexpr take_while_view(V base, Pred pred);
constexpr const Pred& pred() const;
constexpr explicit sentinel(sentinel_t<Base> end, const Pred* pred);
constexpr sentinel(sentinel<!Const> s)
requires Const && convertible_to<sentinel_t<V>, sentinel_t<Base>>;
friend constexpr bool operator==(const iterator_t<Base>& x, const sentinel& y);
constexpr drop_view(V base, range_difference_t<V> count);
constexpr auto begin()
requires (!(simple-view<V> && random_access_range<V>));
constexpr auto begin() const
requires random_access_range<const V>;
constexpr drop_while_view(V base, Pred pred);
constexpr const Pred& pred() const;
constexpr auto begin();
constexpr explicit join_view(V base);
constexpr void satisfy(); // exposition only
constexpr iterator(Parent& parent, iterator_t<Base> outer);
constexpr iterator(iterator<!Const> i)
requires Const &&
convertible_to<iterator_t<V>, iterator_t<Base>> &&
convertible_to<iterator_t<InnerRng>,
iterator_t<range_reference_t<Base>>>;
constexpr iterator& operator++();
constexpr void operator++(int);
constexpr iterator operator++(int)
requires ref-is-glvalue && forward_range<Base> &&
forward_range<range_reference_t<Base>>;
constexpr iterator& operator--()
requires ref-is-glvalue && bidirectional_range<Base> &&
bidirectional_range<range_reference_t<Base>> &&
common_range<range_reference_t<Base>>;
constexpr iterator operator--(int)
requires ref-is-glvalue && bidirectional_range<Base> &&
bidirectional_range<range_reference_t<Base>> &&
common_range<range_reference_t<Base>>;
friend constexpr bool operator==(const iterator& x, const iterator& y)
requires ref-is-glvalue && equality_comparable<iterator_t<Base>> &&
equality_comparable<iterator_t<range_reference_t<Base>>>;
friend constexpr void iter_swap(const iterator& x, const iterator& y)
noexcept(noexcept(ranges::iter_swap(x.inner_, y.inner_)));
constexpr explicit sentinel(Parent& parent);
constexpr sentinel(sentinel<!Const> s)
requires Const && convertible_to<sentinel_t<V>, sentinel_t<Base>>;
friend constexpr bool operator==(const iterator<Const>& x, const sentinel& y);
constexpr split_view(V base, Pattern pattern);
template<input_range R>
requires constructible_from<V, views::all_t<R>> &&
constructible_from<Pattern, single_view<range_value_t<R>>>
constexpr split_view(R&& r, range_value_t<R> e);
constexpr explicit outer-iterator(Parent& parent)
requires (!forward_range<Base>);
constexpr outer-iterator(Parent& parent, iterator_t<Base> current)
requires forward_range<Base>;
constexpr outer-iterator(outer-iterator<!Const> i)
requires Const && convertible_to<iterator_t<V>, iterator_t<Base>>;
constexpr value_type operator*() const;
constexpr outer-iterator& operator++();
friend constexpr bool operator==(const outer-iterator& x, const outer-iterator& y)
requires forward_range<Base>;
friend constexpr bool operator==(const outer-iterator& x, default_sentinel_t);
constexpr explicit value_type(outer-iterator i);
constexpr inner-iterator<Const> begin() const requires copyable<outer-iterator>;
constexpr inner-iterator<Const> begin() requires (!copyable<outer-iterator>);
constexpr default_sentinel_t end() const;
constexpr explicit inner-iterator(outer-iterator<Const> i);
constexpr inner-iterator& operator++();
friend constexpr bool operator==(const inner-iterator& x, const inner-iterator& y)
requires forward_range<Base>;
friend constexpr bool operator==(const inner-iterator& x, default_sentinel_t);
friend constexpr void iter_swap(const inner-iterator& x, const inner-iterator& y)
noexcept(noexcept(ranges::iter_swap(x.i_.current, y.i_.current)))
requires indirectly_swappable<iterator_t<Base>>;
constexpr explicit common_view(V base);
template<viewable_range R>
requires (!common_range<R> && constructible_from<V, views::all_t<R>>)
constexpr explicit common_view(R&& r);
constexpr explicit reverse_view(V base);
constexpr reverse_iterator<iterator_t<V>> begin();
constexpr reverse_iterator<iterator_t<V>> begin() requires common_range<V>;
constexpr auto begin() const requires common_range<const V>;
constexpr reverse_iterator<iterator_t<V>> end();
constexpr auto end() const requires common_range<const V>;
constexpr explicit elements_view(V base);
constexpr explicit iterator(iterator_t<Base> current);
constexpr iterator(iterator<!Const> i)
requires Const && convertible_to<iterator_t<V>, iterator_t<Base>>;
constexpr iterator_t<Base> base() const&
requires copyable<iterator_t<Base>>;
constexpr iterator_t<Base> base() &&;
constexpr iterator& operator++();
constexpr void operator++(int) requires (!forward_range<Base>);
constexpr iterator operator++(int) requires forward_range<Base>;
constexpr iterator& operator--() requires bidirectional_range<Base>;
constexpr iterator operator--(int) requires bidirectional_range<Base>;
constexpr iterator& operator+=(difference_type n);
requires random_access_range<Base>;
constexpr iterator& operator-=(difference_type n)
requires random_access_range<Base>;
friend constexpr bool operator==(const iterator& x, const iterator& y)
requires equality_comparable<Base>;
friend constexpr bool operator<(const iterator& x, const iterator& y)
requires random_access_range<Base>;
friend constexpr bool operator>(const iterator& x, const iterator& y)
requires random_access_range<Base>;
friend constexpr bool operator<=(const iterator& x, const iterator& y)
requires random_access_range<Base>;
friend constexpr bool operator>=(const iterator& x, const iterator& y)
requires random_access_range<Base>;
friend constexpr auto operator<=>(const iterator& x, const iterator& y)
requires random_access_range<Base> && three_way_comparable<iterator_t<Base>>;
friend constexpr iterator operator+(const iterator& x, difference_type y)
requires random_access_range<Base>;
friend constexpr iterator operator+(difference_type x, const iterator& y)
requires random_access_range<Base>;
friend constexpr iterator operator-(const iterator& x, difference_type y)
requires random_access_range<Base>;
friend constexpr difference_type operator-(const iterator& x, const iterator& y)
requires random_access_range<Base>;
constexpr explicit sentinel(sentinel_t<Base> end);
constexpr sentinel(sentinel<!Const> other)
requires Const && convertible_to<sentinel_t<V>, sentinel_t<Base>>;
constexpr sentinel_t<Base> base() const;
friend constexpr bool operator==(const iterator<Const>& x, const sentinel& y);
friend constexpr range_difference_t<Base>
operator-(const iterator<Const>& x, const sentinel& y)
requires sized_sentinel_for<sentinel_t<Base>, iterator_t<Base>>;
friend constexpr range_difference_t<Base>
operator-(const sentinel& x, const iterator<Const>& y)
requires sized_sentinel_for<sentinel_t<Base>, iterator_t<Base>>;