36template <
class T,
class TAlloc = TDefaultAllocator<T>>
102 bool operator == (const
TList<T, TAlloc> &rOther) const;
105 TList<T, TAlloc> &operator = (const
TList<T, TAlloc> &rOther);
141 Node *mNode{
nullptr};
148 Node *mPrev{
nullptr};
149 Node *mNext{
nullptr};
151 Node(
const T &rItem);
152 void setNext(Node *pNode);
153 Node *getNext()
const;
154 void setPrev(Node *pNode);
155 Node *getPrev()
const;
159 Node *mFist{
nullptr};
160 Node *mLast{
nullptr};
164template <
class T,
class TAlloc>
172template <
class T,
class TAlloc>
177template <
class T,
class TAlloc>
180 Node *current = rhs.mFist;
181 if (
nullptr == current) {
185 Node *prevNode =
nullptr;
187 mLast =
new Node(current->mItem);
192 if (
nullptr != prevNode) {
193 mLast->setPrev(prevNode);
194 prevNode->setNext(mLast);
197 current = current->getNext();
203template <
class T,
class TAlloc>
205 Node *node =
new Node(item);
206 if (
nullptr == mFist) {
210 node->setNext(mFist);
211 mFist->setPrev(node);
219template <
class T,
class TAlloc>
221 Node *node =
new Node(item);
222 if (
nullptr == mFist) {
226 node->setPrev(mLast);
227 mLast->setNext(node);
235template <
class T,
class TAlloc>
237 Node *tmp = mFist->getNext();
239 tmp->setPrev(
nullptr);
247template <
class T,
class TAlloc>
249 Node *last = mLast->getPrev();
250 last->setNext(
nullptr);
256template <
class T,
class TAlloc>
258 assert(
nullptr != mFist);
260 return (mFist->mItem);
263template <
class T,
class TAlloc>
265 assert(
nullptr != mLast);
267 return (mLast->mItem);
270template <
class T,
class TAlloc>
275template <
class T,
class TAlloc>
277 return (0u == mSize);
280template <
class T,
class TAlloc>
286 Node *current = mFist;
287 while (mFist->getNext()) {
289 mFist = mFist->getNext();
298template <
class T,
class TAlloc>
307template <
class T,
class TAlloc>
312template <
class T,
class TAlloc>
314 if (mSize != rhs.mSize) {
320 if (!(*it == *otherIt)) {
328template <
class T,
class TAlloc>
342template <
class T,
class TAlloc>
343inline TList<T, TAlloc>::Node::Node(
const T &item) :
350template <
class T,
class TAlloc>
351inline void TList<T, TAlloc>::Node::setNext(Node *pNode) {
355template <
class T,
class TAlloc>
360template <
class T,
class TAlloc>
365template <
class T,
class TAlloc>
370template <
class T,
class TAlloc>
375template <
class T,
class TAlloc>
381template <
class T,
class TAlloc>
387template <
class T,
class TAlloc>
393template <
class T,
class TAlloc>
404template <
class T,
class TAlloc>
406 return (mNode == rhs.mNode);
409template <
class T,
class TAlloc>
411 return (mNode != rhs.mNode);
414template <
class T,
class TAlloc>
416 assert(
nullptr != mNode);
419 mNode = mNode->getNext();
424template <
class T,
class TAlloc>
426 assert(
nullptr != mNode);
428 mNode = mNode->getNext();
433template <
class T,
class TAlloc>
435 assert(
nullptr != mNode);
438 mNode = mNode->getPrev();
443template <
class T,
class TAlloc>
445 assert(
nullptr != mNode);
447 mNode = mNode->getPrev();
452template <
class T,
class TAlloc>
454 assert(
nullptr != mNode);
456 return &(mNode->mItem);
459template <
class T,
class TAlloc>
461 assert(
nullptr != mNode);
Access implementation class.
Iterator & operator--()
The pre-decrement operator.
bool operator==(const Iterator &rOther) const
The compare operator.
~Iterator()=default
The destructor, non virtual.
bool operator!=(const Iterator &rOther) const
The not equal operator.
T & operator*() const
The dereference operator.
Iterator & operator=(const Iterator &rOther)
The assignment operator.
const Iterator & operator++(int)
The post increment operator.
T * operator->() const
The -> operator.
Iterator()
The default class constructor.
Iterator & operator++()
The pre-increment operator.
const Iterator & operator--(int)
The post decrement operator.
Iterator begin() const
Returns the iterator showing to the first entry.
Iterator addBack(const T &item)
Adds a new item at the back of the list.
TList< T, TAlloc > & operator=(const TList< T, TAlloc > &rOther)
Assignment operator.
void removeFront()
The first item will be removed.
Iterator end() const
Returns the iterator showing to the last entry.
T & front() const
Returns the first item.
void removeBack()
The hast item will be removed.
T & back() const
Returns the last item.
Iterator addFront(const T &item)
Adds a new item at the front of the list.
bool operator==(const TList< T, TAlloc > &rOther) const
Compare operator.
TList() noexcept=default
The class default constructor.
void clear()
The list will be cleared.
~TList()
The class destructor.
bool isEmpty() const
Returns true, if the list is empty.
void copyFrom(const TList< T, TAlloc > &rOther)
Copy the data from a given instance.
size_t size() const
The number of stored items will be returned.