@@ -4,6 +4,8 @@ $(SPEC_S Structs and Unions,
4
4
5
5
$(HEADERNAV_TOC)
6
6
7
+ $(H2 $(LNAME2 intro, Introduction))
8
+
7
9
$(P Whereas classes are reference types, structs are value types.
8
10
Structs and unions are simple aggregations of data and their
9
11
associated operations on that data.
@@ -20,7 +22,7 @@ $(GNAME StructDeclaration):
20
22
$(D struct) $(GLINK_LEX Identifier) $(D ;)
21
23
$(D struct) $(GLINK_LEX Identifier) $(GLINK AggregateBody)
22
24
$(GLINK2 template, StructTemplateDeclaration)
23
- $(GLINK AnonStructDeclaration)
25
+ $(I AnonStructDeclaration)
24
26
25
27
$(GNAME AnonStructDeclaration):
26
28
$(D struct) $(GLINK AggregateBody)
@@ -29,7 +31,7 @@ $(GNAME UnionDeclaration):
29
31
$(D union) $(GLINK_LEX Identifier) $(D ;)
30
32
$(D union) $(GLINK_LEX Identifier) $(GLINK AggregateBody)
31
33
$(GLINK2 template, UnionTemplateDeclaration)
32
- $(GLINK AnonUnionDeclaration)
34
+ $(I AnonUnionDeclaration)
33
35
34
36
$(GNAME AnonUnionDeclaration):
35
37
$(D union) $(GLINK AggregateBody)
@@ -114,7 +116,7 @@ $(H2 $(LNAME2 POD, Plain Old Data))
114
116
115
117
$(H2 $(LNAME2 opaque_struct_unions, Opaque Structs and Unions))
116
118
117
- $(P Opaque struct and union declarations do not have a $(GLINK AggregateBody):)
119
+ $(P Opaque struct and union declarations do not have an $(GLINK AggregateBody):)
118
120
119
121
---
120
122
struct S;
@@ -323,7 +325,7 @@ S t = s; // sets t.a to 3, S.opCall(S) is not called
323
325
324
326
$(H2 $(LEGACY_LNAME2 StructLiteral, struct-literal, Struct Literals))
325
327
326
- $(P Struct literals consist of the name of the struct followed
328
+ $(P A struct literal consists of the name of the struct followed
327
329
by a parenthesized argument list:)
328
330
329
331
$(SPEC_RUNNABLE_EXAMPLE_RUN
@@ -360,7 +362,7 @@ $(TROW $(D .sizeof), Size in bytes of struct)
360
362
$(TROW $(D .alignof), Size boundary struct needs to be aligned on)
361
363
)
362
364
363
- $(H2 $(LNAME2 struct_instance_properties, Struct Instance Properties))
365
+ $(H3 $(LNAME2 struct_instance_properties, Struct Instance Properties))
364
366
365
367
$(TABLE2 Struct Instance Properties,
366
368
$(THEAD Name, Description)
@@ -369,7 +371,7 @@ $(TROW $(D .tupleof), An $(DDSUBLINK spec/template, variadic-templates, expressi
369
371
$(DDSUBLINK spec/class, class_properties, Class Properties) for a class-based example.)
370
372
)
371
373
372
- $(H2 $(LNAME2 struct_field_properties, Struct Field Properties))
374
+ $(H3 $(LNAME2 struct_field_properties, Struct Field Properties))
373
375
374
376
$(TABLE2 Struct Field Properties,
375
377
$(THEAD Name, Description)
@@ -407,8 +409,8 @@ $(H2 $(LEGACY_LNAME2 Struct-Constructor, struct-constructor, Struct Constructors
407
409
408
410
$(P Struct constructors are used to initialize an instance of a struct when a more
409
411
complex construction is needed than is allowed by
410
- $(LINK2 # static_struct_init, static initialization) or a
411
- $(LINK2 # struct-literal, struct literal).
412
+ $(RELATIVE_LINK2 static_struct_init, static initialization) or a
413
+ $(RELATIVE_LINK2 struct-literal, struct literal).
412
414
)
413
415
414
416
$(P Constructors are defined with a function name of `this` and have no return value.
@@ -728,7 +730,7 @@ $(H3 $(LNAME2 field-init, Field initialization inside a constructor))
728
730
---
729
731
)
730
732
731
- $(P If the field type has an $(LINK2 operatoroverloading.html# assignment, `opAssign`)
733
+ $(P If the field type has an $(DDSUBLINK spec/ operatoroverloading, assignment, `opAssign`)
732
734
method, it will not be used for initialization.)
733
735
734
736
$(SPEC_RUNNABLE_EXAMPLE_COMPILE
@@ -1549,14 +1551,14 @@ $(GNAME Invariant):
1549
1551
$(P Struct $(I Invariant)s must hold
1550
1552
at the entry and exit of all public or exported non-static member functions.
1551
1553
The order of application of invariants is:
1554
+ )
1552
1555
$(OL
1553
1556
$(LI preconditions)
1554
1557
$(LI invariant)
1555
1558
$(LI function body)
1556
1559
$(LI invariant)
1557
1560
$(LI postconditions)
1558
1561
)
1559
- )
1560
1562
1561
1563
$(P The invariant need not hold if the struct instance is implicitly constructed using
1562
1564
the default $(D .init) value.)
@@ -1666,8 +1668,8 @@ $(H2 $(LEGACY_LNAME2 AssignOverload, assign-overload, Identity Assignment Overlo
1666
1668
these conditions hold:)
1667
1669
1668
1670
$(UL
1669
- $(LI it has a $(LINK2 # struct-destructor, destructor))
1670
- $(LI it has a $(LINK2 # struct-postblit, postblit))
1671
+ $(LI it has a $(RELATIVE_LINK2 struct-destructor, destructor))
1672
+ $(LI it has a $(RELATIVE_LINK2 struct-postblit, postblit))
1671
1673
$(LI it has a field with an identity assignment overload)
1672
1674
)
1673
1675
0 commit comments