tmp/tmp2juqqldc/{from.md → to.md}
RENAMED
|
@@ -2,21 +2,23 @@
|
|
| 2 |
|
| 3 |
The `sizeof` operator yields the number of bytes in the object
|
| 4 |
representation of its operand. The operand is either an expression,
|
| 5 |
which is an unevaluated operand (Clause [[expr]]), or a parenthesized
|
| 6 |
*type-id*. The `sizeof` operator shall not be applied to an expression
|
| 7 |
-
that has function or incomplete type, to
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
*
|
| 14 |
-
`sizeof(
|
| 15 |
-
implementation-defined.[^16]
|
| 16 |
-
|
| 17 |
-
|
|
|
|
|
|
|
| 18 |
|
| 19 |
When applied to a reference or a reference type, the result is the size
|
| 20 |
of the referenced type. When applied to a class, the result is the
|
| 21 |
number of bytes in an object of that class including any padding
|
| 22 |
required for placing objects of that type in an array. The size of a
|
|
@@ -29,23 +31,31 @@ number of bytes in the array. This implies that the size of an array of
|
|
| 29 |
The `sizeof` operator can be applied to a pointer to a function, but
|
| 30 |
shall not be applied directly to a function.
|
| 31 |
|
| 32 |
The lvalue-to-rvalue ([[conv.lval]]), array-to-pointer (
|
| 33 |
[[conv.array]]), and function-to-pointer ([[conv.func]]) standard
|
| 34 |
-
conversions are not applied to the operand of `sizeof`.
|
|
|
|
|
|
|
| 35 |
|
| 36 |
The identifier in a `sizeof...` expression shall name a parameter pack.
|
| 37 |
The `sizeof...` operator yields the number of arguments provided for the
|
| 38 |
parameter pack *identifier*. A `sizeof...` expression is a pack
|
| 39 |
expansion ([[temp.variadic]]).
|
| 40 |
|
|
|
|
|
|
|
| 41 |
``` cpp
|
| 42 |
template<class... Types>
|
| 43 |
struct count {
|
| 44 |
static const std::size_t value = sizeof...(Types);
|
| 45 |
};
|
| 46 |
```
|
| 47 |
|
|
|
|
|
|
|
| 48 |
The result of `sizeof` and `sizeof...` is a constant of type
|
| 49 |
-
`std::size_t`.
|
| 50 |
-
|
|
|
|
|
|
|
| 51 |
|
|
|
|
| 2 |
|
| 3 |
The `sizeof` operator yields the number of bytes in the object
|
| 4 |
representation of its operand. The operand is either an expression,
|
| 5 |
which is an unevaluated operand (Clause [[expr]]), or a parenthesized
|
| 6 |
*type-id*. The `sizeof` operator shall not be applied to an expression
|
| 7 |
+
that has function or incomplete type, to the parenthesized name of such
|
| 8 |
+
types, or to a glvalue that designates a bit-field. `sizeof(char)`,
|
| 9 |
+
`sizeof(signed char)` and `sizeof(unsigned char)` are `1`. The result of
|
| 10 |
+
`sizeof` applied to any other fundamental type ([[basic.fundamental]])
|
| 11 |
+
is *implementation-defined*.
|
| 12 |
+
|
| 13 |
+
[*Note 1*: In particular, `sizeof(bool)`, `sizeof(char16_t)`,
|
| 14 |
+
`sizeof(char32_t)`, and `sizeof(wchar_t)` are
|
| 15 |
+
implementation-defined.[^16] — *end note*]
|
| 16 |
+
|
| 17 |
+
[*Note 2*: See [[intro.memory]] for the definition of *byte* and
|
| 18 |
+
[[basic.types]] for the definition of *object
|
| 19 |
+
representation*. — *end note*]
|
| 20 |
|
| 21 |
When applied to a reference or a reference type, the result is the size
|
| 22 |
of the referenced type. When applied to a class, the result is the
|
| 23 |
number of bytes in an object of that class including any padding
|
| 24 |
required for placing objects of that type in an array. The size of a
|
|
|
|
| 31 |
The `sizeof` operator can be applied to a pointer to a function, but
|
| 32 |
shall not be applied directly to a function.
|
| 33 |
|
| 34 |
The lvalue-to-rvalue ([[conv.lval]]), array-to-pointer (
|
| 35 |
[[conv.array]]), and function-to-pointer ([[conv.func]]) standard
|
| 36 |
+
conversions are not applied to the operand of `sizeof`. If the operand
|
| 37 |
+
is a prvalue, the temporary materialization conversion ([[conv.rval]])
|
| 38 |
+
is applied.
|
| 39 |
|
| 40 |
The identifier in a `sizeof...` expression shall name a parameter pack.
|
| 41 |
The `sizeof...` operator yields the number of arguments provided for the
|
| 42 |
parameter pack *identifier*. A `sizeof...` expression is a pack
|
| 43 |
expansion ([[temp.variadic]]).
|
| 44 |
|
| 45 |
+
[*Example 1*:
|
| 46 |
+
|
| 47 |
``` cpp
|
| 48 |
template<class... Types>
|
| 49 |
struct count {
|
| 50 |
static const std::size_t value = sizeof...(Types);
|
| 51 |
};
|
| 52 |
```
|
| 53 |
|
| 54 |
+
— *end example*]
|
| 55 |
+
|
| 56 |
The result of `sizeof` and `sizeof...` is a constant of type
|
| 57 |
+
`std::size_t`.
|
| 58 |
+
|
| 59 |
+
[*Note 3*: `std::size_t` is defined in the standard header
|
| 60 |
+
`<cstddef>` ([[cstddef.syn]], [[support.types.layout]]). — *end note*]
|
| 61 |
|