Embedded Template Library 1.0
Loading...
Searching...
No Matches
array_view.h
Go to the documentation of this file.
1
2
3/******************************************************************************
4The MIT License(MIT)
5
6Embedded Template Library.
7https://github.com/ETLCPP/etl
8https://www.etlcpp.com
9
10Copyright(c) 2017 John Wellbelove
11
12Permission is hereby granted, free of charge, to any person obtaining a copy
13of this software and associated documentation files(the "Software"), to deal
14in the Software without restriction, including without limitation the rights
15to use, copy, modify, merge, publish, distribute, sublicense, and / or sell
16copies of the Software, and to permit persons to whom the Software is
17furnished to do so, subject to the following conditions :
18
19The above copyright notice and this permission notice shall be included in all
20copies or substantial portions of the Software.
21
22THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
23IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
24FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE
25AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
26LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
27OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
28SOFTWARE.
29******************************************************************************/
30
31#ifndef ETL_ARRAY_VIEW_INCLUDED
32#define ETL_ARRAY_VIEW_INCLUDED
33
34#include "platform.h"
35#include "algorithm.h"
36#include "array.h"
37#include "error_handler.h"
38#include "exception.h"
39#include "hash.h"
40#include "iterator.h"
41#include "memory.h"
42#include "nullptr.h"
43#include "type_traits.h"
44
45#if ETL_USING_STL && ETL_USING_CPP11
46 #include <array>
47#endif
48
52
53namespace etl
54{
55 //***************************************************************************
57 //***************************************************************************
58 class array_view_exception : public exception
59 {
60 public:
61
62 array_view_exception(string_type reason_, string_type file_name_, numeric_type line_number_)
63 : exception(reason_, file_name_, line_number_)
64 {
65 }
66 };
67
68 //***************************************************************************
71 //***************************************************************************
72 class array_view_bounds : public array_view_exception
73 {
74 public:
75
76 array_view_bounds(string_type file_name_, numeric_type line_number_)
77 : array_view_exception(ETL_ERROR_TEXT("array_view:bounds", ETL_ARRAY_VIEW_FILE_ID"A"), file_name_, line_number_)
78 {
79 }
80 };
81
82 //***************************************************************************
85 //***************************************************************************
86 class array_view_uninitialised : public array_view_exception
87 {
88 public:
89
90 array_view_uninitialised(string_type file_name_, numeric_type line_number_)
91 : array_view_exception(ETL_ERROR_TEXT("array_view:uninitialised", ETL_ARRAY_VIEW_FILE_ID"B"), file_name_, line_number_)
92 {
93 }
94 };
95
96 //***************************************************************************
98 //***************************************************************************
99 class array_view_empty : public array_view_exception
100 {
101 public:
102
103 array_view_empty(string_type file_name_, numeric_type line_number_)
104 : array_view_exception(ETL_ERROR_TEXT("array_view:empty", ETL_ARRAY_VIEW_FILE_ID"C"), file_name_, line_number_)
105 {
106 }
107 };
108
109 //***************************************************************************
111 //***************************************************************************
112 template <typename T>
114 {
115 public:
116
117 typedef T value_type;
118 typedef size_t size_type;
119 typedef const T& const_reference;
120 typedef const T* const_pointer;
121 typedef const T* const_iterator;
122 typedef ETL_OR_STD::reverse_iterator<const_iterator> const_reverse_iterator;
123
124#if defined(ETL_ARRAY_VIEW_IS_MUTABLE)
125 typedef T* pointer;
126 typedef T& reference;
127 typedef T* iterator;
128 typedef ETL_OR_STD::reverse_iterator<iterator> reverse_iterator;
129#else
130 typedef const_pointer pointer;
131 typedef const_reference reference;
132 typedef const_pointer iterator;
133 typedef const_reverse_iterator reverse_iterator;
134#endif
135
136 //*************************************************************************
138 //*************************************************************************
139 ETL_CONSTEXPR array_view() ETL_NOEXCEPT
140 : mbegin(ETL_NULLPTR)
141 , mend(ETL_NULLPTR)
142 {
143 }
144
145#if ETL_USING_CPP11
146 //*************************************************************************
148 //*************************************************************************
149 template < typename U, size_t Size,
150 typename = typename etl::enable_if< etl::is_same<etl::remove_cv_t<T>, etl::remove_cv_t<U>>::value, void>::type>
151 ETL_CONSTEXPR array_view(etl::array<U, Size>& a) ETL_NOEXCEPT
152 : mbegin(a.data())
153 , mend(a.data() + a.size())
154 {
155 }
156
157 //*************************************************************************
159 //*************************************************************************
160 template < typename U, size_t Size,
161 typename = typename etl::enable_if< etl::is_same<etl::remove_cv_t<T>, etl::remove_cv_t<U>>::value, void>::type>
162 ETL_CONSTEXPR array_view(const etl::array<U, Size>& a) ETL_NOEXCEPT
163 : mbegin(a.data())
164 , mend(a.data() + a.size())
165 {
166 }
167#else
168 //*************************************************************************
170 //*************************************************************************
171 template <typename U, size_t Size>
172 ETL_CONSTEXPR array_view(
174 typename etl::enable_if< etl::is_same<typename etl::remove_cv<T>::type, typename etl::remove_cv<U>::type>::value, void>::type* = 0) ETL_NOEXCEPT
175 : mbegin(a.data())
176 , mend(a.data() + a.size())
177 {
178 }
179
180 //*************************************************************************
182 //*************************************************************************
183 template <typename U, size_t Size>
184 ETL_CONSTEXPR array_view(
185 const etl::array<U, Size>& a,
186 typename etl::enable_if< etl::is_same<typename etl::remove_cv<T>::type, typename etl::remove_cv<U>::type>::value, void>::type* = 0) ETL_NOEXCEPT
187 : mbegin(a.data())
188 , mend(a.data() + a.size())
189 {
190 }
191#endif
192
193#if ETL_USING_STL && ETL_USING_CPP11
194 //*************************************************************************
196 //*************************************************************************
197 template < typename U, size_t Size,
198 typename = typename etl::enable_if< etl::is_same<etl::remove_cv_t<T>, etl::remove_cv_t<U>>::value, void>::type>
199 ETL_CONSTEXPR array_view(std::array<U, Size>& a) ETL_NOEXCEPT
200 : mbegin(a.data())
201 , mend(a.data() + a.size())
202 {
203 }
204
205 //*************************************************************************
207 //*************************************************************************
208 template < typename U, size_t Size,
209 typename = typename etl::enable_if< etl::is_same<etl::remove_cv_t<T>, etl::remove_cv_t<U>>::value, void>::type>
210 ETL_CONSTEXPR array_view(const std::array<U, Size>& a) ETL_NOEXCEPT
211 : mbegin(a.data())
212 , mend(a.data() + a.size())
213 {
214 }
215#endif
216
217#if ETL_USING_CPP11
218 //*************************************************************************
221 //*************************************************************************
222 template < typename TContainer,
223 typename = typename etl::enable_if<
224 !etl::is_pointer<etl::remove_reference_t<TContainer>>::value && !etl::is_array<etl::remove_reference_t<TContainer>>::value
225 && etl::is_same<etl::remove_cv_t<T>, etl::remove_cv_t<typename etl::remove_reference_t< TContainer>::value_type>>::value,
226 void>::type>
227 ETL_CONSTEXPR array_view(TContainer&& a) ETL_NOEXCEPT
228 : mbegin(a.data())
229 , mend(a.data() + a.size())
230 {
231 }
232#else
233 //*************************************************************************
236 //*************************************************************************
237 template <typename TContainer>
238 ETL_CONSTEXPR array_view(TContainer& a,
239 typename etl::enable_if<
240 !etl::is_pointer< typename etl::remove_reference<TContainer>::type>::value && !etl::is_array<TContainer>::value
241 && etl::is_same< typename etl::remove_cv<T>::type,
243 void>::type* = 0) ETL_NOEXCEPT
244 : mbegin(a.data())
245 , mend(a.data() + a.size())
246 {
247 }
248
249 //*************************************************************************
252 //*************************************************************************
253 template <typename TContainer>
254 ETL_CONSTEXPR array_view(const TContainer& a,
255 typename etl::enable_if<
256 !etl::is_pointer< typename etl::remove_reference<TContainer>::type>::value && !etl::is_array<TContainer>::value
257 && etl::is_same< typename etl::remove_cv<T>::type,
259 void>::type* = 0) ETL_NOEXCEPT
260 : mbegin(a.data())
261 , mend(a.data() + a.size())
262 {
263 }
264#endif
265
266 //*************************************************************************
268 //*************************************************************************
269 template <typename TIterator>
270 ETL_CONSTEXPR array_view(const TIterator begin_, const TIterator end_) ETL_NOEXCEPT
271 : mbegin(etl::to_address(begin_))
272 , mend(etl::to_address(begin_) + etl::distance(begin_, end_))
273 {
274 }
275
276 //*************************************************************************
278 //*************************************************************************
279 template <typename TIterator, typename TSize>
280 ETL_CONSTEXPR array_view(const TIterator begin_, const TSize size_) ETL_NOEXCEPT
281 : mbegin(etl::to_address(begin_))
282 , mend(etl::to_address(begin_) + size_)
283 {
284 }
285
286 //*************************************************************************
288 //*************************************************************************
289 template <size_t Array_Size>
290 ETL_CONSTEXPR array_view(T (&begin_)[Array_Size]) ETL_NOEXCEPT
291 : mbegin(begin_)
292 , mend(begin_ + Array_Size)
293 {
294 }
295
296 //*************************************************************************
298 //*************************************************************************
299 ETL_CONSTEXPR array_view(const array_view& other) ETL_NOEXCEPT
300 : mbegin(other.mbegin)
301 , mend(other.mend)
302 {
303 }
304
305 //*************************************************************************
309 //*************************************************************************
310 reference front()
311 {
312 ETL_ASSERT_CHECK_EXTRA(!empty(), ETL_ERROR(array_view_empty));
313 return *mbegin;
314 }
315
316 //*************************************************************************
320 //*************************************************************************
321 const_reference front() const
322 {
323 ETL_ASSERT_CHECK_EXTRA(!empty(), ETL_ERROR(array_view_empty));
324 return *mbegin;
325 }
326
327 //*************************************************************************
331 //*************************************************************************
332 reference back()
333 {
334 ETL_ASSERT_CHECK_EXTRA(!empty(), ETL_ERROR(array_view_empty));
335 return *(mend - 1);
336 }
337
338 //*************************************************************************
342 //*************************************************************************
343 const_reference back() const
344 {
345 ETL_ASSERT_CHECK_EXTRA(!empty(), ETL_ERROR(array_view_empty));
346 return *(mend - 1);
347 }
348
349 //*************************************************************************
351 //*************************************************************************
352 pointer data() ETL_NOEXCEPT
353 {
354 return mbegin;
355 }
356
357 //*************************************************************************
359 //*************************************************************************
360 const_pointer data() const ETL_NOEXCEPT
361 {
362 return mbegin;
363 }
364
365 //*************************************************************************
367 //*************************************************************************
368 iterator begin() ETL_NOEXCEPT
369 {
370 return mbegin;
371 }
372
373 //*************************************************************************
375 //*************************************************************************
376 const_iterator begin() const ETL_NOEXCEPT
377 {
378 return mbegin;
379 }
380
381 //*************************************************************************
383 //*************************************************************************
384 const_iterator cbegin() const ETL_NOEXCEPT
385 {
386 return mbegin;
387 }
388
389 //*************************************************************************
391 //*************************************************************************
392 iterator end() ETL_NOEXCEPT
393 {
394 return mend;
395 }
396
397 //*************************************************************************
399 //*************************************************************************
400 const_iterator end() const ETL_NOEXCEPT
401 {
402 return mend;
403 }
404
405 //*************************************************************************
406 // Returns a const iterator to the end of the array.
407 //*************************************************************************
408 const_iterator cend() const ETL_NOEXCEPT
409 {
410 return mend;
411 }
412
413 //*************************************************************************
414 // Returns an reverse iterator to the reverse beginning of the array.
415 //*************************************************************************
416 reverse_iterator rbegin() ETL_NOEXCEPT
417 {
418 return reverse_iterator(mend);
419 }
420
421 //*************************************************************************
423 //*************************************************************************
424 const_reverse_iterator rbegin() const ETL_NOEXCEPT
425 {
426 return const_reverse_iterator(mend);
427 }
428
429 //*************************************************************************
431 //*************************************************************************
432 const_reverse_iterator crbegin() const ETL_NOEXCEPT
433 {
434 return const_reverse_iterator(mend);
435 }
436
437 //*************************************************************************
439 //*************************************************************************
440 reverse_iterator rend() ETL_NOEXCEPT
441 {
442 return reverse_iterator(mbegin);
443 }
444
445 //*************************************************************************
447 //*************************************************************************
448 const_reverse_iterator rend() const ETL_NOEXCEPT
449 {
450 return const_reverse_iterator(mbegin);
451 }
452
453 //*************************************************************************
455 //*************************************************************************
456 const_reverse_iterator crend() const ETL_NOEXCEPT
457 {
458 return const_reverse_iterator(mbegin);
459 }
460
461 //*************************************************************************
463 //*************************************************************************
464 ETL_CONSTEXPR bool empty() const ETL_NOEXCEPT
465 {
466 return (mbegin == mend);
467 }
468
469 //*************************************************************************
471 //*************************************************************************
472 ETL_CONSTEXPR size_t size() const ETL_NOEXCEPT
473 {
474 return static_cast<size_t>(mend - mbegin);
475 }
476
477 //*************************************************************************
479 //*************************************************************************
480 ETL_CONSTEXPR size_t max_size() const ETL_NOEXCEPT
481 {
482 return size();
483 }
484
485 //*************************************************************************
487 //*************************************************************************
488 array_view& operator=(const array_view& other) ETL_NOEXCEPT
489 {
490 mbegin = other.mbegin;
491 mend = other.mend;
492 return *this;
493 }
494
495 //*************************************************************************
497 //*************************************************************************
498 template <typename TIterator>
499 void assign(const TIterator begin_, const TIterator end_)
500 {
501 mbegin = etl::to_address(begin_);
502 mend = etl::to_address(begin_) + etl::distance(begin_, end_);
503 }
504
505 //*************************************************************************
507 //*************************************************************************
508 template <typename TIterator, typename TSize>
509 void assign(const TIterator begin_, const TSize size_)
510 {
511 mbegin = etl::to_address(begin_);
512 mend = etl::to_address(begin_) + size_;
513 }
514
515#if defined(ETL_ARRAY_VIEW_IS_MUTABLE)
516 //*************************************************************************
520 //*************************************************************************
521 reference operator[](const size_t i) ETL_NOEXCEPT_EXPR(ETL_NOT_USING_EXCEPTIONS || ETL_NOT_CHECKING_INDEX_OPERATOR)
522 {
523 ETL_ASSERT_CHECK_INDEX_OPERATOR(i < size(), ETL_ERROR(array_view_bounds));
524
525 return mbegin[i];
526 }
527#endif
528
529 //*************************************************************************
533 //*************************************************************************
534 const_reference operator[](const size_t i) const ETL_NOEXCEPT_EXPR(ETL_NOT_USING_EXCEPTIONS || ETL_NOT_CHECKING_INDEX_OPERATOR)
535 {
536 ETL_ASSERT_CHECK_INDEX_OPERATOR(i < size(), ETL_ERROR(array_view_bounds));
537
538 return mbegin[i];
539 }
540
541#if defined(ETL_ARRAY_VIEW_IS_MUTABLE)
542 //*************************************************************************
544 //*************************************************************************
545 reference at(const size_t i)
546 {
547 ETL_ASSERT((mbegin != ETL_NULLPTR && mend != ETL_NULLPTR), ETL_ERROR(array_view_uninitialised));
548 ETL_ASSERT(i < size(), ETL_ERROR(array_view_bounds));
549 return mbegin[i];
550 }
551#endif
552
553 //*************************************************************************
555 //*************************************************************************
556 const_reference at(const size_t i) const
557 {
558 ETL_ASSERT((mbegin != ETL_NULLPTR && mend != ETL_NULLPTR), ETL_ERROR(array_view_uninitialised));
559 ETL_ASSERT(i < size(), ETL_ERROR(array_view_bounds));
560 return mbegin[i];
561 }
562
563 //*************************************************************************
565 //*************************************************************************
566 void swap(array_view& other) ETL_NOEXCEPT
567 {
568 using ETL_OR_STD::swap; // Allow ADL
569
570 swap(mbegin, other.mbegin);
571 swap(mend, other.mend);
572 }
573
574 //*************************************************************************
576 //*************************************************************************
577 void remove_prefix(const size_type n) ETL_NOEXCEPT
578 {
579 if (n < size())
580 mbegin += n;
581 else
582 mbegin = mend;
583 }
584
585 //*************************************************************************
587 //*************************************************************************
588 void remove_suffix(const size_type n) ETL_NOEXCEPT
589 {
590 if (n < size())
591 mend -= n;
592 else
593 mend = mbegin;
594 }
595
596 //*************************************************************************
598 //*************************************************************************
599 void fill(const T& value)
600 {
601 etl::fill(begin(), end(), value);
602 }
603
604 //*************************************************************************
606 //*************************************************************************
607 friend bool operator==(const array_view<T>& lhs, const array_view<T>& rhs)
608 {
609 return (lhs.size() == rhs.size()) && etl::equal(lhs.begin(), lhs.end(), rhs.begin());
610 }
611
612 //*************************************************************************
614 //*************************************************************************
615 friend bool operator!=(const array_view<T>& lhs, const array_view<T>& rhs)
616 {
617 return !(lhs == rhs);
618 }
619
620 //*************************************************************************
622 //*************************************************************************
623 friend bool operator<(const array_view<T>& lhs, const array_view<T>& rhs)
624 {
625 return etl::lexicographical_compare(lhs.begin(), lhs.end(), rhs.begin(), rhs.end());
626 }
627
628 //*************************************************************************
630 //*************************************************************************
631 friend bool operator>(const array_view<T>& lhs, const array_view<T>& rhs)
632 {
633 return rhs < lhs;
634 }
635
636 //*************************************************************************
638 //*************************************************************************
639 friend bool operator<=(const array_view<T>& lhs, const array_view<T>& rhs)
640 {
641 return !(lhs > rhs);
642 }
643
644 //*************************************************************************
646 //*************************************************************************
647 friend bool operator>=(const array_view<T>& lhs, const array_view<T>& rhs)
648 {
649 return !(lhs < rhs);
650 }
651
652 private:
653
654 pointer mbegin;
655 pointer mend;
656 };
657
658 //*************************************************************************
660 //*************************************************************************
661#if ETL_USING_CPP17
662 template <typename TArray>
663 array_view(TArray& a) -> array_view<typename TArray::value_type>;
664
665 template <typename TIterator>
666 array_view(const TIterator begin_, const TIterator end_) -> array_view<etl::remove_pointer_t<TIterator>>;
667
668 template <typename TIterator, typename TSize>
669 array_view(const TIterator begin_, const TSize size_) -> array_view<etl::remove_pointer_t<TIterator>>;
670#endif
671
672 //*************************************************************************
674 //*************************************************************************
675#if ETL_USING_8BIT_TYPES
676 template <typename T>
677 struct hash<etl::array_view<T> >
678 {
679 size_t operator()(const etl::array_view<T>& view) const
680 {
681 return etl::private_hash::generic_hash<size_t>(reinterpret_cast<const uint8_t*>(view.data()),
682 reinterpret_cast<const uint8_t*>(view.data() + view.size()));
683 }
684 };
685#endif
686} // namespace etl
687
688//*************************************************************************
690//*************************************************************************
691template <typename T>
692void swap(etl::array_view<T>& lhs, etl::array_view<T>& rhs) ETL_NOEXCEPT
693{
694 lhs.swap(rhs);
695}
696
697#endif
void swap(etl::array_view< T > &lhs, etl::array_view< T > &rhs) ETL_NOEXCEPT
Swaps the values.
Definition array_view.h:692
The exception thrown when the view is empty.
Definition array_view.h:100
Array view.
Definition array_view.h:114
ETL_CONSTEXPR array_view(etl::array< U, Size > &a, typename etl::enable_if< etl::is_same< typename etl::remove_cv< T >::type, typename etl::remove_cv< U >::type >::value, void >::type *=0) ETL_NOEXCEPT
Construct from etl::array.
Definition array_view.h:172
friend bool operator!=(const array_view< T > &lhs, const array_view< T > &rhs)
Inequality for array views.
Definition array_view.h:615
ETL_CONSTEXPR array_view(const array_view &other) ETL_NOEXCEPT
Copy constructor.
Definition array_view.h:299
ETL_CONSTEXPR array_view() ETL_NOEXCEPT
Default constructor.
Definition array_view.h:139
reference front()
Definition array_view.h:310
const_reference back() const
Definition array_view.h:343
iterator end() ETL_NOEXCEPT
Returns an iterator to the end of the array.
Definition array_view.h:392
const_iterator begin() const ETL_NOEXCEPT
Returns a const iterator to the beginning of the array.
Definition array_view.h:376
ETL_CONSTEXPR size_t size() const ETL_NOEXCEPT
Returns the size of the array.
Definition array_view.h:472
friend bool operator<=(const array_view< T > &lhs, const array_view< T > &rhs)
Less-than-equal for array views.
Definition array_view.h:639
ETL_CONSTEXPR size_t max_size() const ETL_NOEXCEPT
Returns the maximum possible size of the array.
Definition array_view.h:480
void swap(array_view &other) ETL_NOEXCEPT
Swaps with another array_view.
Definition array_view.h:566
const_iterator cbegin() const ETL_NOEXCEPT
Returns a const iterator to the beginning of the array.
Definition array_view.h:384
const_iterator end() const ETL_NOEXCEPT
Returns a const iterator to the end of the array.
Definition array_view.h:400
ETL_CONSTEXPR bool empty() const ETL_NOEXCEPT
Returns true if the array size is zero.
Definition array_view.h:464
const_reference front() const
Definition array_view.h:321
ETL_CONSTEXPR array_view(const etl::array< U, Size > &a, typename etl::enable_if< etl::is_same< typename etl::remove_cv< T >::type, typename etl::remove_cv< U >::type >::value, void >::type *=0) ETL_NOEXCEPT
Construct from etl::array.
Definition array_view.h:184
const_reference at(const size_t i) const
Returns a const reference to the indexed value.
Definition array_view.h:556
iterator begin() ETL_NOEXCEPT
Returns an iterator to the beginning of the array.
Definition array_view.h:368
array_view & operator=(const array_view &other) ETL_NOEXCEPT
Assign from a view.
Definition array_view.h:488
void fill(const T &value)
Fills the array.
Definition array_view.h:599
ETL_CONSTEXPR array_view(const TContainer &a, typename etl::enable_if< !etl::is_pointer< typename etl::remove_reference< TContainer >::type >::value &&!etl::is_array< TContainer >::value &&etl::is_same< typename etl::remove_cv< T >::type, typename etl::remove_cv< typename etl::remove_reference< TContainer >::type::value_type >::type >::value, void >::type *=0) ETL_NOEXCEPT
Definition array_view.h:254
friend bool operator>(const array_view< T > &lhs, const array_view< T > &rhs)
Greater-than for array views.
Definition array_view.h:631
friend bool operator==(const array_view< T > &lhs, const array_view< T > &rhs)
Equality for array views.
Definition array_view.h:607
ETL_CONSTEXPR array_view(const TIterator begin_, const TIterator end_) ETL_NOEXCEPT
Construct from iterators.
Definition array_view.h:270
const_reverse_iterator rend() const ETL_NOEXCEPT
Returns a const reverse iterator to the end of the array.
Definition array_view.h:448
void remove_prefix(const size_type n) ETL_NOEXCEPT
Shrinks the view by moving its start forward.
Definition array_view.h:577
ETL_CONSTEXPR array_view(TContainer &a, typename etl::enable_if< !etl::is_pointer< typename etl::remove_reference< TContainer >::type >::value &&!etl::is_array< TContainer >::value &&etl::is_same< typename etl::remove_cv< T >::type, typename etl::remove_cv< typename etl::remove_reference< TContainer >::type::value_type >::type >::value, void >::type *=0) ETL_NOEXCEPT
Definition array_view.h:238
pointer data() ETL_NOEXCEPT
Returns a pointer to the first element of the internal storage.
Definition array_view.h:352
friend bool operator>=(const array_view< T > &lhs, const array_view< T > &rhs)
Greater-than-equal for array views.
Definition array_view.h:647
void remove_suffix(const size_type n) ETL_NOEXCEPT
Shrinks the view by moving its end backward.
Definition array_view.h:588
ETL_CONSTEXPR array_view(const TIterator begin_, const TSize size_) ETL_NOEXCEPT
Construct from iterator and size.
Definition array_view.h:280
void assign(const TIterator begin_, const TIterator end_)
Assign from iterators.
Definition array_view.h:499
void assign(const TIterator begin_, const TSize size_)
Assign from iterator and size.
Definition array_view.h:509
const_reverse_iterator crend() const ETL_NOEXCEPT
Returns a const reverse iterator to the end of the array.
Definition array_view.h:456
friend bool operator<(const array_view< T > &lhs, const array_view< T > &rhs)
Less-than for array views.
Definition array_view.h:623
ETL_CONSTEXPR array_view(T(&begin_)[Array_Size]) ETL_NOEXCEPT
Construct from C array.
Definition array_view.h:290
reverse_iterator rend() ETL_NOEXCEPT
Returns a reverse iterator to the end of the array.
Definition array_view.h:440
const_reverse_iterator rbegin() const ETL_NOEXCEPT
Returns a const reverse iterator to the reverse beginning of the array.
Definition array_view.h:424
const_pointer data() const ETL_NOEXCEPT
Returns a const pointer to the first element of the internal storage.
Definition array_view.h:360
const_reference operator[](const size_t i) const ETL_NOEXCEPT_EXPR(ETL_NOT_USING_EXCEPTIONS||ETL_NOT_CHECKING_INDEX_OPERATOR)
Definition array_view.h:534
reference back()
Definition array_view.h:332
const_reverse_iterator crbegin() const ETL_NOEXCEPT
Returns a const reverse iterator to the reverse beginning of the array.
Definition array_view.h:432
Definition array.h:88
#define ETL_ASSERT(b, e)
Definition error_handler.h:511
ETL_EXCEPTION_CONSTEXPR exception(string_type reason_, string_type, numeric_type)
Constructor.
Definition exception.h:81
Definition array_view.h:73
Definition array_view.h:87
bitset_ext
Definition absolute.h:40
ETL_CONSTEXPR T * to_address(T *p) ETL_NOEXCEPT
Definition memory.h:62
ETL_CONSTEXPR TContainer::const_iterator cend(const TContainer &container)
Definition iterator.h:1017
remove_cv
Definition type_traits.h:325
remove_reference
Definition type_traits.h:122