You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/cpp2/metafunctions.md
+14-2Lines changed: 14 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -28,7 +28,7 @@ point2d: @value type = {
28
28
29
29
## <aid="generating-source"></a>Generating source code at compile time
30
30
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:
32
32
33
33
```cpp title="shape.cpp2: Using @interface @print" hl_lines="1"
34
34
shape: @interface @print type = {
@@ -128,6 +128,17 @@ A `basic_value` type is a regular type: [`copyable`](#copyable), default constru
128
128
129
129
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).
130
130
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
+
131
142
These metafunctions will emit a compile-time error if:
132
143
133
144
- any function is protected or virtual
@@ -142,6 +153,7 @@ These metafunctions will emit a compile-time error if:
142
153
>
143
154
> — P0707R4, section 3
144
155
156
+
145
157
#### `struct`
146
158
147
159
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.
187
199
188
200
- the type has a copy or move function (the diagnostic message will suggest a virtual `clone` function instead)
0 commit comments