From Jason Turner

[meta.trans]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmp15re0k7t/{from.md → to.md} +17 -17
tmp/tmp15re0k7t/{from.md → to.md} RENAMED
@@ -14,22 +14,22 @@ Each of the templates in this subclause shall be a
14
 
15
  #### Array modifications <a id="meta.trans.arr">[[meta.trans.arr]]</a>
16
 
17
  ``` cpp
18
  // the following assertions hold:
19
- assert((is_same<remove_extent<int>::type, int>::value));
20
- assert((is_same<remove_extent<int[2]>::type, int>::value));
21
- assert((is_same<remove_extent<int[2][3]>::type, int[3]>::value));
22
- assert((is_same<remove_extent<int[][3]>::type, int[3]>::value));
23
  ```
24
 
25
  ``` cpp
26
  // the following assertions hold:
27
- assert((is_same<remove_all_extents<int>::type, int>::value));
28
- assert((is_same<remove_all_extents<int[2]>::type, int>::value));
29
- assert((is_same<remove_all_extents<int[2][3]>::type, int>::value));
30
- assert((is_same<remove_all_extents<int[][3]>::type, int>::value));
31
  ```
32
 
33
  #### Pointer modifications <a id="meta.trans.ptr">[[meta.trans.ptr]]</a>
34
 
35
  #### Other transformations <a id="meta.trans.other">[[meta.trans.other]]</a>
@@ -53,21 +53,21 @@ The nested typedef `common_type::type` shall be defined as follows:
53
  ``` cpp
54
  template <class ...T> struct common_type;
55
 
56
  template <class T>
57
  struct common_type<T> {
58
- typedef T type;
59
  };
60
 
61
  template <class T, class U>
62
  struct common_type<T, U> {
63
- typedef decltype(true ? declval<T>() : declval<U>()) type;
64
  };
65
 
66
  template <class T, class U, class... V>
67
  struct common_type<T, U, V...> {
68
- typedef typename common_type<typename common_type<T, U>::type, V...>::type type;
69
  };
70
  ```
71
 
72
  Given these definitions:
73
 
@@ -87,13 +87,13 @@ typedef char S::*PMD;
87
  ```
88
 
89
  the following assertions will hold:
90
 
91
  ``` cpp
92
- static_assert(is_same<result_of<S(int)>::type, short>::value, "Error!");
93
- static_assert(is_same<result_of<S&(unsigned char, int&)>::type, double>::value, "Error!");
94
- static_assert(is_same<result_of<PF1()>::type, bool>::value, "Error!");
95
- static_assert(is_same<result_of<PMF(unique_ptr<S>, int)>::type, void>::value, "Error!");
96
- static_assert(is_same<result_of<PMD(S)>::type, char&&>::value, "Error!");
97
- static_assert(is_same<result_of<PMD(const S*)>::type, const char&>::value, "Error!");
98
  ```
99
 
 
14
 
15
  #### Array modifications <a id="meta.trans.arr">[[meta.trans.arr]]</a>
16
 
17
  ``` cpp
18
  // the following assertions hold:
19
+ assert((is_same<remove_extent_t<int>, int>::value));
20
+ assert((is_same<remove_extent_t<int[2]>, int>::value));
21
+ assert((is_same<remove_extent_t<int[2][3]>, int[3]>::value));
22
+ assert((is_same<remove_extent_t<int[][3]>, int[3]>::value));
23
  ```
24
 
25
  ``` cpp
26
  // the following assertions hold:
27
+ assert((is_same<remove_all_extents_t<int>, int>::value));
28
+ assert((is_same<remove_all_extents_t<int[2]>, int>::value));
29
+ assert((is_same<remove_all_extents_t<int[2][3]>, int>::value));
30
+ assert((is_same<remove_all_extents_t<int[][3]>, int>::value));
31
  ```
32
 
33
  #### Pointer modifications <a id="meta.trans.ptr">[[meta.trans.ptr]]</a>
34
 
35
  #### Other transformations <a id="meta.trans.other">[[meta.trans.other]]</a>
 
53
  ``` cpp
54
  template <class ...T> struct common_type;
55
 
56
  template <class T>
57
  struct common_type<T> {
58
+ typedef decay_t<T> type;
59
  };
60
 
61
  template <class T, class U>
62
  struct common_type<T, U> {
63
+ typedef decay_t<decltype(true ? declval<T>() : declval<U>())> type;
64
  };
65
 
66
  template <class T, class U, class... V>
67
  struct common_type<T, U, V...> {
68
+ typedef common_type_t<common_type_t<T, U>, V...> type;
69
  };
70
  ```
71
 
72
  Given these definitions:
73
 
 
87
  ```
88
 
89
  the following assertions will hold:
90
 
91
  ``` cpp
92
+ static_assert(is_same<result_of_t<S(int)>, short>::value, "Error!");
93
+ static_assert(is_same<result_of_t<S&(unsigned char, int&)>, double>::value, "Error!");
94
+ static_assert(is_same<result_of_t<PF1()>, bool>::value, "Error!");
95
+ static_assert(is_same<result_of_t<PMF(unique_ptr<S>, int)>, void>::value, "Error!");
96
+ static_assert(is_same<result_of_t<PMD(S)>, char&&>::value, "Error!");
97
+ static_assert(is_same<result_of_t<PMD(const S*)>, const char&>::value, "Error!");
98
  ```
99