|
34 | 34 |
|
35 | 35 | namespace gsl |
36 | 36 | { |
| 37 | +template <typename T, typename Allocator = std::allocator<T>> |
| 38 | +class dyn_array; |
| 39 | + |
37 | 40 | namespace details |
38 | 41 | { |
39 | 42 | template <typename T, typename Allocator = std::allocator<T>> |
@@ -178,13 +181,6 @@ namespace details |
178 | 181 | constexpr dyn_array_iterator() = default; |
179 | 182 | #endif /* __cpp_lib_ranges >= 201911L */ |
180 | 183 |
|
181 | | - constexpr dyn_array_iterator(pointer ptr, size_type pos, size_type end_pos) |
182 | | - : _ptr{ptr}, _pos{pos}, _end_pos{end_pos} |
183 | | - { |
184 | | - Ensures((_ptr != nullptr && _end_pos > 0) || (_ptr == nullptr && _end_pos == 0)); |
185 | | - Ensures(_pos <= _end_pos); |
186 | | - } |
187 | | - |
188 | 184 | constexpr operator dyn_array_iterator<const T>() const { return {_ptr, _pos, _end_pos}; } |
189 | 185 |
|
190 | 186 | #if defined(_MSC_VER) && defined(__cpp_lib_ranges) && (__cpp_lib_ranges >= 201911L) |
@@ -281,13 +277,23 @@ namespace details |
281 | 277 | } |
282 | 278 |
|
283 | 279 | private: |
| 280 | + constexpr dyn_array_iterator(pointer ptr, size_type pos, size_type end_pos) |
| 281 | + : _ptr{ptr}, _pos{pos}, _end_pos{end_pos} |
| 282 | + { |
| 283 | + Ensures((_ptr != nullptr && _end_pos > 0) || (_ptr == nullptr && _end_pos == 0)); |
| 284 | + Ensures(_pos <= _end_pos); |
| 285 | + } |
| 286 | + |
284 | 287 | pointer _ptr{}; |
285 | 288 | size_type _pos{}; |
286 | 289 | size_type _end_pos{}; |
| 290 | + |
| 291 | + template <typename, typename> |
| 292 | + friend class ::gsl::dyn_array; |
287 | 293 | }; |
288 | 294 | } // namespace details |
289 | 295 |
|
290 | | -template <typename T, typename Allocator = std::allocator<T>> |
| 296 | +template <typename T, typename Allocator> |
291 | 297 | class dyn_array : private details::dyn_array_base<T, Allocator> |
292 | 298 | { |
293 | 299 | using base = details::dyn_array_base<T, Allocator>; |
|
0 commit comments