Title
`views::indices` is underconstrained
Status
new
Section
[range.iota.overview]
Submitter
Hewill Kang

Created on 2025-10-15.00:00:00 last changed 1 month ago

Messages

Date: 2025-10-19.09:26:25

Proposed resolution:

This wording is relative to N5014.

  1. Modify [range.iota.overview] as indicated:

    -4- The name `views::indices` denotes a customization point object ([customization.point.object]). Given subexpression `E`, let `T` be remove_cvref_t<decltype((E))>. `views::indices(E)` is expression-equivalent to `views::iota(T(0), E)` if is-integer-like<T> is `true` and `T` models `weakly_incrementable`, and ill-formed otherwise.

Date: 2025-10-15.00:00:00

Whether an integer-class type satisfies `weakly_incrementable` is unspecified according to [range.iota.view]. For example, the library may provide a member type alias `difference_type` for the integer-class type to make it `weakly_incrementable`, or not.

If the latter, then views::iota(integer-class-type(0)) is always ill-formed because iota_view<W, Bound> requires `W` to be `weakly_incrementable`.

However, unlike `views::iota`, `views::indices` unconditionally accepts integer-class types, which will lead to a hard error in the function body if the integer-class type is not `weakly_incrementable`, which is true for both libstdc++ and MSVC-STL.

History
Date User Action Args
2025-10-19 09:26:25adminsetmessages: + msg15257
2025-10-15 00:00:00admincreate