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

An iterator that iterates over values (copies) of each stored element. More...

#include <gen_list.hpp>

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

Public Member Functions

Optional< T > next ()
 Gets the next element.
 

Public Attributes

const GenListlist
 
size_t index = 0
 

Detailed Description

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

An iterator that iterates over values (copies) of each stored element.

Definition at line 235 of file gen_list.hpp.

Member Function Documentation

◆ next()

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

Gets the next element.

Returns
Copy of next element or nullopt if at end

Definition at line 243 of file gen_list.hpp.

243 {
244 while (index < list.entries.size()) {
245 mtdefer { ++index; };
246 if (list.dead[index]) {
247 continue;
248 }
249 return list.entries[index].item;
250 }
251 return nullopt;
252 }
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 >::ConstIter::index = 0

Definition at line 237 of file gen_list.hpp.

◆ list

template<typename T>
const GenList& mtcore::GenList< T >::ConstIter::list

Definition at line 236 of file gen_list.hpp.


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