COROIO: NNet::NDetail::TIntrusiveList< T > Class Template Reference
COROIO
Loading...
Searching...
No Matches
NNet::NDetail::TIntrusiveList< T > Class Template Reference

Doubly linked list of objects derived from TIntrusiveNode. More...

#include <intrusive_list.hpp>

Classes

class  TIterator

Public Member Functions

 TIntrusiveList (const TIntrusiveList &)=delete
TIntrusiveList & operator= (const TIntrusiveList &)=delete
bool Empty () const
T & Front ()
 The first object. The list must not be empty.
void PushFront (T &item)
void PushBack (T &item)
TIterator begin ()
TIterator end ()

Static Public Member Functions

static void Erase (T &item)
 Removes an object from the list it is in, in O(1).

Detailed Description

template<typename T>
class NNet::NDetail::TIntrusiveList< T >

Doubly linked list of objects derived from TIntrusiveNode.

The list does not own its objects: it only links them, without allocating. It is circular around a sentinel node, so linking and unlinking do not branch. The sentinel points to itself, so the list can be neither copied nor moved. Objects must be unlinked before they are destroyed.

struct TItem: NDetail::TIntrusiveNode<TItem> { int Value = 0; };
TItem a, b;
list.PushBack(a);
list.PushFront(b);
for (auto& item : list) { ... } // b, a
list.Erase(a);
Doubly linked list of objects derived from TIntrusiveNode.
Definition intrusive_list.hpp:63
Links of an object in a TIntrusiveList.
Definition intrusive_list.hpp:17

The documentation for this class was generated from the following file: