MT Core (C++)
Core library for replacing C++ standard in project usage
Loading...
Searching...
No Matches
mtcore::GenList< T >::PtrIter Struct Reference

An iterator that iterates over pointers to each stored element. More...

#include <gen_list.hpp>

Collaboration diagram for mtcore::GenList< T >::PtrIter:

Public Member Functions

Optional< T * > next ()
 Gets the pointer to the next stored element.
 

Public Attributes

GenListlist
 
size_t index = 0
 

Detailed Description

template<typename T>
struct mtcore::GenList< T >::PtrIter

An iterator that iterates over pointers to each stored element.

Definition at line 214 of file gen_list.hpp.

Member Function Documentation

◆ next()

template<typename T>
Optional< T * > mtcore::GenList< T >::PtrIter::next ( )
inline

Gets the pointer to the next stored element.

Returns
Pointer to next stored element or nullopt if at end

Definition at line 222 of file gen_list.hpp.

222 {
223 while (index < list.entries.size()) {
224 mtdefer { ++index; };
225 if (list.dead[index]) {
226 continue;
227 }
228 return &list.entries[index].item;
229 }
230 return nullopt;
231 }
Represents a generational list where removed items are marked and recycled.
Definition gen_list.hpp:59

Member Data Documentation

◆ index

template<typename T>
size_t mtcore::GenList< T >::PtrIter::index = 0

Definition at line 216 of file gen_list.hpp.

◆ list

template<typename T>
GenList& mtcore::GenList< T >::PtrIter::list

Definition at line 215 of file gen_list.hpp.


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