34 template<
class IteratorType>
41 template<
class IteratorType>
48 template<
class IteratorType>
55 return IteratorType(list, const_cast<DLListBase::link*>(first_));
59 return IteratorType(list,
nullptr);
63 template<
class IteratorType>
70 return IteratorType(list, const_cast<DLListBase::link*>(last_));
74 return IteratorType(list,
nullptr);
82 return iterator_end<DLListBase::iterator>();
89 return iterator_end<DLListBase::const_iterator>();
96 return iterator_rend<DLListBase::const_iterator>();
169 std::swap(first_, lst.first_);
170 std::swap(last_, lst.last_);
171 std::swap(size_, lst.size_);
196 return remove(iter.node_);
207 return replace(oldIter.node_, newItem);
223 if (node_ !=
nullptr)
239 return (node_ !=
nullptr);
249 if (node_ == copy_.prev_ || list_->first_ ==
nullptr)
268 if (node_ == copy_.next_ || list_->last_ ==
nullptr)
291 return node_ == iter.node_;
297 return node_ != iter.node_;
306 return iterator_first<iterator>();
345 return (node_ !=
nullptr);
353 if (node_ == list_->first_)
359 node_ = node_->prev_;
369 if (node_ == list_->last_)
375 node_ = node_->next_;
381 inline bool Foam::DLListBase::const_iterator::operator==
386 return node_ == iter.node_;
390 inline bool Foam::DLListBase::const_iterator::operator!=
395 return node_ != iter.node_;
404 return iterator_first<const_iterator>();
416 return iterator_last<const_iterator>();
iterator(const iterator &)=default
Copy construct.
void prev()
Move backward through list.
link * remove(link *item)
Remove and return element.
const_iterator(const const_iterator &)=default
Copy construct.
const const_iterator & crend() const
End of list for reverse iterators.
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Base for doubly-linked lists.
void transfer(DLListBase &lst)
Transfer the contents of the argument into this list and annul the argument list. ...
The structure for a doubly-linked storage node.
link * replace(link *oldLink, link *newLink)
Replace oldLink with newLink and return element.
bool operator!=(const iterator &) const
iterator begin()
Iterator to first item in list with non-const access.
link * back()
Return last entry.
static const IteratorType & iterator_end()
Factory method to return an iterator end.
bool good() const noexcept
Pointing at a valid storage node.
const const_iterator & cend() const
End of list for iterators.
void next()
Move forward through list.
bool operator==(const iterator &) const
A primitive const node iterator (bidirectional).
A primitive non-const node iterator.
errorManip< error > abort(error &err)
friend class const_iterator
link * get_node() const noexcept
The storage node.
label size() const noexcept
The number of elements in list.
const NullObject * nullObjectPtr
Pointer to the unique nullObject.
const iterator & end()
End of list for iterators.
link * front()
Return first entry.
void operator=(const iterator &iter)
static const IteratorType & iterator_rend()
Factory method to return an iterator reverse end.
const_iterator cbegin() const
Iterator to first item in list with const access.
const_iterator crbegin() const
Iterator to last item in list with const access.
void prev()
Move backward through list.
bool good() const noexcept
Pointing at a valid storage node.
void clear()
Clear the list.
void next()
Move forward through list.
const link * get_node() const noexcept
The storage node.
IteratorType iterator_first() const
Return iterator to first item or end-iterator if list is empty.
IteratorType iterator_last() const
Return iterator to last item or end-iterator if list is empty.
void swap(DLListBase &lst)
Swap the contents of the list.