67 using iterator = IteratorBase<false>;
68 using const_iterator = IteratorBase<true>;
70 using size_type =
decltype(Capacity);
108 const_iterator
begin() const noexcept;
122 const_iterator
end() const noexcept;
127 const_iterator
cend() const noexcept;
141 size_type
size() const noexcept;
169 const T&
back() const noexcept;
211 iterator
erase(const_iterator iter) noexcept;
217 size_type
remove(const T& data) noexcept;
223 template <typename UnaryPredicate>
229 template <typename... ConstructorArgs>
235 template <typename... ConstructorArgs>
242 template <typename... ConstructorArgs>
243 iterator
emplace(const_iterator iter, ConstructorArgs&&... args) noexcept;
249 iterator
insert(const_iterator citer, const T& data) noexcept;
255 iterator
insert(const_iterator citer, T&& data) noexcept;
260 template <
bool IsConstIterator = true>
265 using iterator_category = std::bidirectional_iterator_tag;
266 using value_type =
typename std::conditional<IsConstIterator, const T, T>::type;
267 using difference_type = void;
268 using pointer =
typename std::conditional<IsConstIterator, const T*, T*>::type;
269 using reference =
typename std::conditional<IsConstIterator, const T&, T&>::type;
274 IteratorBase(
const IteratorBase<false>& iter)
noexcept;
280 IteratorBase&
operator=(
const IteratorBase<false>& rhs)
noexcept;
285 IteratorBase& operator++()
noexcept;
290 IteratorBase& operator--()
noexcept;
299 template <
bool IsConstIteratorOther>
300 bool operator==(
const IteratorBase<IsConstIteratorOther>& rhs)
const noexcept;
308 template <
bool IsConstIteratorOther>
309 bool operator!=(
const IteratorBase<IsConstIteratorOther>& rhs)
const noexcept;
313 reference operator*()
const noexcept;
317 pointer operator->()
const noexcept;
321 using parentListPointer =
322 typename std::conditional<IsConstIterator, const list<T, Capacity>*,
list<T, Capacity>*>::type;
329 explicit IteratorBase(parentListPointer parent, size_type idx)
noexcept;
333 friend class IteratorBase<true>;
334 friend class list<T, Capacity>;
335 parentListPointer m_list;
336 size_type m_iterListNodeIdx;
345 void init() noexcept;
346 T* getDataPtrFromIdx(const size_type idx) noexcept;
347 const T* getDataPtrFromIdx(const size_type idx) const noexcept;
349 bool isValidElementIdx(const size_type idx) const noexcept;
350 bool isInvalidIterator(const const_iterator& iter) const noexcept;
351 bool isInvalidIterOrDifferentLists(const const_iterator& iter) const noexcept;
352 size_type& getPrevIdx(const size_type idx) noexcept;
353 size_type& getNextIdx(const size_type idx) noexcept;
354 size_type& getPrevIdx(const const_iterator& iter) noexcept;
355 size_type& getNextIdx(const const_iterator& iter) noexcept;
356 const size_type& getPrevIdx(const size_type idx) const noexcept;
357 const size_type& getNextIdx(const size_type idx) const noexcept;
358 const size_type& getPrevIdx(const const_iterator& iter) const noexcept;
359 const size_type& getNextIdx(const const_iterator& iter) const noexcept;
360 void setPrevIdx(const size_type idx, const size_type prevIdx) noexcept;
361 void setNextIdx(const size_type idx, const size_type nextIdx) noexcept;
363 static
void errorMessage(const
char* source, const
char* msg) noexcept;
369 static constexpr size_type BEGIN_END_LINK_INDEX{size_type(Capacity)};
370 static constexpr size_type NODE_LINK_COUNT{size_type(Capacity) + 1U};
371 static constexpr size_type INVALID_INDEX{NODE_LINK_COUNT};
376 size_type m_freeListHeadIdx{0U};
382 NodeLink m_links[NODE_LINK_COUNT];
383 using element_t = uint8_t[
sizeof(T)];
384 alignas(T) element_t m_data[Capacity];
386 size_type m_size{0U};