@@ -32,6 +32,9 @@ struct mir_series
32
32
using Index = typename std::remove_reference<decltype(_index[0 ])>::type;
33
33
// / Data / Value type aliases
34
34
using Data = typename std::remove_reference<decltype(_data._iterator[0 ])>::type;
35
+
36
+ using UnqualIndex = typename std::remove_all_extents<Index>::type;
37
+ using UnqualData = typename std::remove_all_extents<Data>::type;
35
38
36
39
using Observation = std::pair<Index, Data>;
37
40
// using ConstObservation = std::pair<const Index, const Data>;
@@ -92,8 +95,7 @@ struct mir_series
92
95
return { {{b - a}, _data._iterator }, std::move (newIndex) };
93
96
}
94
97
95
- template <class T >
96
- size_t transition_index_less (const T& val) const
98
+ size_t transition_index_less (const Index& val) const
97
99
{
98
100
size_t first = 0 , count = size ();
99
101
while (count > 0 )
@@ -112,8 +114,7 @@ struct mir_series
112
114
return first;
113
115
}
114
116
115
- template <class T >
116
- size_t transition_index_less_or_equal (const T& val) const
117
+ size_t transition_index_less_or_equal (const Index& val) const
117
118
{
118
119
size_t first = 0 , count = size ();
119
120
while (count > 0 )
@@ -132,15 +133,13 @@ struct mir_series
132
133
return first;
133
134
}
134
135
135
- template <class T >
136
- bool contains (const T& key) const
136
+ bool contains (const Index& key) const
137
137
{
138
138
size_t idx = transition_index_less (key);
139
139
return idx < _data._lengths [0 ] && _index[idx] == key;
140
140
}
141
141
142
- template <class T , class Value >
143
- bool try_get (const T& key, Value& val) const
142
+ bool try_get (const Index& key, UnqualData& val) const
144
143
{
145
144
size_t idx = transition_index_less (key);
146
145
auto cond = idx < _data._lengths [0 ] && _index[idx] == key;
@@ -149,8 +148,7 @@ struct mir_series
149
148
return cond;
150
149
}
151
150
152
- template <class T >
153
- const Data* try_get_ptr (const T& key) const
151
+ const Data* try_get_ptr (const Index& key) const
154
152
{
155
153
size_t idx = transition_index_less (key);
156
154
auto cond = idx < _data._lengths [0 ] && _index[idx] == key;
@@ -159,8 +157,7 @@ struct mir_series
159
157
return nullptr ;
160
158
}
161
159
162
- template <class T >
163
- auto && get(const T& key)
160
+ auto && get(const Index& key)
164
161
{
165
162
size_t idx = transition_index_less (key);
166
163
auto cond = idx < _data._lengths [0 ] && _index[idx] == key;
@@ -169,8 +166,7 @@ struct mir_series
169
166
throw std::out_of_range (" series::get: key not found" );
170
167
}
171
168
172
- template <class T >
173
- auto && get(const T& key) const
169
+ auto && get(const Index& key) const
174
170
{
175
171
size_t idx = transition_index_less (key);
176
172
auto cond = idx < _data._lengths [0 ] && _index[idx] == key;
@@ -179,8 +175,7 @@ struct mir_series
179
175
throw std::out_of_range (" series::get: key not found" );
180
176
}
181
177
182
- template <class T , class Value >
183
- bool try_get_next (const T& key, Value& val) const
178
+ bool try_get_next (const Index& key, UnqualData& val) const
184
179
{
185
180
size_t idx = transition_index_less (key);
186
181
auto cond = idx < _data._lengths [0 ];
@@ -189,8 +184,7 @@ struct mir_series
189
184
return cond;
190
185
}
191
186
192
- template <class T , class Value >
193
- bool try_get_next_update_key (T& key, Value& val) const
187
+ bool try_get_next_update_key (UnqualIndex& key, UnqualData& val) const
194
188
{
195
189
size_t idx = transition_index_less (key);
196
190
auto cond = idx < _data._lengths [0 ];
@@ -202,8 +196,7 @@ struct mir_series
202
196
return cond;
203
197
}
204
198
205
- template <class T , class Value >
206
- bool try_get_prev (const T& key, Value& val) const
199
+ bool try_get_prev (const Index& key, UnqualData& val) const
207
200
{
208
201
size_t idx = transition_index_less_or_equal (key) - 1 ;
209
202
auto cond = 0 <= (ptrdiff_t ) idx;
@@ -212,8 +205,7 @@ struct mir_series
212
205
return cond;
213
206
}
214
207
215
- template <class T , class Value >
216
- bool try_get_prev_update_key (T& key, Value& val) const
208
+ bool try_get_prev_update_key (UnqualIndex& key, UnqualData& val) const
217
209
{
218
210
size_t idx = transition_index_less_or_equal (key) - 1 ;
219
211
auto cond = 0 <= (ptrdiff_t ) idx;
@@ -225,8 +217,7 @@ struct mir_series
225
217
return cond;
226
218
}
227
219
228
- template <class T , class Value >
229
- bool try_get_first (const T& lowerBound, const T& upperBound, Value& val) const
220
+ bool try_get_first (const Index& lowerBound, const Index& upperBound, UnqualData& val) const
230
221
{
231
222
size_t idx = transition_index_less (lowerBound);
232
223
auto cond = idx < _data._lengths [0 ] && _index[idx] <= upperBound;
@@ -235,8 +226,7 @@ struct mir_series
235
226
return cond;
236
227
}
237
228
238
- template <class T , class Value >
239
- bool try_get_first_update_lower (T& lowerBound, const T& upperBound, Value& val) const
229
+ bool try_get_first_update_lower (UnqualIndex& lowerBound, const Index& upperBound, UnqualData& val) const
240
230
{
241
231
size_t idx = transition_index_less (lowerBound);
242
232
auto cond = idx < _data._lengths [0 ] && _index[idx] <= upperBound;
@@ -248,8 +238,7 @@ struct mir_series
248
238
return cond;
249
239
}
250
240
251
- template <class T , class Value >
252
- bool try_get_last (const T& lowerBound, const T& upperBound, Value& val) const
241
+ bool try_get_last (const Index& lowerBound, const Index& upperBound, UnqualData& val) const
253
242
{
254
243
size_t idx = transition_index_less_or_equal (upperBound) - 1 ;
255
244
auto cond = 0 <= (ptrdiff_t ) idx && lowerBound <= _index[idx];
@@ -258,8 +247,7 @@ struct mir_series
258
247
return cond;
259
248
}
260
249
261
- template <class T , class Value >
262
- bool try_get_last_update_upper (const T& lowerBound, T& upperBound, Value& val) const
250
+ bool try_get_last_update_upper (const Index& lowerBound, UnqualIndex& upperBound, UnqualData& val) const
263
251
{
264
252
size_t idx = transition_index_less_or_equal (upperBound) - 1 ;
265
253
auto cond = 0 <= (ptrdiff_t ) idx && lowerBound <= _index[idx];
0 commit comments