Skip to content

Commit 663b3d0

Browse files
Update metafunctions.md (#1015)
Signed-off-by: Neil Henderson <[email protected]>
1 parent 1bdab45 commit 663b3d0

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

docs/cpp2/metafunctions.md

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ point2d: @value type = {
2828

2929
## <a id="generating-source"></a>Generating source code at compile time
3030

31-
A metafunction applied to a definition using `@` gets to participate in interpreting the meaning of the definition by inspecting and manipulating the definition's parse tree. For example
31+
A metafunction applied to a definition using `@` gets to participate in interpreting the meaning of the definition by inspecting and manipulating the definition's parse tree. For example:
3232

3333
``` cpp title="shape.cpp2: Using @interface @print" hl_lines="1"
3434
shape: @interface @print type = {
@@ -128,6 +128,17 @@ A `basic_value` type is a regular type: [`copyable`](#copyable), default constru
128128
129129
A `value` (or `weakly_ordered_value` or `partially_ordered_value`) is a `basic_value` that is also [`ordered`](#ordered) (or `weakly_ordered` or `partially_ordered`, respectively).
130130
131+
```mermaid
132+
graph TD;
133+
value---->basic_value;
134+
weakly_ordered_value---->basic_value;
135+
partially_ordered_value---->basic_value;
136+
basic_value-->copyable;
137+
value-->ordered;
138+
partially_ordered_value-->partially_ordered;
139+
weakly_ordered_value-->weakly_ordered;
140+
```
141+
131142
These metafunctions will emit a compile-time error if:
132143

133144
- any function is protected or virtual
@@ -142,6 +153,7 @@ These metafunctions will emit a compile-time error if:
142153
>
143154
> — P0707R4, section 3
144155

156+
145157
#### `struct`
146158

147159
A `struct` is a type with only public bases, objects, and functions, with no virtual functions, and with no user-defined constructors (i.e., no invariants) or assignment or destructors.
@@ -187,7 +199,7 @@ Cpp2 has no `interface` feature hardwired into the language, as C# and Java do.
187199

188200
- the type has a copy or move function (the diagnostic message will suggest a virtual `clone` function instead)
189201

190-
- any function has body
202+
- any function has a body
191203

192204
- any function is nonpublic
193205

0 commit comments

Comments
 (0)