Skip to content

P3060R3 Add std::views::indices(n) #8006

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
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
16 changes: 15 additions & 1 deletion source/ranges.tex
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,10 @@
template<class W, class Bound>
constexpr bool @\libspec{enable_borrowed_range}{iota_view}@<iota_view<W, Bound>> = true;

namespace views { inline constexpr @\unspecnc@ iota = @\unspecnc@; }
namespace views {
inline constexpr @\unspecnc@ iota = @\unspecnc@;
inline constexpr @\unspecnc@ indices = @\unspecnc@;
}

// \ref{range.repeat}, repeat view
template<@\libconcept{move_constructible}@ T, @\libconcept{semiregular}@ Bound = unreachable_sentinel_t>
Expand Down Expand Up @@ -2784,6 +2787,17 @@
\end{codeblock}
\end{example}

\pnum
\indexlibrarymember{indices}{views}%
The name \tcode{views::indices} denotes a
customization point object\iref{customization.point.object}.
Given subexpression \tcode{E},
let \tcode{T} be \tcode{remove_cvref_t<decltype((E))>}.
\tcode{views::indices(E)} is expression-equivalent to
\tcode{views::iota(T(0), E)}
if \tcode{\exposid{is-integer-like}<T>} is \tcode{true},
and ill-formed otherwise.
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we want this?

Suggested change
and ill-formed otherwise.
and is ill-formed otherwise.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's fine either way.


\rSec3[range.iota.view]{Class template \tcode{iota_view}}

\indexlibraryglobal{iota_view}%
Expand Down
1 change: 1 addition & 0 deletions source/support.tex
Original file line number Diff line number Diff line change
Expand Up @@ -775,6 +775,7 @@
#define @\defnlibxname{cpp_lib_ranges_find_last}@ 202207L // also in \libheader{algorithm}
#define @\defnlibxname{cpp_lib_ranges_fold}@ 202207L // also in \libheader{algorithm}
#define @\defnlibxname{cpp_lib_ranges_generate_random}@ 202403L // also in \libheader{random}
#define @\defnlibxname{cpp_lib_ranges_indices}@ 202506L // also in \libheader{ranges}
#define @\defnlibxname{cpp_lib_ranges_iota}@ 202202L // also in \libheader{numeric}
#define @\defnlibxname{cpp_lib_ranges_join_with}@ 202202L // freestanding, also in \libheader{ranges}
#define @\defnlibxname{cpp_lib_ranges_repeat}@ 202207L // freestanding, also in \libheader{ranges}
Expand Down