From Jason Turner

[class.slice]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmpjqh4v5lr/{from.md → to.md} +18 -4
tmp/tmpjqh4v5lr/{from.md → to.md} RENAMED
@@ -1,8 +1,8 @@
1
  ### Class `slice` <a id="class.slice">[[class.slice]]</a>
2
 
3
- #### Class `slice` overview <a id="class.slice.overview">[[class.slice.overview]]</a>
4
 
5
  ``` cpp
6
  namespace std {
7
  class slice {
8
  public:
@@ -10,18 +10,20 @@ namespace std {
10
  slice(size_t, size_t, size_t);
11
 
12
  size_t start() const;
13
  size_t size() const;
14
  size_t stride() const;
 
 
15
  };
16
  }
17
  ```
18
 
19
  The `slice` class represents a BLAS-like slice from an array. Such a
20
  slice is specified by a starting index, a length, and a stride.[^12]
21
 
22
- #### `slice` constructors <a id="cons.slice">[[cons.slice]]</a>
23
 
24
  ``` cpp
25
  slice();
26
  slice(size_t start, size_t length, size_t stride);
27
  slice(const slice&);
@@ -31,13 +33,13 @@ The default constructor is equivalent to `slice(0, 0, 0)`. A default
31
  constructor is provided only to permit the declaration of arrays of
32
  slices. The constructor with arguments for a slice takes a start,
33
  length, and stride parameter.
34
 
35
  [*Example 1*: `slice(3, 8, 2)` constructs a slice which selects
36
- elements 3, 5, 7, ... 17 from an array. — *end example*]
37
 
38
- #### `slice` access functions <a id="slice.access">[[slice.access]]</a>
39
 
40
  ``` cpp
41
  size_t start() const;
42
  size_t size() const;
43
  size_t stride() const;
@@ -45,5 +47,17 @@ size_t stride() const;
45
 
46
  *Returns:* The start, length, or stride specified by a `slice` object.
47
 
48
  *Complexity:* Constant time.
49
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ### Class `slice` <a id="class.slice">[[class.slice]]</a>
2
 
3
+ #### Overview <a id="class.slice.overview">[[class.slice.overview]]</a>
4
 
5
  ``` cpp
6
  namespace std {
7
  class slice {
8
  public:
 
10
  slice(size_t, size_t, size_t);
11
 
12
  size_t start() const;
13
  size_t size() const;
14
  size_t stride() const;
15
+
16
+ friend bool operator==(const slice& x, const slice& y);
17
  };
18
  }
19
  ```
20
 
21
  The `slice` class represents a BLAS-like slice from an array. Such a
22
  slice is specified by a starting index, a length, and a stride.[^12]
23
 
24
+ #### Constructors <a id="cons.slice">[[cons.slice]]</a>
25
 
26
  ``` cpp
27
  slice();
28
  slice(size_t start, size_t length, size_t stride);
29
  slice(const slice&);
 
33
  constructor is provided only to permit the declaration of arrays of
34
  slices. The constructor with arguments for a slice takes a start,
35
  length, and stride parameter.
36
 
37
  [*Example 1*: `slice(3, 8, 2)` constructs a slice which selects
38
+ elements 3, 5, 7, …, 17 from an array. — *end example*]
39
 
40
+ #### Access functions <a id="slice.access">[[slice.access]]</a>
41
 
42
  ``` cpp
43
  size_t start() const;
44
  size_t size() const;
45
  size_t stride() const;
 
47
 
48
  *Returns:* The start, length, or stride specified by a `slice` object.
49
 
50
  *Complexity:* Constant time.
51
 
52
+ #### Operators <a id="slice.ops">[[slice.ops]]</a>
53
+
54
+ ``` cpp
55
+ friend bool operator==(const slice& x, const slice& y);
56
+ ```
57
+
58
+ *Effects:* Equivalent to:
59
+
60
+ ``` cpp
61
+ return x.start() == y.start() && x.size() == y.size() && x.stride() == y.stride();
62
+ ```
63
+