Skip to content

Commit 270aa15

Browse files
authored
Merge 2025-06 LWG Motion 29
P3060R3 Add std::views::indices(n)
2 parents 2685869 + b452013 commit 270aa15

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
@@ -218,7 +218,10 @@
218218
template<class W, class Bound>
219219
constexpr bool @\libspec{enable_borrowed_range}{iota_view}@<iota_view<W, Bound>> = true;
220220

221-
namespace views { inline constexpr @\unspecnc@ iota = @\unspecnc@; }
221+
namespace views {
222+
inline constexpr @\unspecnc@ iota = @\unspecnc@;
223+
inline constexpr @\unspecnc@ indices = @\unspecnc@;
224+
}
222225

223226
// \ref{range.repeat}, repeat view
224227
template<@\libconcept{move_constructible}@ T, @\libconcept{semiregular}@ Bound = unreachable_sentinel_t>
@@ -2802,6 +2805,17 @@
28022805
\end{codeblock}
28032806
\end{example}
28042807

2808+
\pnum
2809+
\indexlibrarymember{indices}{views}%
2810+
The name \tcode{views::indices} denotes a
2811+
customization point object\iref{customization.point.object}.
2812+
Given subexpression \tcode{E},
2813+
let \tcode{T} be \tcode{remove_cvref_t<decltype((E))>}.
2814+
\tcode{views::indices(E)} is expression-equivalent to
2815+
\tcode{views::iota(T(0), E)}
2816+
if \tcode{\exposid{is-integer-like}<T>} is \tcode{true},
2817+
and ill-formed otherwise.
2818+
28052819
\rSec3[range.iota.view]{Class template \tcode{iota_view}}
28062820

28072821
\indexlibraryglobal{iota_view}%

source/support.tex

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -794,6 +794,7 @@
794794
#define @\defnlibxname{cpp_lib_ranges_find_last}@ 202207L // also in \libheader{algorithm}
795795
#define @\defnlibxname{cpp_lib_ranges_fold}@ 202207L // also in \libheader{algorithm}
796796
#define @\defnlibxname{cpp_lib_ranges_generate_random}@ 202403L // also in \libheader{random}
797+
#define @\defnlibxname{cpp_lib_ranges_indices}@ 202506L // also in \libheader{ranges}
797798
#define @\defnlibxname{cpp_lib_ranges_iota}@ 202202L // also in \libheader{numeric}
798799
#define @\defnlibxname{cpp_lib_ranges_join_with}@ 202202L // freestanding, also in \libheader{ranges}
799800
#define @\defnlibxname{cpp_lib_ranges_repeat}@ 202207L // freestanding, also in \libheader{ranges}

0 commit comments

Comments
 (0)