From Jason Turner

[meta.reflection.layout]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmpl4_cwvef/{from.md → to.md} +108 -0
tmp/tmpl4_cwvef/{from.md → to.md} RENAMED
@@ -0,0 +1,108 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ### Reflection layout queries <a id="meta.reflection.layout">[[meta.reflection.layout]]</a>
2
+
3
+ ``` cpp
4
+ struct member_offset {
5
+ ptrdiff_t bytes;
6
+ ptrdiff_t bits;
7
+ constexpr ptrdiff_t total_bits() const;
8
+ auto operator<=>(const member_offset&) const = default;
9
+ };
10
+
11
+ constexpr ptrdiff_t member_offset::total_bits() const;
12
+ ```
13
+
14
+ *Returns:* `bytes * CHAR_BIT + bits`.
15
+
16
+ ``` cpp
17
+ consteval member_offset offset_of(info r);
18
+ ```
19
+
20
+ Let V be the offset in bits from the beginning of a complete object of
21
+ the type represented by `parent_of(r)` to the subobject associated with
22
+ the construct represented by `r`.
23
+
24
+ *Returns:* `{`V` / CHAR_BIT, `V` % CHAR_BIT}`.
25
+
26
+ *Throws:* `meta::exception` unless `r` represents a non-static data
27
+ member, unnamed bit-field, or direct base class relationship (D, B) for
28
+ which either B is not a virtual base class or D is not an abstract
29
+ class.
30
+
31
+ ``` cpp
32
+ consteval size_t size_of(info r);
33
+ ```
34
+
35
+ *Returns:* If
36
+
37
+ - `r` represents a non-static data member of type T or a data member
38
+ description (T, N, A, W, *NUA*) or
39
+ - `dealias(r)` represents a type T,
40
+
41
+ then `sizeof(`T`)` if T is not a reference type and
42
+ `size_of(add_pointer(``))` otherwise. Otherwise, `size_of(type_of(r))`.
43
+
44
+ [*Note 1*: It is possible that while `sizeof(char) == size_of(``)` is
45
+ `true`, that `sizeof(char&) == size_of(``&)` is `false`. If `b`
46
+ represents a direct base class relationship of an empty base class, then
47
+ `size_of(b) > 0` is `true`. — *end note*]
48
+
49
+ *Throws:* `meta::exception` unless all of the following conditions are
50
+ met:
51
+
52
+ - `dealias(r)` is a reflection of a type, object, value, variable of
53
+ non-reference type, non-static data member that is not a bit-field,
54
+ direct base class relationship, or data member description
55
+ (T, N, A, W, *NUA*)[[class.mem.general]] where W is $\bot$.
56
+ - If `dealias(r)` represents a type, then `is_complete_type(r)` is
57
+ `true`.
58
+
59
+ ``` cpp
60
+ consteval size_t alignment_of(info r);
61
+ ```
62
+
63
+ *Returns:*
64
+
65
+ - If `dealias(r)` represents a type T, then
66
+ `alignment_of(add_pointer(r))` if T is a reference type and the
67
+ alignment requirement of T otherwise.
68
+ - Otherwise, if `dealias(r)` represents a variable or object, then the
69
+ alignment requirement of the variable or object.
70
+ - Otherwise, if `r` represents a direct base class relationship, then
71
+ `alignment_of(type_of(r))`.
72
+ - Otherwise, if `r` represents a non-static data member M of a class C,
73
+ then the alignment of the direct member subobject corresponding to M
74
+ of a complete object of type C.
75
+ - Otherwise, `r` represents a data member description
76
+ (T, N, A, W, *NUA*)[[class.mem.general]]. If A is not $\bot$, then the
77
+ value A. Otherwise, `alignment_of(``)`.
78
+
79
+ *Throws:* `meta::exception` unless all of the following conditions are
80
+ met:
81
+
82
+ - `dealias(r)` is a reflection of a type, object, variable of
83
+ non-reference type, non-static data member that is not a bit-field,
84
+ direct base class relationship, or data member description.
85
+ - If `dealias(r)` represents a type, then `is_complete_type(r)` is
86
+ `true`.
87
+
88
+ ``` cpp
89
+ consteval size_t bit_size_of(info r);
90
+ ```
91
+
92
+ *Returns:*
93
+
94
+ - If `r` represents an unnamed bit-field or a non-static data member
95
+ that is a bit-field with width W, then W.
96
+ - Otherwise, if `r` represents a data member description
97
+ (T, N, A, W, *NUA*)[[class.mem.general]] and W is not $\bot$, then W.
98
+ - Otherwise, `CHAR_BIT * size_of(r)`.
99
+
100
+ *Throws:* `meta::exception` unless all of the following conditions are
101
+ met:
102
+
103
+ - `dealias(r)` is a reflection of a type, object, value, variable of
104
+ non-reference type, non-static data member, unnamed bit-field, direct
105
+ base class relationship, or data member description.
106
+ - If `dealias(r)` represents a type, then `is_complete_type(r)` is
107
+ `true`.
108
+