Created on 2019-01-14.00:00:00 last changed 46 months ago
Proposed resolution:
This wording is relative to N4791.
[Drafting Note: This wording uses the recently-defined core language term "usable in constant expressions" from [expr.const] paragraph 3 which may be unfamiliar to reviewers.]
Change [iterator.concept.sizedsentinel] as follows:
[…]
(2.2) — If −N is representable by iter_difference_t<I>, then i - s is well-defined and equals −N.
-?- Pursuant to [namespace.std], users may specialize disable_sized_sentinel for cv-unqualified non-array object types S and I at least one of which is a program-defined type. Such specializations shall be usable in constant expressions ([expr.const]) and have type const bool.
3 [Note: disable_sized_sentinel allows use of sentinels and iterators with the library that satisfy but do not in fact model SizedSentinel.—end note]
[…]
Add an index entry for disable_sized_sentinel that points to [iterator.concepts.sizedsentinel].
Change [range.sized] as follows:
[…]
3 [Note: The complexity requirement for the evaluation of ranges::size is non-amortized, unlike the case for the complexity of the evaluations of ranges::begin and ranges::end in the Range concept.—end note]
-?- Pursuant to [namespace.std], users may specialize disable_sized_range for cv-unqualified program-defined types. Such specializations shall be usable in constant expressions ([expr.const]) and have type const bool.
4 [Note: disable_sized_range allows use of range types with the library that satisfy but do not in fact model SizedRange.—end note]
Add an index entry for disable_sized_range that points to [range.sized].
Change [range.view] as follows:
[…]
5 Pursuant to [namespace.std], users may specialize enable_view to true for cv-unqualified program-defined types which model View, and false for types which do not. Such specializations shall be usable in constant expressions ([expr.const]) and have type const bool.
[ 2019-02-03 Priority to 0 and Status to Tentatively Ready after five positive votes on the reflector. ]
P0896R4 "The One Ranges Proposal" added boolean variable templates std::disable_sized_sentinel and std::ranges::disable_sized_range which users are intended to specialize to false for program-defined Iterator-Sentinel pairs / Range types which meet the syntax but do not model the semantics of the SizedSentinel / SizedRange concepts, respectively. Specializing these traits allows the use of such types with the library which would otherwise treat them as if they model SizedSentinel / SizedRange. The wording in P0896R4 failed, however, to provide normative permission to specialize these variable templates as is required by [namespace.std] after the application of P0551R3.
Furthermore, [namespace.std] notably does not require that program-defined specializations of standard library variable templates meet the requirements on the primary template (as is the case for class templates) or indeed any requirements. P0896R4 also added the enable_view variable template which is used to explicitly opt in or out of the View concept [range.view] when the default chosen by the heuristic is incorrect. P0896R4 did include normative permission to specialize enable_view, but the wording does not place sufficient requirements on such user specializations so as to make them usable by the View concept definition. Specializations must be required to be usable as constant expressions of type bool to avoid hard errors in the concept.
History | |||
---|---|---|---|
Date | User | Action | Args |
2021-02-25 10:48:01 | admin | set | status: wp -> c++20 |
2019-07-22 15:46:37 | admin | set | status: voting -> wp |
2019-06-17 05:25:36 | admin | set | status: ready -> voting |
2019-02-03 12:20:33 | admin | set | messages: + msg10301 |
2019-02-03 12:20:33 | admin | set | status: new -> ready |
2019-01-15 00:35:33 | admin | set | messages: + msg10279 |
2019-01-14 00:00:00 | admin | create |