From Jason Turner

[basic.type.qualifier]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmpb6fmz4jc/{from.md → to.md} +28 -14
tmp/tmpb6fmz4jc/{from.md → to.md} RENAMED
@@ -3,12 +3,12 @@
3
  A type mentioned in  [[basic.fundamental]] and  [[basic.compound]] is a
4
  *cv-unqualified type*. Each type which is a cv-unqualified complete or
5
  incomplete object type or is `void` ([[basic.types]]) has three
6
  corresponding cv-qualified versions of its type: a *const-qualified*
7
  version, a *volatile-qualified* version, and a
8
- *const-volatile-qualified* version. The term *object type* (
9
- [[intro.object]]) includes the cv-qualifiers specified in the
10
  *decl-specifier-seq* ([[dcl.spec]]), *declarator* (Clause 
11
  [[dcl.decl]]), *type-id* ([[dcl.name]]), or *new-type-id* (
12
  [[expr.new]]) when the object is created.
13
 
14
  - A *const object* is an object of type `const T` or a non-mutable
@@ -20,16 +20,16 @@ version, a *volatile-qualified* version, and a
20
  volatile object, or a non-mutable volatile subobject of a const
21
  object.
22
 
23
  The cv-qualified or cv-unqualified versions of a type are distinct
24
  types; however, they shall have the same representation and alignment
25
- requirements ([[basic.align]]).[^29]
26
 
27
  A compound type ([[basic.compound]]) is not cv-qualified by the
28
  cv-qualifiers (if any) of the types from which it is compounded. Any
29
- cv-qualifiers applied to an array type affect the array element type,
30
- not the array type ([[dcl.array]]).
31
 
32
  See  [[dcl.fct]] and  [[class.this]] regarding function types that have
33
  *cv-qualifier*s.
34
 
35
  There is a partial ordering on cv-qualifiers, so that a type can be said
@@ -46,24 +46,38 @@ constitute this ordering.
46
  | no cv-qualifier | < | `const volatile` |
47
  | `const` | < | `const volatile` |
48
  | `volatile` | < | `const volatile` |
49
 
50
 
51
- In this International Standard, the notation *cv* (or *cv1*, *cv2*,
52
- etc.), used in the description of types, represents an arbitrary set of
53
  cv-qualifiers, i.e., one of {`const`}, {`volatile`}, {`const`,
54
- `volatile`}, or the empty set. Cv-qualifiers applied to an array type
55
- attach to the underlying element type, so the notation “*cv* `T`,” where
56
- `T` is an array type, refers to an array whose elements are
57
- so-qualified. An array type whose elements are cv-qualified is also
58
- considered to have the same cv-qualifications as its elements.
 
 
 
 
 
 
 
 
 
 
 
 
59
 
60
  ``` cpp
61
  typedef char CA[5];
62
  typedef const char CC;
63
  CC arr1[5] = { 0 };
64
  const CA arr2 = { 0 };
65
  ```
66
 
67
- The type of both `arr1` and `arr2` is “array of 5 `const char`,” and the
68
- array type is considered to be `const`-qualified.
 
 
69
 
 
3
  A type mentioned in  [[basic.fundamental]] and  [[basic.compound]] is a
4
  *cv-unqualified type*. Each type which is a cv-unqualified complete or
5
  incomplete object type or is `void` ([[basic.types]]) has three
6
  corresponding cv-qualified versions of its type: a *const-qualified*
7
  version, a *volatile-qualified* version, and a
8
+ *const-volatile-qualified* version. The type of an object (
9
+ [[intro.object]]) includes the *cv-qualifier*s specified in the
10
  *decl-specifier-seq* ([[dcl.spec]]), *declarator* (Clause 
11
  [[dcl.decl]]), *type-id* ([[dcl.name]]), or *new-type-id* (
12
  [[expr.new]]) when the object is created.
13
 
14
  - A *const object* is an object of type `const T` or a non-mutable
 
20
  volatile object, or a non-mutable volatile subobject of a const
21
  object.
22
 
23
  The cv-qualified or cv-unqualified versions of a type are distinct
24
  types; however, they shall have the same representation and alignment
25
+ requirements ([[basic.align]]).[^30]
26
 
27
  A compound type ([[basic.compound]]) is not cv-qualified by the
28
  cv-qualifiers (if any) of the types from which it is compounded. Any
29
+ cv-qualifiers applied to an array type affect the array element type (
30
+ [[dcl.array]]).
31
 
32
  See  [[dcl.fct]] and  [[class.this]] regarding function types that have
33
  *cv-qualifier*s.
34
 
35
  There is a partial ordering on cv-qualifiers, so that a type can be said
 
46
  | no cv-qualifier | < | `const volatile` |
47
  | `const` | < | `const volatile` |
48
  | `volatile` | < | `const volatile` |
49
 
50
 
51
+ In this International Standard, the notation cv (or *cv1*, *cv2*, etc.),
52
+ used in the description of types, represents an arbitrary set of
53
  cv-qualifiers, i.e., one of {`const`}, {`volatile`}, {`const`,
54
+ `volatile`}, or the empty set. For a type cv `T`, the *top-level
55
+ cv-qualifiers* of that type are those denoted by cv.
56
+
57
+ [*Example 1*: The type corresponding to the *type-id* `const int&` has
58
+ no top-level cv-qualifiers. The type corresponding to the *type-id*
59
+ `volatile int * const` has the top-level cv-qualifier `const`. For a
60
+ class type `C`, the type corresponding to the *type-id*
61
+ `void (C::* volatile)(int) const` has the top-level cv-qualifier
62
+ `volatile`. — *end example*]
63
+
64
+ Cv-qualifiers applied to an array type attach to the underlying element
65
+ type, so the notation “cv `T`”, where `T` is an array type, refers to an
66
+ array whose elements are so-qualified. An array type whose elements are
67
+ cv-qualified is also considered to have the same cv-qualifications as
68
+ its elements.
69
+
70
+ [*Example 2*:
71
 
72
  ``` cpp
73
  typedef char CA[5];
74
  typedef const char CC;
75
  CC arr1[5] = { 0 };
76
  const CA arr2 = { 0 };
77
  ```
78
 
79
+ The type of both `arr1` and `arr2` is “array of 5 `const char`”, and the
80
+ array type is considered to be const-qualified.
81
+
82
+ — *end example*]
83