From Jason Turner

[meta.unary.prop]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmpfhs0s2id/{from.md → to.md} +64 -26
tmp/tmpfhs0s2id/{from.md → to.md} RENAMED
@@ -4,64 +4,102 @@ These templates provide access to some of the more important properties
4
  of types.
5
 
6
  It is unspecified whether the library defines any full or partial
7
  specializations of any of these templates.
8
 
9
- For all of the class templates `X` declared in this Clause,
10
  instantiating that template with a template-argument that is a class
11
  template specialization may result in the implicit instantiation of the
12
  template argument if and only if the semantics of `X` require that the
13
  argument must be a complete type.
14
 
 
 
 
 
 
 
 
 
 
 
 
 
15
  ``` cpp
16
- is_const<const volatile int>::value // true
17
- is_const<const int*>::value // false
18
- is_const<const int&>::value // false
19
- is_const<int[3]>::value // false
20
- is_const<const int[3]>::value // true
21
  ```
22
 
 
 
 
 
23
  ``` cpp
24
  remove_const_t<const volatile int> // volatile int
25
  remove_const_t<const int* const> // const int*
26
  remove_const_t<const int&> // const int&
27
  remove_const_t<const int[3]> // int[3]
28
  ```
29
 
 
 
 
 
30
  ``` cpp
31
  // Given:
32
  struct P final { };
33
  union U1 { };
34
  union U2 final { };
35
 
36
  // the following assertions hold:
37
- static_assert(!is_final<int>::value, "Error!");
38
- static_assert( is_final<P>::value, "Error!");
39
- static_assert(!is_final<U1>::value, "Error!");
40
- static_assert( is_final<U2>::value, "Error!");
41
  ```
42
 
43
- Given the following function prototype:
44
 
45
- ``` cpp
46
- template <class T>
47
- add_rvalue_reference_t<T> create() noexcept;
48
- ```
49
-
50
- the predicate condition for a template specialization
51
  `is_constructible<T, Args...>` shall be satisfied if and only if the
52
  following variable definition would be well-formed for some invented
53
  variable `t`:
54
 
55
  ``` cpp
56
- T t(create<Args>()...);
57
  ```
58
 
59
- These tokens are never interpreted as a function declaration. Access
60
- checking is performed as if in a context unrelated to `T` and any of the
61
- `Args`. Only the validity of the immediate context of the variable
62
- initialization is considered. The evaluation of the initialization can
63
- result in side effects such as the instantiation of class template
64
- specializations and function template specializations, the generation of
65
- implicitly-defined functions, and so on. Such side effects are not in
66
- the “immediate context” and can result in the program being ill-formed.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
67
 
 
4
  of types.
5
 
6
  It is unspecified whether the library defines any full or partial
7
  specializations of any of these templates.
8
 
9
+ For all of the class templates `X` declared in this subclause,
10
  instantiating that template with a template-argument that is a class
11
  template specialization may result in the implicit instantiation of the
12
  template argument if and only if the semantics of `X` require that the
13
  argument must be a complete type.
14
 
15
+ For the purpose of defining the templates in this subclause, a function
16
+ call expression `declval<T>()` for any type `T` is considered to be a
17
+ trivial ([[basic.types]], [[special]]) function call that is not an
18
+ odr-use ([[basic.def.odr]]) of `declval` in the context of the
19
+ corresponding definition notwithstanding the restrictions of 
20
+ [[declval]].
21
+
22
+ [*Note 1*: A union is a class type that can be marked with
23
+ `final`. — *end note*]
24
+
25
+ [*Example 1*:
26
+
27
  ``` cpp
28
+ is_const_v<const volatile int> // true
29
+ is_const_v<const int*> // false
30
+ is_const_v<const int&> // false
31
+ is_const_v<int[3]> // false
32
+ is_const_v<const int[3]> // true
33
  ```
34
 
35
+ — *end example*]
36
+
37
+ [*Example 2*:
38
+
39
  ``` cpp
40
  remove_const_t<const volatile int> // volatile int
41
  remove_const_t<const int* const> // const int*
42
  remove_const_t<const int&> // const int&
43
  remove_const_t<const int[3]> // int[3]
44
  ```
45
 
46
+ — *end example*]
47
+
48
+ [*Example 3*:
49
+
50
  ``` cpp
51
  // Given:
52
  struct P final { };
53
  union U1 { };
54
  union U2 final { };
55
 
56
  // the following assertions hold:
57
+ static_assert(!is_final_v<int>);
58
+ static_assert(is_final_v<P>);
59
+ static_assert(!is_final_v<U1>);
60
+ static_assert(is_final_v<U2>);
61
  ```
62
 
63
+ *end example*]
64
 
65
+ The predicate condition for a template specialization
 
 
 
 
 
66
  `is_constructible<T, Args...>` shall be satisfied if and only if the
67
  following variable definition would be well-formed for some invented
68
  variable `t`:
69
 
70
  ``` cpp
71
+ T t(declval<Args>()...);
72
  ```
73
 
74
+ [*Note 2*: These tokens are never interpreted as a function
75
+ declaration. *end note*]
76
+
77
+ Access checking is performed as if in a context unrelated to `T` and any
78
+ of the `Args`. Only the validity of the immediate context of the
79
+ variable initialization is considered.
80
+
81
+ [*Note 3*: The evaluation of the initialization can result in side
82
+ effects such as the instantiation of class template specializations and
83
+ function template specializations, the generation of implicitly-defined
84
+ functions, and so on. Such side effects are not in the “immediate
85
+ context” and can result in the program being ill-formed. — *end note*]
86
+
87
+ The predicate condition for a template specialization
88
+ `has_unique_object_representations<T>` shall be satisfied if and only
89
+ if:
90
+
91
+ - `T` is trivially copyable, and
92
+ - any two objects of type `T` with the same value have the same object
93
+ representation, where two objects of array or non-union class type are
94
+ considered to have the same value if their respective sequences of
95
+ direct subobjects have the same values, and two objects of union type
96
+ are considered to have the same value if they have the same active
97
+ member and the corresponding members have the same value.
98
+
99
+ The set of scalar types for which this condition holds is
100
+ *implementation-defined*.
101
+
102
+ [*Note 4*: If a type has padding bits, the condition does not hold;
103
+ otherwise, the condition holds true for unsigned integral
104
+ types. — *end note*]
105