Title
possibly-const-range and as-const-pointer should be noexcept
Status
wp
Section
[ranges.syn][range.prim.cdata]
Submitter
Jiang An

Created on 2023-06-20.00:00:00 last changed 13 months ago

Messages

Date: 2023-11-13.14:08:10

Proposed resolution:

This wording is relative to N4950.

  1. Modify [ranges.syn], header <ranges> synopsis, as indicated:

    […]
    // [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;
        }
      }
    […]
    
  2. Modify [range.prim.cdata] before p1 as indicated:

    template<class T>
    constexpr auto as-const-pointer(const T* p) noexcept { return p; }    // exposition only
    
Date: 2023-11-11.00:00:00

[ 2023-11-11 Approved at November 2023 meeting in Kona. Status changed: Voting → WP. ]

Date: 2023-10-15.00:00:00

[ 2023-10-27; Reflector poll ]

Set status to Tentatively Ready after five votes in favour during reflector poll.

Date: 2023-06-20.00:00:00

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.

History
Date User Action Args
2023-11-13 14:08:10adminsetmessages: + msg13844
2023-11-13 14:08:10adminsetstatus: voting -> wp
2023-11-07 21:41:54adminsetstatus: ready -> voting
2023-10-27 21:22:44adminsetmessages: + msg13763
2023-10-27 21:22:44adminsetstatus: new -> ready
2023-06-25 08:39:56adminsetmessages: + msg13662
2023-06-20 00:00:00admincreate