Skip to content

Commit

Permalink
Wording improvements.
Browse files Browse the repository at this point in the history
  • Loading branch information
brevzin committed Oct 29, 2024
1 parent 9392d92 commit d354062
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 23 deletions.
12 changes: 4 additions & 8 deletions 3394_annotations/annotations.md
Original file line number Diff line number Diff line change
Expand Up @@ -713,7 +713,7 @@ static_assert(!extract<Option>(annotations_of(^C::b)[0]).value);
consteval vector<info> annotations_of(info item, info type);
```
[#]{.pnum} *Constant When*: `annotations_of(item)` is constant and `dealias(type)` is a reflection representing a complete class type.
[#]{.pnum} *Constant When*: `annotations_of(item)` is constant and `dealias(type)` is a reflection representing a complete type.
[#]{.pnum} *Effects*: If `dealias(type)` represents a class template specialization with a reachable definition, the specialization is instantiated.
Expand All @@ -729,7 +729,7 @@ template<class T>
[#]{.pnum} *Constant When*: `V` is a core constant expression and either:

* [#.#]{.pnum} `V.size() <= 1`, or
* [#.#]{.pnum} all the reflections in `V` compare equal.
* [#.#]{.pnum} all the values of the reflections in `V` compare equal.

[#]{.pnum} *Returns*: If `V.empty()`, then `std::nullopt`. Otherwise, `extract<T>(V[0])`.

Expand All @@ -738,11 +738,7 @@ template<class T>
consteval bool has_annotation(info item);
```
[#]{.pnum} Let `V` be `annotations_of(item, ^T)`.
[#]{.pnum} *Constant When*: `V` is a core constant expression.
[#]{.pnum} *Returns*: `V.empty()` is `false`.
[#]{.pnum} *Effects*: Equivalent to `return !annotations_of(item, ^T).empty();`
```cpp
template<class T>
Expand All @@ -753,7 +749,7 @@ template<class T>

[#]{.pnum} *Constant When*: `V` is a core constant expression.

[#]{.pnum} *Returns*: `true` if there exists a reflection `r` in `V` such that `r == std::meta::reflect_value(value)`. Otherwise, `false` [This checks for template-argument-equivalence, it does not invoke either a built-in or user-provided `operator==`]{.note}.
[#]{.pnum} *Returns*: `true` if there exists a reflection `r` in `V` such that `value_of(r) == std::meta::reflect_value(value)`. Otherwise, `false` [This checks for template-argument-equivalence, it does not invoke either a built-in or user-provided `operator==`]{.note}.

::: example
```cpp
Expand Down
23 changes: 8 additions & 15 deletions 3394_annotations/p3394r1.html
Original file line number Diff line number Diff line change
Expand Up @@ -1607,7 +1607,7 @@ <h2 data-number="5.2" id="library"><span class="header-section-number">5.2</span
<p><span class="marginalizedparent"><a class="marginalized" href="#pnum_32" id="pnum_32">4</a></span>
<em>Constant When</em>: <code class="sourceCode cpp">annotations_of<span class="op">(</span>item<span class="op">)</span></code>
is constant and <code class="sourceCode cpp">dealias<span class="op">(</span>type<span class="op">)</span></code>
is a reflection representing a complete class type.</p>
is a reflection representing a complete type.</p>
<p><span class="marginalizedparent"><a class="marginalized" href="#pnum_33" id="pnum_33">5</a></span>
<em>Effects</em>: If <code class="sourceCode cpp">dealias<span class="op">(</span>type<span class="op">)</span></code>
represents a class template specialization with a reachable definition,
Expand All @@ -1628,8 +1628,8 @@ <h2 data-number="5.2" id="library"><span class="header-section-number">5.2</span
<code class="sourceCode cpp">V<span class="op">.</span>size<span class="op">()</span> <span class="op">&lt;=</span> <span class="dv">1</span></code>,
or</li>
<li><span class="marginalizedparent"><a class="marginalized" href="#pnum_38" id="pnum_38">(8.2)</a></span>
all the reflections in <code class="sourceCode cpp">V</code> compare
equal.</li>
all the values of the reflections in
<code class="sourceCode cpp">V</code> compare equal.</li>
</ul>
<p><span class="marginalizedparent"><a class="marginalized" href="#pnum_39" id="pnum_39">9</a></span>
<em>Returns</em>: If <code class="sourceCode cpp">V<span class="op">.</span>empty<span class="op">()</span></code>,
Expand All @@ -1639,26 +1639,19 @@ <h2 data-number="5.2" id="library"><span class="header-section-number">5.2</span
<div class="sourceCode" id="cb35"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb35-1"><a href="#cb35-1" aria-hidden="true" tabindex="-1"></a><span class="kw">template</span><span class="op">&lt;</span><span class="kw">class</span> T<span class="op">&gt;</span></span>
<span id="cb35-2"><a href="#cb35-2" aria-hidden="true" tabindex="-1"></a> <span class="kw">consteval</span> <span class="dt">bool</span> has_annotation<span class="op">(</span>info item<span class="op">)</span>;</span></code></pre></div>
<p><span class="marginalizedparent"><a class="marginalized" href="#pnum_40" id="pnum_40">10</a></span>
Let <code class="sourceCode cpp">V</code> be <code class="sourceCode cpp">annotations_of<span class="op">(</span>item, <span class="op">^</span>T<span class="op">)</span></code>.</p>
<p><span class="marginalizedparent"><a class="marginalized" href="#pnum_41" id="pnum_41">11</a></span>
<em>Constant When</em>: <code class="sourceCode cpp">V</code> is a core
constant expression.</p>
<p><span class="marginalizedparent"><a class="marginalized" href="#pnum_42" id="pnum_42">12</a></span>
<em>Returns</em>: <code class="sourceCode cpp">V<span class="op">.</span>empty<span class="op">()</span></code>
is
<code class="sourceCode cpp"><span class="kw">false</span></code>.</p>
<em>Effects</em>: Equivalent to <code class="sourceCode cpp"><span class="cf">return</span> <span class="op">!</span>annotations_of<span class="op">(</span>item, <span class="op">^</span>T<span class="op">).</span>empty<span class="op">()</span>;</code></p>
<div class="sourceCode" id="cb36"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb36-1"><a href="#cb36-1" aria-hidden="true" tabindex="-1"></a><span class="kw">template</span><span class="op">&lt;</span><span class="kw">class</span> T<span class="op">&gt;</span></span>
<span id="cb36-2"><a href="#cb36-2" aria-hidden="true" tabindex="-1"></a> <span class="kw">consteval</span> <span class="dt">bool</span> has_annotation<span class="op">(</span>info item, T <span class="kw">const</span><span class="op">&amp;</span> value<span class="op">)</span>;</span></code></pre></div>
<p><span class="marginalizedparent"><a class="marginalized" href="#pnum_43" id="pnum_43">13</a></span>
<p><span class="marginalizedparent"><a class="marginalized" href="#pnum_41" id="pnum_41">11</a></span>
Let <code class="sourceCode cpp">V</code> be <code class="sourceCode cpp">annotations_of<span class="op">(</span>item, <span class="op">^</span>T<span class="op">)</span></code>.</p>
<p><span class="marginalizedparent"><a class="marginalized" href="#pnum_44" id="pnum_44">14</a></span>
<p><span class="marginalizedparent"><a class="marginalized" href="#pnum_42" id="pnum_42">12</a></span>
<em>Constant When</em>: <code class="sourceCode cpp">V</code> is a core
constant expression.</p>
<p><span class="marginalizedparent"><a class="marginalized" href="#pnum_45" id="pnum_45">15</a></span>
<p><span class="marginalizedparent"><a class="marginalized" href="#pnum_43" id="pnum_43">13</a></span>
<em>Returns</em>:
<code class="sourceCode cpp"><span class="kw">true</span></code> if
there exists a reflection <code class="sourceCode cpp">r</code> in
<code class="sourceCode cpp">V</code> such that <code class="sourceCode cpp">r <span class="op">==</span> std<span class="op">::</span>meta<span class="op">::</span>reflect_value<span class="op">(</span>value<span class="op">)</span></code>.
<code class="sourceCode cpp">V</code> such that <code class="sourceCode cpp">value_of<span class="op">(</span>r<span class="op">)</span> <span class="op">==</span> std<span class="op">::</span>meta<span class="op">::</span>reflect_value<span class="op">(</span>value<span class="op">)</span></code>.
Otherwise,
<code class="sourceCode cpp"><span class="kw">false</span></code> <span class="note"><span><em>Note 1:</em> </span>This checks for
template-argument-equivalence, it does not invoke either a built-in or
Expand Down

0 comments on commit d354062

Please sign in to comment.