SleakEngine 1.0.0
C++23 multi-backend game engine
Loading...
Searching...
No Matches
Sleak::List< T > Class Template Reference

Implements a dynamic array-like list for storing and managing a collection of elements. More...

#include <List.hpp>

Inheritance diagram for Sleak::List< T >:

Public Member Functions

 List () noexcept=default
 List (const List &other)
 List (List &&other) noexcept
 List (std::initializer_list< T > initList)
 List (T *Data, size_t Size)
 Adopts an existing buffer directly; List takes ownership.
 ~List ()
 Frees the backing array.
void add (const T &value)
void add (std::initializer_list< T > AddList)
void add (T &&value)
T & at (size_t index)
const T & at (size_t index) const
T * begin ()
const T * begin () const
void clear ()
bool empty () const
T * end ()
const T * end () const
void erase (size_t index)
T * find (std::function< bool(const T &)> predicate)
const T * find (std::function< bool(const T &)> predicate) const
size_t GetByteSize () const
size_t GetCapacity () const
T * GetData ()
const T * GetData () const
void * GetRawData ()
const void * GetRawData () const
size_t GetSize () const
int32_t indexOf (const T &value)
void insert (size_t index, const T &value)
Listoperator= (const List &other)
Listoperator= (List &&other) noexcept
T & operator[] (size_t index)
const T & operator[] (size_t index) const
void release ()
void resize ()
void resize (size_t newCapacity)
void reverse ()
void sort (std::function< bool(const T &, const T &)> compare)
void swap (List &other) noexcept

Detailed Description

template<typename T>
class Sleak::List< T >

Implements a dynamic array-like list for storing and managing a collection of elements.

The List class provides a flexible and efficient way to store and access elements in a linear order. It is suitable for scenarios where you need to dynamically resize the collection or access elements by index.

Definition at line 20 of file List.hpp.

Constructor & Destructor Documentation

◆ List() [1/5]

template<typename T>
Sleak::List< T >::List ( )
defaultnoexcept

◆ List() [2/5]

template<typename T>
Sleak::List< T >::List ( T * Data,
size_t Size )
inline

Adopts an existing buffer directly; List takes ownership.

Definition at line 57 of file List.hpp.

◆ List() [3/5]

template<typename T>
Sleak::List< T >::List ( const List< T > & other)
inline

Definition at line 60 of file List.hpp.

◆ List() [4/5]

template<typename T>
Sleak::List< T >::List ( List< T > && other)
inlinenoexcept

Definition at line 68 of file List.hpp.

◆ List() [5/5]

template<typename T>
Sleak::List< T >::List ( std::initializer_list< T > initList)
inline

Definition at line 103 of file List.hpp.

◆ ~List()

template<typename T>
Sleak::List< T >::~List ( )
inline

Frees the backing array.

Definition at line 110 of file List.hpp.

Member Function Documentation

◆ add() [1/3]

template<typename T>
void Sleak::List< T >::add ( const T & value)
inline

Definition at line 113 of file List.hpp.

◆ add() [2/3]

template<typename T>
void Sleak::List< T >::add ( std::initializer_list< T > AddList)
inline

Definition at line 123 of file List.hpp.

◆ add() [3/3]

template<typename T>
void Sleak::List< T >::add ( T && value)
inline

Definition at line 118 of file List.hpp.

◆ at() [1/2]

template<typename T>
T & Sleak::List< T >::at ( size_t index)
inline

Definition at line 140 of file List.hpp.

◆ at() [2/2]

template<typename T>
const T & Sleak::List< T >::at ( size_t index) const
inline

Definition at line 145 of file List.hpp.

◆ begin() [1/2]

template<typename T>
T * Sleak::List< T >::begin ( )
inline

Definition at line 163 of file List.hpp.

◆ begin() [2/2]

template<typename T>
const T * Sleak::List< T >::begin ( ) const
inline

Definition at line 164 of file List.hpp.

◆ clear()

template<typename T>
void Sleak::List< T >::clear ( )
inline

Definition at line 169 of file List.hpp.

◆ empty()

template<typename T>
bool Sleak::List< T >::empty ( ) const
inline

Definition at line 154 of file List.hpp.

◆ end() [1/2]

template<typename T>
T * Sleak::List< T >::end ( )
inline

Definition at line 165 of file List.hpp.

◆ end() [2/2]

template<typename T>
const T * Sleak::List< T >::end ( ) const
inline

Definition at line 166 of file List.hpp.

◆ erase()

template<typename T>
void Sleak::List< T >::erase ( size_t index)
inline

Definition at line 215 of file List.hpp.

◆ find() [1/2]

template<typename T>
T * Sleak::List< T >::find ( std::function< bool(const T &)> predicate)
inline

Definition at line 245 of file List.hpp.

◆ find() [2/2]

template<typename T>
const T * Sleak::List< T >::find ( std::function< bool(const T &)> predicate) const
inline

Definition at line 252 of file List.hpp.

◆ GetByteSize()

template<typename T>
size_t Sleak::List< T >::GetByteSize ( ) const
inline

Definition at line 152 of file List.hpp.

◆ GetCapacity()

template<typename T>
size_t Sleak::List< T >::GetCapacity ( ) const
inline

Definition at line 153 of file List.hpp.

◆ GetData() [1/2]

template<typename T>
T * Sleak::List< T >::GetData ( )
inline

Definition at line 157 of file List.hpp.

◆ GetData() [2/2]

template<typename T>
const T * Sleak::List< T >::GetData ( ) const
inline

Definition at line 158 of file List.hpp.

◆ GetRawData() [1/2]

template<typename T>
void * Sleak::List< T >::GetRawData ( )
inline

Definition at line 159 of file List.hpp.

◆ GetRawData() [2/2]

template<typename T>
const void * Sleak::List< T >::GetRawData ( ) const
inline

Definition at line 160 of file List.hpp.

◆ GetSize()

template<typename T>
size_t Sleak::List< T >::GetSize ( ) const
inline

Definition at line 151 of file List.hpp.

◆ indexOf()

template<typename T>
int32_t Sleak::List< T >::indexOf ( const T & value)
inline

Definition at line 259 of file List.hpp.

◆ insert()

template<typename T>
void Sleak::List< T >::insert ( size_t index,
const T & value )
inline

Definition at line 204 of file List.hpp.

◆ operator=() [1/2]

template<typename T>
List & Sleak::List< T >::operator= ( const List< T > & other)
inline

Definition at line 76 of file List.hpp.

◆ operator=() [2/2]

template<typename T>
List & Sleak::List< T >::operator= ( List< T > && other)
inlinenoexcept

Definition at line 90 of file List.hpp.

◆ operator[]() [1/2]

template<typename T>
T & Sleak::List< T >::operator[] ( size_t index)
inline

Definition at line 130 of file List.hpp.

◆ operator[]() [2/2]

template<typename T>
const T & Sleak::List< T >::operator[] ( size_t index) const
inline

Definition at line 135 of file List.hpp.

◆ release()

template<typename T>
void Sleak::List< T >::release ( )
inline

Definition at line 180 of file List.hpp.

◆ resize() [1/2]

template<typename T>
void Sleak::List< T >::resize ( )
inline

Definition at line 187 of file List.hpp.

◆ resize() [2/2]

template<typename T>
void Sleak::List< T >::resize ( size_t newCapacity)
inline

Definition at line 192 of file List.hpp.

◆ reverse()

template<typename T>
void Sleak::List< T >::reverse ( )
inline

Definition at line 232 of file List.hpp.

◆ sort()

template<typename T>
void Sleak::List< T >::sort ( std::function< bool(const T &, const T &)> compare)
inline

Definition at line 228 of file List.hpp.

◆ swap()

template<typename T>
void Sleak::List< T >::swap ( List< T > & other)
inlinenoexcept

Definition at line 238 of file List.hpp.