From Jason Turner

[class.gslice]

Diff to HTML by rtfpessoa

tmp/tmpub7nns3v/{from.md → to.md} RENAMED
@@ -25,34 +25,40 @@ number to the number of strides, to a single index k. It is useful for
25
  building multidimensional array classes using the `valarray` template,
26
  which is one-dimensional. The set of one-dimensional index values
27
  specified by a `gslice` are $$k = s + \sum_j i_j d_j$$ where the
28
  multidimensional indices iⱼ range in value from 0 to lᵢⱼ - 1.
29
 
 
 
30
  The `gslice` specification
31
 
32
  ``` cpp
33
  start = 3
34
  length = {2, 4, 3}
35
  stride = {19, 4, 1}
36
  ```
37
 
38
  yields the sequence of one-dimensional indices
39
-
40
  $$k = 3 + (0, 1) \times 19 + (0, 1, 2, 3) \times 4 + (0, 1, 2) \times 1$$
41
-
42
  which are ordered as shown in the following table:
43
 
44
  That is, the highest-ordered index turns fastest.
45
 
 
 
46
  It is possible to have degenerate generalized slices in which an address
47
  is repeated.
48
 
 
 
49
  If the stride parameters in the previous example are changed to {1, 1,
50
  1}, the first few elements of the resulting sequence of indices will be
51
 
 
 
52
  If a degenerate slice is used as the argument to the non-`const` version
53
- of `operator[](const gslice&)`, the resulting behavior is undefined.
54
 
55
  #### `gslice` constructors <a id="gslice.cons">[[gslice.cons]]</a>
56
 
57
  ``` cpp
58
  gslice();
 
25
  building multidimensional array classes using the `valarray` template,
26
  which is one-dimensional. The set of one-dimensional index values
27
  specified by a `gslice` are $$k = s + \sum_j i_j d_j$$ where the
28
  multidimensional indices iⱼ range in value from 0 to lᵢⱼ - 1.
29
 
30
+ [*Example 1*:
31
+
32
  The `gslice` specification
33
 
34
  ``` cpp
35
  start = 3
36
  length = {2, 4, 3}
37
  stride = {19, 4, 1}
38
  ```
39
 
40
  yields the sequence of one-dimensional indices
 
41
  $$k = 3 + (0, 1) \times 19 + (0, 1, 2, 3) \times 4 + (0, 1, 2) \times 1$$
 
42
  which are ordered as shown in the following table:
43
 
44
  That is, the highest-ordered index turns fastest.
45
 
46
+ — *end example*]
47
+
48
  It is possible to have degenerate generalized slices in which an address
49
  is repeated.
50
 
51
+ [*Example 2*:
52
+
53
  If the stride parameters in the previous example are changed to {1, 1,
54
  1}, the first few elements of the resulting sequence of indices will be
55
 
56
+ — *end example*]
57
+
58
  If a degenerate slice is used as the argument to the non-`const` version
59
+ of `operator[](const gslice&)`, the behavior is undefined.
60
 
61
  #### `gslice` constructors <a id="gslice.cons">[[gslice.cons]]</a>
62
 
63
  ``` cpp
64
  gslice();