Subclause | Header | ||
Range access | <ranges> | ||
Requirements | |||
Range utilities | |||
Range factories | |||
Range adaptors | |||
Range generators |
template<class T>
concept borrowed_range =
range<T> && (is_lvalue_reference_v<T> || enable_borrowed_range<remove_cvref_t<T>>);
template<class>
constexpr bool enable_borrowed_range = false;
template<class T>
concept sized_range =
range<T> && requires(T& t) { ranges::size(t); };
template<class>
constexpr bool disable_sized_range = false;
template<class T>
constexpr bool is-derived-from-view-interface = see below; // exposition only
template<class T>
constexpr bool enable_view =
derived_from<T, view_base> || is-derived-from-view-interface<T>;
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 R>
constexpr bool is-initializer-list = see below; // exposition only
template<class T>
concept viewable_range =
range<T> &&
((view<remove_cvref_t<T>> && constructible_from<remove_cvref_t<T>, T>) ||
(!view<remove_cvref_t<T>> &&
(is_lvalue_reference_v<T> || (movable<remove_reference_t<T>> && !is-initializer-list<T>))));
template<class T>
concept constant_range =
input_range<T> && constant-iterator<iterator_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<different-from<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<different-from<subrange> PairLike>
requires pair-like-convertible-from<PairLike, const I&, const S&>
constexpr operator PairLike() const;
constexpr S end() const;
constexpr bool empty() const;
constexpr make-unsigned-like-t<iter_difference_t<I>> size() const
requires (K == subrange_kind::sized);
constexpr subrange next(iter_difference_t<I> n = 1) const &
requires forward_iterator<I>;
constexpr subrange next(iter_difference_t<I> n = 1) &&;
constexpr subrange prev(iter_difference_t<I> n = 1) const
requires bidirectional_iterator<I>;
constexpr subrange& advance(iter_difference_t<I> n);
template<class C, input_range R, class... Args> requires (!view<C>)
constexpr C to(R&& r, Args&&... args);
template<template<class...> class C, input_range R, class... Args>
constexpr auto to(R&& r, Args&&... args);
constexpr explicit single_view(const T& t) requires copy_constructible<T>;
constexpr explicit single_view(T&& t);
template<class... Args>
requires constructible_from<T, Args...>
constexpr explicit 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 bool empty() noexcept;
static constexpr size_t size() noexcept;
constexpr T* data() noexcept;
constexpr const T* data() const noexcept;
template<class I>
concept decrementable = // exposition only
incrementable<I> && requires(I i) {
{ --i } -> same_as<I&>;
{ i-- } -> same_as<I>;
};
template<class I>
concept advanceable = // exposition only
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 explicit iota_view(type_identity_t<W> value, type_identity_t<Bound> bound);
constexpr explicit iota_view(iterator first, see below last);
constexpr iterator begin() const;
constexpr auto end() const;
constexpr bool empty() 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 repeat_view(const T& value, Bound bound = Bound())
requires copy_constructible<T>;
constexpr explicit repeat_view(T&& value, Bound bound = Bound());
template<class... TArgs, class... BoundArgs>
requires constructible_from<T, TArgs...> &&
constructible_from<Bound, BoundArgs...>
constexpr explicit repeat_view(piecewise_construct_t,
tuple<TArgs...> value_args, tuple<BoundArgs...> bound_args = tuple<>{});
constexpr iterator begin() const;
constexpr unreachable_sentinel_t end() const noexcept;
constexpr explicit iterator(const T* value, index-type b = index-type());
constexpr const T& operator*() const noexcept;
constexpr iterator& operator++();
constexpr iterator operator++(int);
constexpr iterator& operator--();
constexpr iterator operator--(int);
constexpr iterator& operator+=(difference_type n);
constexpr iterator& operator-=(difference_type n);
constexpr const T& operator[](difference_type n) const noexcept;
friend constexpr bool operator==(const iterator& x, const iterator& y);
friend constexpr auto operator<=>(const iterator& x, const iterator& y);
friend constexpr iterator operator+(iterator i, difference_type n);
friend constexpr iterator operator+(difference_type n, iterator i);
friend constexpr iterator operator-(iterator i, difference_type n);
friend constexpr difference_type operator-(const iterator& x, const iterator& y);
constexpr explicit basic_istream_view(basic_istream<CharT, Traits>& stream);
constexpr default_sentinel_t end() const noexcept;
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<class I>
constexpr T& emplace-deref(const I& i); // exposition only
template<different-from<ref_view> T>
requires see below
constexpr ref_view(T&& t);
constexpr owning_view(R&& t);
constexpr explicit as_rvalue_view(V base);
constexpr explicit filter_view(V base, Pred pred);
constexpr const Pred& pred() const;
constexpr iterator begin();
constexpr iterator(filter_view& parent, iterator_t<V> current);
constexpr const iterator_t<V>& base() const & noexcept;
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 explicit 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 const iterator_t<Base>& base() const & noexcept;
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 sized_sentinel_for<iterator_t<Base>, 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;
template<bool OtherConst>
requires sentinel_for<sentinel_t<Base>, iterator_t<maybe-const<OtherConst, V>>>
friend constexpr bool operator==(const iterator<OtherConst>& x, const sentinel& y);
template<bool OtherConst>
requires sized_sentinel_for<sentinel_t<Base>, iterator_t<maybe-const<OtherConst, V>>>
friend constexpr range_difference_t<maybe-const<OtherConst, V>>
operator-(const iterator<OtherConst>& x, const sentinel& y);
template<bool OtherConst>
requires sized_sentinel_for<sentinel_t<Base>, iterator_t<maybe-const<OtherConst, V>>>
friend constexpr range_difference_t<maybe-const<OtherConst, V>>
operator-(const sentinel& y, const iterator<OtherConst>& x);