Open wg21bot opened 10 months ago
SG9 agreed on the following summary of the discussion in the room, with the understanding that it would be posted to GitHub as the outcome of the discussion.
SG9 believes that the failure of the following (already arcane because of the name iota
) beginner code to compile is a defect in the standard that is worth our time to address
vector v = { /*...*/ };
for (auto i : views::iota(0, ranges::size(v))) {
// ...
}
Most of the rest of the discussion revolved around the name upto
, the most popular alternative to which was indices
. The arguments on each side were as follows:
upto
std::upper_bound
upto
sounds like iota
(we can teach that "four letter things that start and end with vowels generate integers")
upto
to be inclusiveto
to be inclusiveviews::take
particularly in the context of a pipelineupper_bound
because the latter is clearly a math termupper_bound
isn't a perfect precedent because uniform_int_distribution
is inclusive of it's upper bound, so there's no complete uniformity in the language.upto
is ambiguous with up_to
indices
indices
to mean this
enumerate
references Python alreadystd::index_sequence
std::index_sequence
could be confusing because index_sequence
is always size_t
indices_of
to help disambiguateindices
is the plural of index
We took the following polls to summarize the outcomes of our discussion:
_Change the name views::upto
to views::indices
(with the understanding that we anticipate probably later adding a facility like views::indices_of
)_
SF | F | N | A | SA |
---|---|---|---|---|
6 | 6 | 2 | 3 | 0 |
Result: Consensus for change (borderline strong)
Attendance: 17
Authors: N and A
Author Against: the name doesn't look as generic as upto
, but it's acceptable
SG9 believes that we should use the is-integer-like
exposition-only constraint rather than the std::integral
(is-integer-like
allows implementation-defined types and removes bool
).
SF | F | N | A | SA |
---|---|---|---|---|
6 | 9 | 0 | 0 | 0 |
Result: Unanimous Consent Attendance: 17 Authors: SF (x2)
Forward P3060R1 to LEWG with the two changes polled above for inclusion in C++26.
SF | F | N | A | SA |
---|---|---|---|---|
11 | 4 | 2 | 0 | 0 |
Result: Strong consensus Attendance: 17 Authors: SF
SG9 also polled on the inclusion of a facility like indices_of
in the current paper, in an attempt to make the case for indices
as a more compelling name. The poll had weak consensus, but one attendee discovered a late argument (raised in their strongly against statement) that convinced the room that indices_of
should be in a separate paper: For a sized_range
, indices_of
has to choose whether to return a range of size_type
or difference_type
, either of which may lead to implicit conversions or other incompatibilities. The former choice may not work with indexing into the range, but the latter may be inconsistent with views::indices(ranges::size(r))
, which would use the size_type
. We anticipate a separate paper proposing this facility.
P3060R0 Add std::ranges::upto(n) (Weile Wei)