Skip to content

Commit 8d14291

Browse files
committed
P3060R3 Add std::views::indices(n)
Fixed "if T models is-integer-like" which is a category error because that's a variable template not a concept.
1 parent a8d9618 commit 8d14291

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

source/ranges.tex

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,10 @@
215215
template<class W, class Bound>
216216
constexpr bool @\libspec{enable_borrowed_range}{iota_view}@<iota_view<W, Bound>> = true;
217217

218-
namespace views { inline constexpr @\unspecnc@ iota = @\unspecnc@; }
218+
namespace views {
219+
inline constexpr @\unspecnc@ iota = @\unspecnc@;
220+
inline constexpr @\unspecnc@ indices = @\unspecnc@;
221+
}
219222

220223
// \ref{range.repeat}, repeat view
221224
template<@\libconcept{move_constructible}@ T, @\libconcept{semiregular}@ Bound = unreachable_sentinel_t>
@@ -2784,6 +2787,17 @@
27842787
\end{codeblock}
27852788
\end{example}
27862789

2790+
\pnum
2791+
\indexlibrarymember{indices}{views}%
2792+
The name \tcode{views::indices} denotes a
2793+
customization point object\iref{customization.point.object}.
2794+
Given subexpression \tcode{E},
2795+
let \tcode{T} be \tcode{remove_cvref_t<decltype((E))>}.
2796+
\tcode{views::indices(E)} is expression-equivalent to
2797+
\tcode{views::iota(T(0), E)}
2798+
if \tcode{\exposid{is-integer-like}<T>} is \tcode{true},
2799+
and ill-formed otherwise.
2800+
27872801
\rSec3[range.iota.view]{Class template \tcode{iota_view}}
27882802

27892803
\indexlibraryglobal{iota_view}%

source/support.tex

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -775,6 +775,7 @@
775775
#define @\defnlibxname{cpp_lib_ranges_find_last}@ 202207L // also in \libheader{algorithm}
776776
#define @\defnlibxname{cpp_lib_ranges_fold}@ 202207L // also in \libheader{algorithm}
777777
#define @\defnlibxname{cpp_lib_ranges_generate_random}@ 202403L // also in \libheader{random}
778+
#define @\defnlibxname{cpp_lib_ranges_indices}@ 202506L // also in \libheader{ranges}
778779
#define @\defnlibxname{cpp_lib_ranges_iota}@ 202202L // also in \libheader{numeric}
779780
#define @\defnlibxname{cpp_lib_ranges_join_with}@ 202202L // freestanding, also in \libheader{ranges}
780781
#define @\defnlibxname{cpp_lib_ranges_repeat}@ 202207L // freestanding, also in \libheader{ranges}

0 commit comments

Comments
 (0)