Skip to content

Commit

Permalink
Can't be mutable either way
Browse files Browse the repository at this point in the history
  • Loading branch information
brevzin committed Nov 3, 2024
1 parent 6742672 commit c2c2f15
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
4 changes: 3 additions & 1 deletion 3380_extend_cnttp_2/extend-cnttp-2.md
Original file line number Diff line number Diff line change
Expand Up @@ -746,11 +746,13 @@ This proposal extends class types as non-type parameters as follows. This isn't
First, as with [@P2484R0], I'm referring to `to_meta_representation` as a template representation function. A class type `T` can provide an `to_meta_representation` that must be `consteval`, with one of two forms:
1. It is a possibly-mutable function that returns `void`, in which case every base class and non-static data member shall have structural type and none of them shall be `mutable`.
1. It is a possibly-mutable function that returns `void`, in which case every base class and non-static data member shall have structural type.
2. It is a `const` function that returns some value `R` such that:
a. `R.data()` is convertible to `std::meta::info const*`, `R.size()` is convertible to `size_t`, and `static_cast<std::meta::info const*>(R.data())[i]` shall be valid for all `0 <= i < static_cast<size_t>(R.size())`, and
b. `T::from_meta_representation(R)` is a valid expression that yields a prvalue of type `T`.
Either way, no non-static data member of `T` can be `mutable`.
Second, we introduce the concept of template argument normalization and allow string literal template arguments:
::: std
Expand Down
6 changes: 4 additions & 2 deletions 3380_extend_cnttp_2/p3380r1.html
Original file line number Diff line number Diff line change
Expand Up @@ -1539,8 +1539,7 @@ <h2 data-number="4.1" id="language"><span class="header-section-number">4.1</spa
<li>It is a possibly-mutable function that returns
<code class="sourceCode cpp"><span class="dt">void</span></code>, in
which case every base class and non-static data member shall have
structural type and none of them shall be
<code class="sourceCode cpp"><span class="kw">mutable</span></code>.</li>
structural type.</li>
<li>It is a
<code class="sourceCode cpp"><span class="kw">const</span></code>
function that returns some value <code class="sourceCode cpp">R</code>
Expand All @@ -1559,6 +1558,9 @@ <h2 data-number="4.1" id="language"><span class="header-section-number">4.1</spa
<code class="sourceCode cpp">T</code>.</li>
</ol></li>
</ol>
<p>Either way, no non-static data member of
<code class="sourceCode cpp">T</code> can be
<code class="sourceCode cpp"><span class="kw">mutable</span></code>.</p>
<p>Second, we introduce the concept of template argument normalization
and allow string literal template arguments:</p>
<div class="std">
Expand Down

0 comments on commit c2c2f15

Please sign in to comment.