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

An iterator that iterates over all handles of each stored element. More...

#include <gen_list.hpp>

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

Public Member Functions

Optional< Handlenext ()
 Gets the next element.
 

Public Attributes

const GenListlist
 
size_t index = 0
 

Detailed Description

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

An iterator that iterates over all handles of each stored element.

Definition at line 258 of file gen_list.hpp.

Member Function Documentation

◆ next()

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

Gets the next element.

Returns
Handle of next element or nullopt if at end

Definition at line 266 of file gen_list.hpp.

266 {
267 while (index < list.entries.size()) {
268 mtdefer { ++index; };
269 if (list.dead[index]) {
270 continue;
271 }
272 return Handle{index, list.entries[index].generation};
273 }
274 return nullopt;
275 }
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 >::HandleIter::index = 0

Definition at line 260 of file gen_list.hpp.

◆ list

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

Definition at line 259 of file gen_list.hpp.


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