From 8d14291e92d8dad7cab63161e14c61b0e2d71e33 Mon Sep 17 00:00:00 2001 From: Jonathan Wakely Date: Mon, 23 Jun 2025 17:38:37 +0100 Subject: [PATCH] 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. --- source/ranges.tex | 16 +++++++++++++++- source/support.tex | 1 + 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/source/ranges.tex b/source/ranges.tex index c16eba7f10..7d35652947 100644 --- a/source/ranges.tex +++ b/source/ranges.tex @@ -215,7 +215,10 @@ template constexpr bool @\libspec{enable_borrowed_range}{iota_view}@> = 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> @@ -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}. +\tcode{views::indices(E)} is expression-equivalent to +\tcode{views::iota(T(0), E)} +if \tcode{\exposid{is-integer-like}} is \tcode{true}, +and ill-formed otherwise. + \rSec3[range.iota.view]{Class template \tcode{iota_view}} \indexlibraryglobal{iota_view}% diff --git a/source/support.tex b/source/support.tex index 95d674aafb..9e40765ab5 100644 --- a/source/support.tex +++ b/source/support.tex @@ -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}