From Jason Turner

[expr.sizeof]

Diff to HTML by rtfpessoa

tmp/tmpe45f0l19/{from.md → to.md} RENAMED
@@ -13,11 +13,11 @@ to any other fundamental type [[basic.fundamental]] is
13
 
14
  [*Note 1*:
15
 
16
  In particular, the values of `sizeof(bool)`, `sizeof(char16_t)`,
17
  `sizeof(char32_t)`, and `sizeof(wchar_t)` are
18
- implementation-defined.[^21]
19
 
20
  — *end note*]
21
 
22
  [*Note 2*: See  [[intro.memory]] for the definition of byte and 
23
  [[term.object.representation]] for the definition of object
@@ -26,39 +26,40 @@ representation. — *end note*]
26
  When applied to a reference type, the result is the size of the
27
  referenced type. When applied to a class, the result is the number of
28
  bytes in an object of that class including any padding required for
29
  placing objects of that type in an array. The result of applying
30
  `sizeof` to a potentially-overlapping subobject is the size of the type,
31
- not the size of the subobject.[^22]
32
 
33
  When applied to an array, the result is the total number of bytes in the
34
  array. This implies that the size of an array of n elements is n times
35
  the size of an element.
36
 
37
  The lvalue-to-rvalue [[conv.lval]], array-to-pointer [[conv.array]], and
38
  function-to-pointer [[conv.func]] standard conversions are not applied
39
  to the operand of `sizeof`. If the operand is a prvalue, the temporary
40
  materialization conversion [[conv.rval]] is applied.
41
 
42
- The identifier in a `sizeof...` expression shall name a pack. The
43
  `sizeof...` operator yields the number of elements in the pack
44
  [[temp.variadic]]. A `sizeof...` expression is a pack expansion
45
  [[temp.variadic]].
46
 
47
  [*Example 1*:
48
 
49
  ``` cpp
50
  template<class... Types>
51
  struct count {
52
- static const std::size_t value = sizeof...(Types);
53
  };
54
  ```
55
 
56
  — *end example*]
57
 
58
  The result of `sizeof` and `sizeof...` is a prvalue of type
59
  `std::size_t`.
60
 
61
  [*Note 3*: A `sizeof` expression is an integral constant expression
62
- [[expr.const]]. The type `std::size_t` is defined in the standard header
63
- `<cstddef>` [[cstddef.syn]], [[support.types.layout]]. — *end note*]
 
64
 
 
13
 
14
  [*Note 1*:
15
 
16
  In particular, the values of `sizeof(bool)`, `sizeof(char16_t)`,
17
  `sizeof(char32_t)`, and `sizeof(wchar_t)` are
18
+ implementation-defined.[^19]
19
 
20
  — *end note*]
21
 
22
  [*Note 2*: See  [[intro.memory]] for the definition of byte and 
23
  [[term.object.representation]] for the definition of object
 
26
  When applied to a reference type, the result is the size of the
27
  referenced type. When applied to a class, the result is the number of
28
  bytes in an object of that class including any padding required for
29
  placing objects of that type in an array. The result of applying
30
  `sizeof` to a potentially-overlapping subobject is the size of the type,
31
+ not the size of the subobject.[^20]
32
 
33
  When applied to an array, the result is the total number of bytes in the
34
  array. This implies that the size of an array of n elements is n times
35
  the size of an element.
36
 
37
  The lvalue-to-rvalue [[conv.lval]], array-to-pointer [[conv.array]], and
38
  function-to-pointer [[conv.func]] standard conversions are not applied
39
  to the operand of `sizeof`. If the operand is a prvalue, the temporary
40
  materialization conversion [[conv.rval]] is applied.
41
 
42
+ The *identifier* in a `sizeof...` expression shall name a pack. The
43
  `sizeof...` operator yields the number of elements in the pack
44
  [[temp.variadic]]. A `sizeof...` expression is a pack expansion
45
  [[temp.variadic]].
46
 
47
  [*Example 1*:
48
 
49
  ``` cpp
50
  template<class... Types>
51
  struct count {
52
+ static constexpr std::size_t value = sizeof...(Types);
53
  };
54
  ```
55
 
56
  — *end example*]
57
 
58
  The result of `sizeof` and `sizeof...` is a prvalue of type
59
  `std::size_t`.
60
 
61
  [*Note 3*: A `sizeof` expression is an integral constant expression
62
+ [[expr.const]]. The *typedef-name* `std::size_t` is declared in the
63
+ standard header `<cstddef>`
64
+ [[cstddef.syn]], [[support.types.layout]]. — *end note*]
65