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 212 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 220 of file gen_list.hpp.

220 {
221 while (index < list.entries.size()) {
222 mtdefer { ++index; };
223 if (list.dead[index]) {
224 continue;
225 }
226 return &list.entries[index].item;
227 }
228 return nullopt;
229 }
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 214 of file gen_list.hpp.

◆ list

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

Definition at line 213 of file gen_list.hpp.


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