From Jason Turner

[meta.unary.prop.query]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmppsol7rom/{from.md → to.md} +13 -13
tmp/tmppsol7rom/{from.md → to.md} RENAMED
@@ -1,35 +1,35 @@
1
  ### Type property queries <a id="meta.unary.prop.query">[[meta.unary.prop.query]]</a>
2
 
3
- This subclause contains templates that may be used to query properties
4
- of types at compile time.
5
 
6
  Each of these templates shall be a *Cpp17UnaryTypeTrait* [[meta.rqmts]]
7
  with a base characteristic of `integral_constant<size_t, Value>`.
8
 
9
  [*Example 1*:
10
 
11
  ``` cpp
12
  // the following assertions hold:
13
- assert(rank_v<int> == 0);
14
- assert(rank_v<int[2]> == 1);
15
- assert(rank_v<int[][4]> == 2);
16
  ```
17
 
18
  — *end example*]
19
 
20
  [*Example 2*:
21
 
22
  ``` cpp
23
  // the following assertions hold:
24
- assert(extent_v<int> == 0);
25
- assert(extent_v<int[2]> == 2);
26
- assert(extent_v<int[2][4]> == 2);
27
- assert(extent_v<int[][4]> == 0);
28
- assert((extent_v<int, 1>) == 0);
29
- assert((extent_v<int[2], 1>) == 0);
30
- assert((extent_v<int[2][4], 1>) == 4);
31
- assert((extent_v<int[][4], 1>) == 4);
32
  ```
33
 
34
  — *end example*]
35
 
 
1
  ### Type property queries <a id="meta.unary.prop.query">[[meta.unary.prop.query]]</a>
2
 
3
+ The templates specified in [[meta.unary.prop.query]] may be used to
4
+ query properties of types at compile time.
5
 
6
  Each of these templates shall be a *Cpp17UnaryTypeTrait* [[meta.rqmts]]
7
  with a base characteristic of `integral_constant<size_t, Value>`.
8
 
9
  [*Example 1*:
10
 
11
  ``` cpp
12
  // the following assertions hold:
13
+ static_assert(rank_v<int> == 0);
14
+ static_assert(rank_v<int[2]> == 1);
15
+ static_assert(rank_v<int[][4]> == 2);
16
  ```
17
 
18
  — *end example*]
19
 
20
  [*Example 2*:
21
 
22
  ``` cpp
23
  // the following assertions hold:
24
+ static_assert(extent_v<int> == 0);
25
+ static_assert(extent_v<int[2]> == 2);
26
+ static_assert(extent_v<int[2][4]> == 2);
27
+ static_assert(extent_v<int[][4]> == 0);
28
+ static_assert(extent_v<int, 1> == 0);
29
+ static_assert(extent_v<int[2], 1> == 0);
30
+ static_assert(extent_v<int[2][4], 1> == 4);
31
+ static_assert(extent_v<int[][4], 1> == 4);
32
  ```
33
 
34
  — *end example*]
35