Gaia-ECS v1.0.0
A simple and powerful entity component system
Loading...
Searching...
No Matches
gaia::cnt::fwd_llist< T > Struct Template Reference

Forward list container. No memory allocation is performed because the list is stored directly inside allocated nodes. Inserts: O(1) Removals: O(1) Iteration: O(N) More...

#include <fwd_llist.h>

Public Member Functions

void clear ()
 Clears the list.
 
void link (T *pNode)
 Links the node in the list.
 
void unlink (T *pNode)
 Unlinks the node from the list.
 
GAIA_NODISCARD bool has (T *pNode) const
 Checks whether a node is linked in this list.
 
GAIA_NODISCARD bool empty () const
 Returns true if the list is empty. False otherwise.
 
GAIA_NODISCARD uint32_t size () const
 Returns the number of nodes linked in the list.
 
fwd_llist_iterator< Tbegin ()
 Returns an iterator to the first node.
 
fwd_llist_iterator< const Tbegin () const
 Returns an iterator to the first node.
 
fwd_llist_iterator< const Tcbegin () const
 Returns an iterator to the first node.
 
fwd_llist_iterator< Tend ()
 Returns the mutable end sentinel.
 
fwd_llist_iterator< const Tend () const
 Returns the const end sentinel.
 
fwd_llist_iterator< const Tcend () const
 Returns the const end sentinel.
 

Public Attributes

uint32_t count = 0
 Number of linked nodes.
 
Tfirst = nullptr
 First linked node, or nullptr when empty.
 

Detailed Description

template<class T>
struct gaia::cnt::fwd_llist< T >

Forward list container. No memory allocation is performed because the list is stored directly inside allocated nodes. Inserts: O(1) Removals: O(1) Iteration: O(N)

Member Function Documentation

◆ begin() [1/2]

template<class T >
fwd_llist_iterator< T > gaia::cnt::fwd_llist< T >::begin ( )
inline

Returns an iterator to the first node.

Returns
Mutable iterator to the first node, or end() when empty.

◆ begin() [2/2]

template<class T >
fwd_llist_iterator< const T > gaia::cnt::fwd_llist< T >::begin ( ) const
inline

Returns an iterator to the first node.

Returns
Const iterator to the first node, or end() when empty.

◆ cbegin()

template<class T >
fwd_llist_iterator< const T > gaia::cnt::fwd_llist< T >::cbegin ( ) const
inline

Returns an iterator to the first node.

Returns
Const iterator to the first node, or cend() when empty.

◆ cend()

template<class T >
fwd_llist_iterator< const T > gaia::cnt::fwd_llist< T >::cend ( ) const
inline

Returns the const end sentinel.

Returns
Const end sentinel.

◆ empty()

template<class T >
GAIA_NODISCARD bool gaia::cnt::fwd_llist< T >::empty ( ) const
inline

Returns true if the list is empty. False otherwise.

Returns
True when the list has no nodes. False otherwise.

◆ end() [1/2]

template<class T >
fwd_llist_iterator< T > gaia::cnt::fwd_llist< T >::end ( )
inline

Returns the mutable end sentinel.

Returns
Mutable end sentinel.

◆ end() [2/2]

template<class T >
fwd_llist_iterator< const T > gaia::cnt::fwd_llist< T >::end ( ) const
inline

Returns the const end sentinel.

Returns
Const end sentinel.

◆ has()

template<class T >
GAIA_NODISCARD bool gaia::cnt::fwd_llist< T >::has ( T pNode) const
inline

Checks whether a node is linked in this list.

Parameters
pNodeNode to find.
Returns
True when the node belongs to this list. False otherwise.

◆ link()

template<class T >
void gaia::cnt::fwd_llist< T >::link ( T pNode)
inline

Links the node in the list.

Parameters
pNodeUnlinked node to insert at the front.

◆ size()

template<class T >
GAIA_NODISCARD uint32_t gaia::cnt::fwd_llist< T >::size ( ) const
inline

Returns the number of nodes linked in the list.

Returns
Number of linked nodes.

◆ unlink()

template<class T >
void gaia::cnt::fwd_llist< T >::unlink ( T pNode)
inline

Unlinks the node from the list.

Parameters
pNodeNode currently linked in this list.

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