Section: 24.3.4.4 [iterator.concept.winc] Status: C++20 Submitter: Casey Carter Opened: 2020-01-07 Last modified: 2021-02-25
Priority: 0
View all other issues in [iterator.concept.winc].
View all issues with C++20 status.
Discussion:
It's widely established that neither conversions of integral types to bool
nor conversions
between different integral types throw exceptions. These properties are crucial to supporting exception
guarantees in algorithms, containers, and other uses of iterators and their difference types.
Integer-class types must provide the same guarantees to support the same use cases as do integer types.
[2020-01-14; Daniel comments]
We probably need to think about providing the stronger guarantee that all integer-class operations
are also noexcept
in addition to the guarantee that they do not throw any exceptions.
The fixed wording in LWG 3358, 23.7.2.2.2 [span.cons] p9 depends on the no-throw-guarantee of integer-class conversions to integral types.
[2020-01-25 Status set to Tentatively Ready after five positive votes on the reflector.]
Proposed resolution:
This wording is relative to N4842.
Modify 24.3.4.4 [iterator.concept.winc] as indicated:
[Drafting note: There's a bit of drive-by editing here to change occurrences of the meaningless "type is convertible to type" to "expression is convertible to type". Paragraph 7 only has drive-by edits. ]
-6-
-7-AllExpressions of integer-class typesare explicitly convertible toallany integral types and. Expressions of integral type are both implicitly and explicitly convertiblefrom all integral typesto any integer-class type. Conversions between integral and integer-class types do not exit via an exception.AllExpressionsE
of integer-class typesI
are contextually convertible tobool
as if bybool(
aE != I(0)), where.a
is an instance of the integral-class typeI