@@ -50,43 +50,37 @@ class zip_iterator {
50
50
*
51
51
* @param iterators The iterators to be zipped together.
52
52
*/
53
- explicit zip_iterator (Iterators... iterators) noexcept : iterators_{iterators...} {}
53
+ explicit zip_iterator (Iterators... iterators) : iterators_{iterators...} {}
54
54
55
55
/* *
56
56
* @brief Dereferences the `zip_iterator` to obtain a tuple of references from each iterator.
57
57
*
58
58
* @return A tuple containing the values pointed to by each iterator.
59
59
*/
60
- value_type operator *() const noexcept { return dereference (std::index_sequence_for<Iterators...>{}); }
60
+ value_type operator *() const { return dereference (std::index_sequence_for<Iterators...>{}); }
61
61
62
62
/* *
63
63
* @brief Checks if two `zip_iterator` instances are equal.
64
64
*
65
65
* @param other The other `zip_iterator` to compare with.
66
66
* @return `true` if the iterators are equal, `false` otherwise.
67
67
*/
68
- bool operator ==(const zip_iterator& other) const noexcept
69
- {
70
- return equal (std::index_sequence_for<Iterators...>{}, other);
71
- }
68
+ bool operator ==(const zip_iterator& other) const { return equal (std::index_sequence_for<Iterators...>{}, other); }
72
69
73
70
/* *
74
71
* @brief Checks if two `zip_iterator` instances are not equal.
75
72
*
76
73
* @param other The other `zip_iterator` to compare with.
77
74
* @return `true` if the iterators are not equal, `false` otherwise.
78
75
*/
79
- bool operator !=(const zip_iterator& other) const noexcept
80
- {
81
- return !equal (std::index_sequence_for<Iterators...>{}, other);
82
- }
76
+ bool operator !=(const zip_iterator& other) const { return !equal (std::index_sequence_for<Iterators...>{}, other); }
83
77
84
78
/* *
85
79
* @brief Advances the `zip_iterator` by one position.
86
80
*
87
81
* @return A reference to the updated `zip_iterator`.
88
82
*/
89
- zip_iterator& operator ++() noexcept
83
+ zip_iterator& operator ++()
90
84
{
91
85
advance (std::index_sequence_for<Iterators...>{}, 1 );
92
86
return *this ;
@@ -98,7 +92,7 @@ class zip_iterator {
98
92
* @param offset The number of positions to advance.
99
93
* @return A new `zip_iterator` advanced by the specified offset.
100
94
*/
101
- zip_iterator operator +(const std::size_t offset) const noexcept
95
+ zip_iterator operator +(const std::size_t offset) const
102
96
{
103
97
auto iterator = *this ;
104
98
iterator.advance (std::index_sequence_for<Iterators...>{}, offset);
@@ -111,7 +105,7 @@ class zip_iterator {
111
105
* @param other The `zip_iterator` to measure the distance to.
112
106
* @return A new `zip_iterator` advanced by the distance to the specified iterator.
113
107
*/
114
- zip_iterator operator +(const zip_iterator& other) const noexcept
108
+ zip_iterator operator +(const zip_iterator& other) const
115
109
{
116
110
auto iterator = *this ;
117
111
const auto distance = std::distance (iterator, other);
@@ -124,7 +118,7 @@ class zip_iterator {
124
118
*
125
119
* @return A reference to the updated `zip_iterator`.
126
120
*/
127
- zip_iterator& operator --() noexcept
121
+ zip_iterator& operator --()
128
122
{
129
123
advance (std::index_sequence_for<Iterators...>{}, -1 );
130
124
return *this ;
@@ -136,7 +130,7 @@ class zip_iterator {
136
130
* @param offset The number of positions to move back.
137
131
* @return A new `zip_iterator` moved back by the specified offset.
138
132
*/
139
- zip_iterator operator -(const int offset) const noexcept
133
+ zip_iterator operator -(const int offset) const
140
134
{
141
135
auto iterator = *this ;
142
136
iterator.advance (std::index_sequence_for<Iterators...>{}, -offset);
@@ -149,7 +143,7 @@ class zip_iterator {
149
143
* @param other The `zip_iterator` to measure the distance from.
150
144
* @return A new `zip_iterator` moved back by the distance to the specified iterator.
151
145
*/
152
- zip_iterator operator -(const zip_iterator& other) const noexcept
146
+ zip_iterator operator -(const zip_iterator& other) const
153
147
{
154
148
auto iterator = *this ;
155
149
const auto distance = std::distance (other, iterator);
@@ -166,7 +160,7 @@ class zip_iterator {
166
160
* @return A tuple containing the values pointed to by each iterator.
167
161
*/
168
162
template <std::size_t ... I>
169
- value_type dereference (std::index_sequence<I...>) const noexcept
163
+ value_type dereference (std::index_sequence<I...>) const
170
164
{
171
165
return std::tie (*std::get<I>(iterators_)...);
172
166
}
@@ -180,7 +174,7 @@ class zip_iterator {
180
174
* @return `true` if all iterators are equal, `false` otherwise.
181
175
*/
182
176
template <std::size_t ... I>
183
- bool equal (std::index_sequence<I...>, const zip_iterator& other) const noexcept
177
+ bool equal (std::index_sequence<I...>, const zip_iterator& other) const
184
178
{
185
179
return ((std::get<I>(iterators_) == std::get<I>(other.iterators_ )) || ...);
186
180
}
@@ -193,7 +187,7 @@ class zip_iterator {
193
187
* @param offset The number of positions to advance.
194
188
*/
195
189
template <std::size_t ... I>
196
- void advance (std::index_sequence<I...>, const int offset) noexcept
190
+ void advance (std::index_sequence<I...>, const int offset)
197
191
{
198
192
((std::advance (std::get<I>(iterators_), offset)), ...);
199
193
}
@@ -208,6 +202,8 @@ class zip_iterator {
208
202
* @brief A view over multiple containers simultaneously.
209
203
* It allows iterating through multiple containers at once, stopping at the shortest container.
210
204
*
205
+ * @note The zip never throws explicitly any exception. It all depends on what the given containers throw.
206
+ *
211
207
* @tparam Containers The types of the containers to be zipped.
212
208
* Each container must support standard iteration
213
209
* (must have `begin()`, `end()`, `cbegin()`, and `cend()` methods).
@@ -245,7 +241,7 @@ class zip {
245
241
* @param containers The containers to be zipped together.
246
242
* @pre At least two containers must be provided.
247
243
*/
248
- explicit zip (Containers&... containers) noexcept : containers_{containers...} {}
244
+ explicit zip (Containers&... containers) : containers_{containers...} {}
249
245
250
246
/* *
251
247
* @brief Returns an iterator pointing to the beginning of the zipped containers.
@@ -287,7 +283,7 @@ class zip {
287
283
*
288
284
* @return `true` if the zipped sequence is empty, `false` otherwise.
289
285
*/
290
- [[nodiscard]] bool empty () const noexcept { return begin () == end (); }
286
+ [[nodiscard]] bool empty () const { return begin () == end (); }
291
287
292
288
/* *
293
289
* @brief Allows the `zip` object to be used in a boolean context, indicating whether the zipped sequence is
@@ -368,7 +364,7 @@ class zip {
368
364
* @return An iterator to the beginning of the zipped sequence.
369
365
*/
370
366
template <typename Iterator, std::size_t ... I>
371
- Iterator begin_impl (std::index_sequence<I...>) const noexcept
367
+ Iterator begin_impl (std::index_sequence<I...>) const
372
368
{
373
369
return Iterator{std::get<I>(containers_).begin ()...};
374
370
}
@@ -382,7 +378,7 @@ class zip {
382
378
* @return An iterator to the end of the zipped sequence.
383
379
*/
384
380
template <typename Iterator, std::size_t ... I>
385
- Iterator end_impl (std::index_sequence<I...>) const noexcept
381
+ Iterator end_impl (std::index_sequence<I...>) const
386
382
{
387
383
return std::next (Iterator{std::get<I>(containers_).begin ()...}, size ());
388
384
}
0 commit comments