11
11
12
12
== Introduction
13
13
14
- The `circular::array <T, N>` template class is a fixed-size double-ended circular queue.
14
+ The `circular_array <T, N>` template class is a fixed-size double-ended circular queue.
15
15
16
16
The circular array has a _fixed size_, which means there can be at most `N` elements
17
17
in the circular array, where `N` is determined at compile-time. Like `std::array<T, N>`,
@@ -25,8 +25,8 @@ elements.
25
25
26
26
=== Running Average
27
27
28
- In the <<span .adoc#span- tutorial,circular span tutorial>> we ended up with a class
29
- definition for a running average containing both an array and a span .
28
+ In the <<circular_view .adoc#tutorial,circular view tutorial>> we ended up with a class
29
+ definition for a running average containing both an array and a view .
30
30
[source,c++,numbered]
31
31
----
32
32
template <typename T, std::size_t N>
@@ -42,12 +42,12 @@ private:
42
42
value_type sum = {};
43
43
// Storage and window
44
44
value_type storage[N];
45
- circular::span <value_type, N> window;
45
+ circular_view <value_type, N> window;
46
46
};
47
47
----
48
- Combining a fixed-size storage with a circular span is exactly the purpose of
49
- the circular array, so we can replace the storage and span with
50
- `circular::array <T, N>`.
48
+ Combining a fixed-size storage with a circular view is exactly the purpose of
49
+ the circular array, so we can replace the storage and view with
50
+ `circular_array <T, N>`.
51
51
[source,c++,numbered]
52
52
----
53
53
template <typename T, std::size_t N>
@@ -62,15 +62,15 @@ private:
62
62
static_assert(N > 0, "N must be greater than zero");
63
63
value_type sum = {};
64
64
// Window contains storage
65
- circular::array <value_type, N> window;
65
+ circular_array <value_type, N> window;
66
66
};
67
67
----
68
68
69
69
== Design Rationale
70
70
71
71
This section describes the choices behind the design of the circular array.
72
72
73
- The <<span .adoc#span- rationale,design rationale>> of `circular::span <T, N>` also applies,
73
+ The <<circular_view .adoc#rationale,design rationale>> of `circular_view <T, N>` also applies,
74
74
except the ability to use `dynamic_extent`.
75
75
76
76
=== std::array
@@ -92,15 +92,15 @@ There are some significant deviations.
92
92
93
93
== Reference
94
94
95
- Defined in header `<vista/circular/array .hpp>`.
95
+ Defined in header `<vista/circular_array .hpp>`.
96
96
97
- Defined in namespace `vista::circular `.
97
+ Defined in namespace `vista`.
98
98
[source,c++]
99
99
----
100
100
template <
101
101
typename T,
102
102
std::size_t N
103
- > class array ;
103
+ > class circular_array ;
104
104
----
105
105
106
106
The circular array is a fixed-size circular queue.
@@ -131,7 +131,7 @@ are inserted or destroyed when the circular array is destroyed.
131
131
_Constraint:_ `T` must be _DefaultConstructible_.
132
132
+
133
133
_Constraint:_ `T` must be _Erasable_.
134
- | `N` | The maximum number of elements in the span .
134
+ | `N` | The maximum number of elements in the array .
135
135
+
136
136
+
137
137
_Constraint:_ `N` cannot be `dynamic_extent`.
@@ -160,7 +160,7 @@ are inserted or destroyed when the circular array is destroyed.
160
160
[%header,frame="topbot",grid="rows",stripes=none]
161
161
|===
162
162
| Member function | Description
163
- | `constexpr array () noexcept` | Creates an empty circular array.
163
+ | `constexpr circular_array () noexcept` | Creates an empty circular array.
164
164
+
165
165
+
166
166
The `N` elements of the underlying storage are default constructed.
@@ -169,7 +169,7 @@ are inserted or destroyed when the circular array is destroyed.
169
169
_Ensures:_ `capacity() == N`
170
170
+
171
171
_Ensures:_ `size() == 0`
172
- | `constexpr array (const array <T, N>& other) noexcept(_see Remarks_)` | Creates a circular array by copying.
172
+ | `constexpr circular_array (const circular_array <T, N>& other) noexcept(_see Remarks_)` | Creates a circular array by copying.
173
173
+
174
174
+
175
175
_Constraint:_ `T` must be _CopyConstructible_.
@@ -181,7 +181,7 @@ are inserted or destroyed when the circular array is destroyed.
181
181
+
182
182
+
183
183
_Remarks:_ `noexcept` if `value_type` is nothrow _CopyConstructible_.
184
- | `constexpr array(array <T, N>&& other) noexcept(_see Remarks_)` | Creates a circular array by moving.
184
+ | `constexpr circular_array(circular_array <T, N>&& other) noexcept(_see Remarks_)` | Creates a circular array by moving.
185
185
+
186
186
+
187
187
_Constraint:_ `T` must be _MoveConstructible_.
@@ -195,7 +195,7 @@ are inserted or destroyed when the circular array is destroyed.
195
195
_Remarks:_ `noexcept` if `value_type` is nothrow _MoveConstructible_.
196
196
| `template <typename... Args>
197
197
+
198
- constexpr array (value_type, Args&&...) noexcept(_see Remarks_)` | Creates a circular array with elements from input.
198
+ constexpr circular_array (value_type, Args&&...) noexcept(_see Remarks_)` | Creates a circular array with elements from input.
199
199
+
200
200
+
201
201
This constructor emulates aggregate initialization.
@@ -207,7 +207,7 @@ are inserted or destroyed when the circular array is destroyed.
207
207
+
208
208
+
209
209
_Remarks:_ `noexcept` if `value_type` is nothrow _MoveAssignable_.
210
- | `constexpr{wj}footnote:constexpr11[Not constexpr in pass:[C++11].] array & operator=(const array <T, N>& other) noexcept(_see Remarks_)` | Recreates circular array by copying.
210
+ | `constexpr{wj}footnote:constexpr11[Not constexpr in pass:[C++11].] circular_array & operator=(const circular_array <T, N>& other) noexcept(_see Remarks_)` | Recreates circular array by copying.
211
211
+
212
212
+
213
213
_Constraint:_ `T` must be _CopyAssignable_.
@@ -219,7 +219,7 @@ are inserted or destroyed when the circular array is destroyed.
219
219
+
220
220
+
221
221
_Remarks:_ `noexcept` if `value_type` is nothrow _CopyAssignable_.
222
- | `constexpr{wj}footnote:constexpr11[] array & operator=(array && other) noexcept(_see Remarks_)` | Recreates circular array by moving.
222
+ | `constexpr{wj}footnote:constexpr11[] circular_array & operator=(circular_array && other) noexcept(_see Remarks_)` | Recreates circular array by moving.
223
223
+
224
224
+
225
225
All elements are inserted, but if `input.size() > N` then only the last `N` input
@@ -232,7 +232,7 @@ are inserted or destroyed when the circular array is destroyed.
232
232
+
233
233
+
234
234
_Remarks:_ `noexcept` if `value_type` is nothrow _MoveAssignable_.
235
- | `constexpr{wj}footnote:constexpr11[] array & operator=(std::initializer_list<value_type> input) noexcept(_see Remarks_)` | Recreates circular array with elements from initializer list.
235
+ | `constexpr{wj}footnote:constexpr11[] circular_circular_array & operator=(std::initializer_list<value_type> input) noexcept(_see Remarks_)` | Recreates circular array with elements from initializer list.
236
236
+
237
237
+
238
238
All elements are inserted, but if `input.size() > N` then only the last `N` input
0 commit comments