31#ifndef ETL_MULTI_SPAN_INCLUDED
32#define ETL_MULTI_SPAN_INCLUDED
74 : p_span_list(ETL_NULLPTR)
75 , p_current_span(ETL_NULLPTR)
76 , p_value(ETL_NULLPTR)
82 : p_span_list(
other.p_span_list)
83 , p_current_span(
other.p_current_span)
84 , p_value(
other.p_value)
91 p_span_list =
rhs.p_span_list;
92 p_current_span =
rhs.p_current_span;
93 p_value =
rhs.p_value;
101 if (p_current_span != p_span_list->
end())
105 if (p_value == p_current_span->end())
110 }
while ((p_current_span != p_span_list->
end()) && p_current_span->empty());
112 if (p_current_span != p_span_list->
end())
114 p_value = p_current_span->begin();
118 p_value = ETL_NULLPTR;
139 if (p_current_span == p_span_list->
end())
142 p_value = p_current_span->end();
145 else if ((p_current_span != p_span_list->
begin()) || (p_value != p_current_span->begin()))
147 if (p_value == p_current_span->begin())
152 }
while ((p_current_span != p_span_list->
begin()) && p_current_span->empty());
154 p_value = p_current_span->end();
164 p_value = ETL_NULLPTR;
217 return (
lhs.p_current_span ==
rhs.p_current_span) && (
lhs.p_value ==
rhs.p_value);
232 typedef typename span_list_type::iterator span_list_iterator;
238 , p_value(ETL_NULLPTR)
240 if (p_current_span != p_span_list->
end())
242 while ((p_current_span != p_span_list->
end()) && p_current_span->empty())
247 if (p_current_span != p_span_list->
end())
249 p_value = p_current_span->begin();
253 p_value = ETL_NULLPTR;
258 span_list_pointer p_span_list;
259 span_pointer p_current_span;
274 : p_span_list(ETL_NULLPTR)
275 , p_current_span(ETL_NULLPTR)
276 , p_value(ETL_NULLPTR)
282 : p_span_list(
other.p_span_list)
283 , p_current_span(
other.p_current_span)
284 , p_value(
other.p_value)
291 p_span_list =
rhs.p_span_list;
292 p_current_span =
rhs.p_current_span;
293 p_value =
rhs.p_value;
300 : p_span_list(
other.p_span_list)
301 , p_current_span(
other.p_current_span)
302 , p_value(
other.p_value)
309 p_span_list =
rhs.p_span_list;
310 p_current_span =
rhs.p_current_span;
311 p_value =
rhs.p_value;
319 if (p_current_span != p_span_list->
end())
323 if (p_value == p_current_span->end())
328 }
while ((p_current_span != p_span_list->
end()) && p_current_span->empty());
330 if (p_current_span != p_span_list->
end())
332 p_value = p_current_span->begin();
336 p_value = ETL_NULLPTR;
357 if (p_current_span == p_span_list->
end())
360 p_value = p_current_span->end();
363 else if ((p_current_span != p_span_list->
begin()) || (p_value != p_current_span->begin()))
365 if (p_value == p_current_span->begin())
370 }
while ((p_current_span != p_span_list->
begin()) && p_current_span->empty());
372 p_value = p_current_span->end();
382 p_value = ETL_NULLPTR;
419 return (
lhs.p_current_span ==
rhs.p_current_span) && (
lhs.p_value ==
rhs.p_value);
434 typedef const typename span_list_type::iterator span_list_iterator;
440 , p_value(ETL_NULLPTR)
442 if (p_current_span != p_span_list->
end())
444 while ((p_current_span != p_span_list->
end()) && p_current_span->empty())
449 if (p_current_span != p_span_list->
end())
451 p_value = p_current_span->begin();
455 p_value = ETL_NULLPTR;
460 span_list_pointer p_span_list;
461 span_pointer p_current_span;
462 const_pointer p_value;
465 typedef ETL_OR_STD::reverse_iterator<iterator> reverse_iterator;
466 typedef ETL_OR_STD::reverse_iterator<const_iterator> const_reverse_iterator;
480 template <
typename TContainer>
482 : span_list(a.data(), a.data() + a.size())
490 template <
typename TContainer>
492 : span_list(a.data(), a.data() + a.size())
499 template <
typename TIterator>
508 template <
typename TIterator>
518 : span_list(
other.span_list)
527 span_list =
other.span_list;
535 ETL_CONSTEXPR14
iterator begin()
const
543 ETL_CONSTEXPR14 const_iterator cbegin()
const
545 return const_iterator(span_list, span_list.
cbegin());
551 ETL_CONSTEXPR14 iterator end()
const
553 return iterator(span_list, span_list.
end());
559 ETL_CONSTEXPR14 const_iterator cend()
const
561 return const_iterator(span_list, span_list.
cend());
567 ETL_CONSTEXPR14 reverse_iterator rbegin()
const
569 return reverse_iterator(end());
575 ETL_CONSTEXPR14 reverse_iterator crbegin()
const
577 return const_reverse_iterator(cend());
583 ETL_CONSTEXPR14 reverse_iterator rend()
const
585 return reverse_iterator(begin());
591 ETL_CONSTEXPR14 const_reverse_iterator crend()
const
593 return const_reverse_iterator(cbegin());
608 i -= span_list[index].
size();
612 return span_list[index][
i];
622 for (
typename span_list_type::iterator itr = span_list.
begin();
623 itr != span_list.
end();
637 if (span_list.
empty())
654 for (
typename span_list_type::iterator itr = span_list.
begin();
655 itr != span_list.
end();
669 return span_list.
size();
674 span_list_type span_list;
Const Iterator.
Definition multi_span.h:267
ETL_CONSTEXPR14 friend bool operator==(const const_iterator &lhs, const const_iterator &rhs)
== operator
Definition multi_span.h:417
ETL_CONSTEXPR14 friend bool operator!=(const const_iterator &lhs, const const_iterator &rhs)
!= operator
Definition multi_span.h:425
ETL_CONSTEXPR14 const_reference operator*() const
Definition multi_span.h:401
ETL_CONSTEXPR14 const_pointer operator->() const
-> operator
Definition multi_span.h:409
Iterator.
Definition multi_span.h:66
ETL_CONSTEXPR14 reference operator*()
Definition multi_span.h:183
ETL_CONSTEXPR14 friend bool operator==(const iterator &lhs, const iterator &rhs)
== operator
Definition multi_span.h:215
ETL_CONSTEXPR14 pointer operator->()
-> operator
Definition multi_span.h:199
ETL_CONSTEXPR14 friend bool operator!=(const iterator &lhs, const iterator &rhs)
!= operator
Definition multi_span.h:223
Definition multi_span.h:48
ETL_CONSTEXPR14 multi_span(TIterator begin_, size_t length_)
Constructor.
Definition multi_span.h:509
ETL_CONSTEXPR14 multi_span(const multi_span &other)
Copy Constructor.
Definition multi_span.h:517
ETL_CONSTEXPR14 size_t size_spans() const ETL_NOEXCEPT
Returns the number of spans in the multi_span.
Definition multi_span.h:667
ETL_CONSTEXPR14 reference operator[](size_t i) const
Returns a reference to the indexed value.
Definition multi_span.h:599
ETL_CONSTEXPR14 size_t size() const ETL_NOEXCEPT
Returns the number of elements in the multi_span.
Definition multi_span.h:618
ETL_CONSTEXPR14 multi_span & operator=(const multi_span &other)
Assignment operator.
Definition multi_span.h:525
ETL_CONSTEXPR14 multi_span(const TContainer &a) ETL_NOEXCEPT
Definition multi_span.h:491
ETL_CONSTEXPR14 multi_span(TIterator begin_, TIterator end_)
Constructor.
Definition multi_span.h:500
ETL_CONSTEXPR14 multi_span(span_list_type span_list_)
Constructor.
Definition multi_span.h:471
ETL_CONSTEXPR14 size_t size_bytes() const ETL_NOEXCEPT
Returns the size of the multi_span.
Definition multi_span.h:650
ETL_CONSTEXPR14 multi_span(TContainer &a) ETL_NOEXCEPT
Definition multi_span.h:481
ETL_CONSTEXPR14 bool empty() const ETL_NOEXCEPT
Returns true if the multi_span size is zero.
Definition multi_span.h:635
ETL_NODISCARD ETL_CONSTEXPR const_iterator cbegin() const ETL_NOEXCEPT
Returns a const iterator to the beginning of the span.
Definition span.h:193
ETL_NODISCARD ETL_CONSTEXPR iterator begin() const ETL_NOEXCEPT
Returns an iterator to the beginning of the span.
Definition span.h:201
ETL_NODISCARD ETL_CONSTEXPR bool empty() const ETL_NOEXCEPT
Returns true if the span size is zero.
Definition span.h:273
ETL_NODISCARD ETL_CONSTEXPR const_iterator cend() const ETL_NOEXCEPT
Returns a const iterator to the end of the span.
Definition span.h:217
ETL_NODISCARD ETL_CONSTEXPR size_t size() const ETL_NOEXCEPT
Returns the size of the span.
Definition span.h:281
ETL_NODISCARD ETL_CONSTEXPR iterator end() const ETL_NOEXCEPT
Returns an iterator to the end of the span.
Definition span.h:225
bitset_ext
Definition absolute.h:38
ETL_CONSTEXPR T * to_address(T *p)
Definition memory.h:62
iterator
Definition iterator.h:399
pair holds two objects of arbitrary type
Definition utility.h:164