Hubris Engine Dev
A Project to learn and get into Game Engine developement.
 
Loading...
Searching...
No Matches
Hubris::List< T > Class Template Reference

A generic dynamic array container that manages a sequence of elements of type T, providing memory management, element access, and basic list operations with error handling. More...

#include <List.h>

Public Types

enum class  Result { Success , OutOfMemory , OutOfRange , InvalidArgument }
 
using value_type = T
 
using size_type = std::size_t
 
using difference_type = std::ptrdiff_t
 
using reference = T&
 
using const_reference = const T&
 
using pointer = T*
 
using const_pointer = const T*
 
using iterator = T*
 
using const_iterator = const T*
 
using reverse_iterator = std::reverse_iterator<iterator>
 
using const_reverse_iterator = std::reverse_iterator<const_iterator>
 

Public Member Functions

 List () noexcept
 
 List (size_type count) noexcept
 
 List (size_type count, const T &value) noexcept
 
template<typename InputIt>
 List (InputIt first, InputIt last) noexcept
 
 List (std::initializer_list< T > init) noexcept
 
 List (const List &other) noexcept
 
 List (List &&other) noexcept
 
 ~List ()
 
bool is_valid () const noexcept
 
Listoperator= (const List &other) noexcept
 
Listoperator= (List &&other) noexcept
 
Listoperator= (std::initializer_list< T > init) noexcept
 
Result assign (size_type count, const T &value) noexcept
 
template<typename InputIt>
Result assign (InputIt first, InputIt last) noexcept
 
Result assign (std::initializer_list< T > init) noexcept
 
Result at (size_type pos, reference &out) noexcept
 
Result at (size_type pos, const_reference &out) const noexcept
 
reference operator[] (size_type pos) noexcept
 
const_reference operator[] (size_type pos) const noexcept
 
T * get (size_type pos) noexcept
 
const T * get (size_type pos) const noexcept
 
reference front () noexcept
 
const_reference front () const noexcept
 
reference back () noexcept
 
const_reference back () const noexcept
 
T * data () noexcept
 
const T * data () const noexcept
 
iterator begin () noexcept
 
const_iterator begin () const noexcept
 
const_iterator cbegin () const noexcept
 
iterator end () noexcept
 
const_iterator end () const noexcept
 
const_iterator cend () const noexcept
 
reverse_iterator rbegin () noexcept
 
const_reverse_iterator rbegin () const noexcept
 
const_reverse_iterator crbegin () const noexcept
 
reverse_iterator rend () noexcept
 
const_reverse_iterator rend () const noexcept
 
const_reverse_iterator crend () const noexcept
 
bool empty () const noexcept
 
size_type size () const noexcept
 
size_type max_size () const noexcept
 
Result reserve (size_type new_capacity) noexcept
 
size_type capacity () const noexcept
 
Result shrink_to_fit () noexcept
 
void clear () noexcept
 
Result push_back (const T &value) noexcept
 
Result push_back (T &&value) noexcept
 
template<typename... Args>
Result emplace_back (Args &&... args) noexcept
 
Result pop_back () noexcept
 
Result resize (size_type count) noexcept
 
Result resize (size_type count, const T &value) noexcept
 
void swap (List &other) noexcept
 
Result insert (size_type pos, const T &value) noexcept
 
Result erase (size_type pos) noexcept
 

Detailed Description

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

A generic dynamic array container that manages a sequence of elements of type T, providing memory management, element access, and basic list operations with error handling.

Template Parameters
TThe type of elements stored in the list.
Note
: Remove Iterators or reimplement them.

Definition at line 56 of file List.h.

Member Typedef Documentation

◆ const_iterator

template<typename T>
using Hubris::List< T >::const_iterator = const T*

Definition at line 66 of file List.h.

◆ const_pointer

template<typename T>
using Hubris::List< T >::const_pointer = const T*

Definition at line 64 of file List.h.

◆ const_reference

template<typename T>
using Hubris::List< T >::const_reference = const T&

Definition at line 62 of file List.h.

◆ const_reverse_iterator

template<typename T>
using Hubris::List< T >::const_reverse_iterator = std::reverse_iterator<const_iterator>

Definition at line 68 of file List.h.

◆ difference_type

template<typename T>
using Hubris::List< T >::difference_type = std::ptrdiff_t

Definition at line 60 of file List.h.

◆ iterator

template<typename T>
using Hubris::List< T >::iterator = T*

Definition at line 65 of file List.h.

◆ pointer

template<typename T>
using Hubris::List< T >::pointer = T*

Definition at line 63 of file List.h.

◆ reference

template<typename T>
using Hubris::List< T >::reference = T&

Definition at line 61 of file List.h.

◆ reverse_iterator

template<typename T>
using Hubris::List< T >::reverse_iterator = std::reverse_iterator<iterator>

Definition at line 67 of file List.h.

◆ size_type

template<typename T>
using Hubris::List< T >::size_type = std::size_t

Definition at line 59 of file List.h.

◆ value_type

template<typename T>
using Hubris::List< T >::value_type = T

Definition at line 58 of file List.h.

Member Enumeration Documentation

◆ Result

template<typename T>
enum class Hubris::List::Result
strong
Enumerator
Success 
OutOfMemory 
OutOfRange 
InvalidArgument 

Definition at line 71 of file List.h.

Constructor & Destructor Documentation

◆ List() [1/7]

template<typename T>
Hubris::List< T >::List ( )
inlinenoexcept

Definition at line 233 of file List.h.

+ Here is the caller graph for this function:

◆ List() [2/7]

template<typename T>
Hubris::List< T >::List ( size_type count)
inlineexplicitnoexcept

Definition at line 235 of file List.h.

◆ List() [3/7]

template<typename T>
Hubris::List< T >::List ( size_type count,
const T & value )
inlinenoexcept

Definition at line 255 of file List.h.

◆ List() [4/7]

template<typename T>
template<typename InputIt>
Hubris::List< T >::List ( InputIt first,
InputIt last )
inlinenoexcept

Definition at line 276 of file List.h.

+ Here is the call graph for this function:

◆ List() [5/7]

template<typename T>
Hubris::List< T >::List ( std::initializer_list< T > init)
inlinenoexcept

Definition at line 305 of file List.h.

◆ List() [6/7]

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

Definition at line 308 of file List.h.

+ Here is the call graph for this function:

◆ List() [7/7]

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

Definition at line 330 of file List.h.

+ Here is the call graph for this function:

◆ ~List()

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

Definition at line 339 of file List.h.

Member Function Documentation

◆ assign() [1/3]

template<typename T>
template<typename InputIt>
Result Hubris::List< T >::assign ( InputIt first,
InputIt last )
inlinenoexcept

Definition at line 451 of file List.h.

+ Here is the call graph for this function:

◆ assign() [2/3]

template<typename T>
Result Hubris::List< T >::assign ( size_type count,
const T & value )
inlinenoexcept

Definition at line 418 of file List.h.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ assign() [3/3]

template<typename T>
Result Hubris::List< T >::assign ( std::initializer_list< T > init)
inlinenoexcept

Definition at line 462 of file List.h.

+ Here is the call graph for this function:

◆ at() [1/2]

template<typename T>
Result Hubris::List< T >::at ( size_type pos,
const_reference & out ) const
inlinenoexcept

Definition at line 474 of file List.h.

◆ at() [2/2]

template<typename T>
Result Hubris::List< T >::at ( size_type pos,
reference & out )
inlinenoexcept

Definition at line 467 of file List.h.

◆ back() [1/2]

template<typename T>
const_reference Hubris::List< T >::back ( ) const
inlinenoexcept

Definition at line 513 of file List.h.

◆ back() [2/2]

template<typename T>
reference Hubris::List< T >::back ( )
inlinenoexcept

Definition at line 509 of file List.h.

◆ begin() [1/2]

template<typename T>
const_iterator Hubris::List< T >::begin ( ) const
inlinenoexcept

Definition at line 527 of file List.h.

◆ begin() [2/2]

template<typename T>
iterator Hubris::List< T >::begin ( )
inlinenoexcept

Definition at line 526 of file List.h.

+ Here is the caller graph for this function:

◆ capacity()

template<typename T>
size_type Hubris::List< T >::capacity ( ) const
inlinenoexcept

Definition at line 563 of file List.h.

◆ cbegin()

template<typename T>
const_iterator Hubris::List< T >::cbegin ( ) const
inlinenoexcept

Definition at line 528 of file List.h.

◆ cend()

template<typename T>
const_iterator Hubris::List< T >::cend ( ) const
inlinenoexcept

Definition at line 532 of file List.h.

◆ clear()

template<typename T>
void Hubris::List< T >::clear ( )
inlinenoexcept

Definition at line 576 of file List.h.

◆ crbegin()

template<typename T>
const_reverse_iterator Hubris::List< T >::crbegin ( ) const
inlinenoexcept

Definition at line 536 of file List.h.

+ Here is the call graph for this function:

◆ crend()

template<typename T>
const_reverse_iterator Hubris::List< T >::crend ( ) const
inlinenoexcept

Definition at line 540 of file List.h.

+ Here is the call graph for this function:

◆ data() [1/2]

template<typename T>
const T * Hubris::List< T >::data ( ) const
inlinenoexcept

Definition at line 521 of file List.h.

◆ data() [2/2]

template<typename T>
T * Hubris::List< T >::data ( )
inlinenoexcept

Definition at line 517 of file List.h.

◆ emplace_back()

template<typename T>
template<typename... Args>
Result Hubris::List< T >::emplace_back ( Args &&... args)
inlinenoexcept

Definition at line 620 of file List.h.

◆ empty()

template<typename T>
bool Hubris::List< T >::empty ( ) const
inlinenoexcept

Definition at line 543 of file List.h.

◆ end() [1/2]

template<typename T>
const_iterator Hubris::List< T >::end ( ) const
inlinenoexcept

Definition at line 531 of file List.h.

◆ end() [2/2]

template<typename T>
iterator Hubris::List< T >::end ( )
inlinenoexcept

Definition at line 530 of file List.h.

+ Here is the caller graph for this function:

◆ erase()

template<typename T>
Result Hubris::List< T >::erase ( size_type pos)
inlinenoexcept

Definition at line 741 of file List.h.

◆ front() [1/2]

template<typename T>
const_reference Hubris::List< T >::front ( ) const
inlinenoexcept

Definition at line 505 of file List.h.

◆ front() [2/2]

template<typename T>
reference Hubris::List< T >::front ( )
inlinenoexcept

Definition at line 501 of file List.h.

◆ get() [1/2]

template<typename T>
const T * Hubris::List< T >::get ( size_type pos) const
inlinenoexcept

Definition at line 496 of file List.h.

◆ get() [2/2]

template<typename T>
T * Hubris::List< T >::get ( size_type pos)
inlinenoexcept

Definition at line 491 of file List.h.

◆ insert()

template<typename T>
Result Hubris::List< T >::insert ( size_type pos,
const T & value )
inlinenoexcept

Definition at line 703 of file List.h.

◆ is_valid()

template<typename T>
bool Hubris::List< T >::is_valid ( ) const
inlinenoexcept

Definition at line 345 of file List.h.

◆ max_size()

template<typename T>
size_type Hubris::List< T >::max_size ( ) const
inlinenoexcept

Definition at line 551 of file List.h.

◆ operator=() [1/3]

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

Definition at line 350 of file List.h.

+ Here is the call graph for this function:

◆ operator=() [2/3]

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

Definition at line 394 of file List.h.

+ Here is the call graph for this function:

◆ operator=() [3/3]

template<typename T>
List & Hubris::List< T >::operator= ( std::initializer_list< T > init)
inlinenoexcept

Definition at line 412 of file List.h.

+ Here is the call graph for this function:

◆ operator[]() [1/2]

template<typename T>
const_reference Hubris::List< T >::operator[] ( size_type pos) const
inlinenoexcept

Definition at line 486 of file List.h.

◆ operator[]() [2/2]

template<typename T>
reference Hubris::List< T >::operator[] ( size_type pos)
inlinenoexcept

Definition at line 482 of file List.h.

◆ pop_back()

template<typename T>
Result Hubris::List< T >::pop_back ( )
inlinenoexcept

Definition at line 638 of file List.h.

◆ push_back() [1/2]

template<typename T>
Result Hubris::List< T >::push_back ( const T & value)
inlinenoexcept

Definition at line 583 of file List.h.

+ Here is the caller graph for this function:

◆ push_back() [2/2]

template<typename T>
Result Hubris::List< T >::push_back ( T && value)
inlinenoexcept

Definition at line 601 of file List.h.

◆ rbegin() [1/2]

template<typename T>
const_reverse_iterator Hubris::List< T >::rbegin ( ) const
inlinenoexcept

Definition at line 535 of file List.h.

+ Here is the call graph for this function:

◆ rbegin() [2/2]

template<typename T>
reverse_iterator Hubris::List< T >::rbegin ( )
inlinenoexcept

Definition at line 534 of file List.h.

+ Here is the call graph for this function:

◆ rend() [1/2]

template<typename T>
const_reverse_iterator Hubris::List< T >::rend ( ) const
inlinenoexcept

Definition at line 539 of file List.h.

+ Here is the call graph for this function:

◆ rend() [2/2]

template<typename T>
reverse_iterator Hubris::List< T >::rend ( )
inlinenoexcept

Definition at line 538 of file List.h.

+ Here is the call graph for this function:

◆ reserve()

template<typename T>
Result Hubris::List< T >::reserve ( size_type new_capacity)
inlinenoexcept

Definition at line 555 of file List.h.

◆ resize() [1/2]

template<typename T>
Result Hubris::List< T >::resize ( size_type count)
inlinenoexcept

Definition at line 647 of file List.h.

◆ resize() [2/2]

template<typename T>
Result Hubris::List< T >::resize ( size_type count,
const T & value )
inlinenoexcept

Definition at line 671 of file List.h.

◆ shrink_to_fit()

template<typename T>
Result Hubris::List< T >::shrink_to_fit ( )
inlinenoexcept

Definition at line 567 of file List.h.

◆ size()

template<typename T>
size_type Hubris::List< T >::size ( ) const
inlinenoexcept

Definition at line 547 of file List.h.

◆ swap()

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

Definition at line 695 of file List.h.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

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