Skip to content

P2017R1 Conditionally borrowed ranges #4516

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 9, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions source/ranges.tex
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,9 @@
// \ref{range.take}, take view
template<@\libconcept{view}@> class take_view;

template<class T>
inline constexpr bool enable_borrowed_range<take_view<T>> = enable_borrowed_range<T>;

namespace views { inline constexpr @\unspec@ take = @\unspec@; }

// \ref{range.take.while}, take while view
Expand All @@ -228,6 +231,9 @@
template<@\libconcept{view}@ V>
class drop_view;

template<class T>
inline constexpr bool enable_borrowed_range<drop_view<T>> = enable_borrowed_range<T>;

namespace views { inline constexpr @\unspec@ drop = @\unspec@; }

// \ref{range.drop.while}, drop while view
Expand All @@ -236,6 +242,10 @@
@\libconcept{indirect_unary_predicate}@<const Pred, iterator_t<V>>
class drop_while_view;

template<class T, class Pred>
inline constexpr bool enable_borrowed_range<drop_while_view<T, Pred>> =
enable_borrowed_range<T>;

namespace views { inline constexpr @\unspec@ drop_while = @\unspec@; }

// \ref{range.join}, join view
Expand Down Expand Up @@ -267,20 +277,29 @@
requires (!@\libconcept{common_range}@<V> && copyable<iterator_t<V>>)
class common_view;

template<class T>
inline constexpr bool enable_borrowed_range<common_view<T>> = enable_borrowed_range<T>;

namespace views { inline constexpr @\unspec@ common = @\unspec@; }

// \ref{range.reverse}, reverse view
template<@\libconcept{view}@ V>
requires @\libconcept{bidirectional_range}@<V>
class reverse_view;

template<class T>
inline constexpr bool enable_borrowed_range<reverse_view<T>> = enable_borrowed_range<T>;

namespace views { inline constexpr @\unspec@ reverse = @\unspec@; }

// \ref{range.elements}, elements view
template<@\libconcept{input_range}@ V, size_t N>
requires @\seebelow@
class elements_view;

template<class T, size_t N>
inline constexpr bool enable_borrowed_range<elements_view<T, N>> = enable_borrowed_range<T>;

template<class R>
using keys_view = elements_view<views::all_t<R>, 0>;
template<class R>
Expand Down