|
| 1 | +<?xml version='1.0' encoding='utf-8' standalone='no'?> |
| 2 | +<!DOCTYPE issue SYSTEM "lwg-issue.dtd"> |
| 3 | + |
| 4 | +<issue num="4038" status="New"> |
| 5 | +<title><code>std::text_encoding::aliases_view</code> should have constexpr iterators</title> |
| 6 | +<section><sref ref="[text.encoding.aliases]"/></section> |
| 7 | +<submitter>Jonathan Wakely</submitter> |
| 8 | +<date>16 Jan 2024</date> |
| 9 | +<priority>99</priority> |
| 10 | + |
| 11 | +<discussion> |
| 12 | +<p> |
| 13 | +<code>aliases_view::begin()</code> and <code>aliases_view::end()</code> |
| 14 | +are constexpr functions, but there is no requirement that you can use |
| 15 | +the returned iterator and sentinel in constant expressions. |
| 16 | +</p> |
| 17 | +</discussion> |
| 18 | + |
| 19 | +<resolution> |
| 20 | +<p> |
| 21 | +This wording is relative to <paper num="N4971"/>. |
| 22 | +</p> |
| 23 | + |
| 24 | +<ol> |
| 25 | +<li><p>Modify <sref ref="[text.encoding.aliases]"/> as indicated:</p> |
| 26 | + |
| 27 | +<blockquote> |
| 28 | +<blockquote> |
| 29 | +<pre> |
| 30 | +struct text_encoding::aliases_view : ranges::view_interface<text_encoding::aliases_view> { |
| 31 | + constexpr <i>implementation-defined</i> begin() const; |
| 32 | + constexpr <i>implementation-defined</i> end() const; |
| 33 | +}; |
| 34 | +</pre> |
| 35 | +</blockquote> |
| 36 | +<p> |
| 37 | +-1- |
| 38 | +<code>text_encoding::aliases_view</code> models <code>copyable</code>, |
| 39 | +<code>ranges::view</code>, <code>ranges::random_access_range</code>, |
| 40 | +and <code>ranges::borrowed_range</code>. |
| 41 | +</p> |
| 42 | +<p> |
| 43 | +-2- |
| 44 | +Both <code>ranges::range_value_t<text_encoding::aliases_view></code> |
| 45 | +and <code>ranges::range_reference_t<text_encoding::aliases_view></code> |
| 46 | +denote <code>const char*</code>. |
| 47 | +</p> |
| 48 | +<p> |
| 49 | +<ins> |
| 50 | +-?- |
| 51 | +<code>ranges::iterator_t<text_encoding::aliases_view></code> |
| 52 | +is a constexpr iterator (<sref ref="[iterator.requirements.general]"/>). |
| 53 | +</ins> |
| 54 | +</p> |
| 55 | +</blockquote> |
| 56 | +</li> |
| 57 | +</ol> |
| 58 | +</resolution> |
| 59 | + |
| 60 | +</issue> |
0 commit comments