This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of WP status.
possibly-const-range
and as-const-pointer
should be noexcept
Section: 25.2 [ranges.syn], 25.3.14 [range.prim.cdata] Status: WP Submitter: Jiang An Opened: 2023-06-20 Last modified: 2023-11-22
Priority: Not Prioritized
View other active issues in [ranges.syn].
View all other issues in [ranges.syn].
View all issues with WP status.
Discussion:
As of P2278R4, several range access CPOs are specified with possibly-const-range
and as-const-pointer
. These helper functions never throw exceptions, but are not marked with
noexcept
. As a result, implementations are currently allowed to make a call to
ranges::ccpo
potentially throwing while the underlying ranges::cpo
call is
non-throwing, which doesn't seem to be intended.
[2023-10-27; Reflector poll]
Set status to Tentatively Ready after five votes in favour during reflector poll.
[2023-11-11 Approved at November 2023 meeting in Kona. Status changed: Voting → WP.]
Proposed resolution:
This wording is relative to N4950.
Modify 25.2 [ranges.syn], header <ranges>
synopsis, as indicated:
[…] // 25.7.22 [range.as.const], as const view template<input_range R> constexpr auto& possibly-const-range(R& r) noexcept { // exposition only if constexpr (constant_range<const R> && !constant_range<R>) { return const_cast<const R&>(r); } else { return r; } } […]
Modify 25.3.14 [range.prim.cdata] before p1 as indicated:
template<class T> constexpr auto as-const-pointer(const T* p) noexcept { return p; } // exposition only