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

Pointer iterator for mutating elements Using custom iterator for speed. More...

#include <segmented_list.hpp>

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

Public Member Functions

Optional< T * > next ()
 Gets next item.
 

Public Attributes

size_t index = 0
 
const SegmentedListr
 
size_t segmentIndex = 0
 
Segment * s
 

Detailed Description

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

Pointer iterator for mutating elements Using custom iterator for speed.

Definition at line 65 of file segmented_list.hpp.

Member Function Documentation

◆ next()

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

Gets next item.

Returns
Returns next elem or nullopt

Definition at line 75 of file segmented_list.hpp.

75 {
76 if (s == nullptr || index >= r.size()) {
77 return nullopt;
78 }
79 if (s->elements.size() <= segmentIndex) {
80 s = s->next;
81 segmentIndex = 0;
82 }
83 if (s == nullptr) {
84 return nullopt;
85 }
86 ++index;
87 return &s->elements[segmentIndex++];
88 }
Segmented list where each segment contains multiple nodes Allows growing the list without having to i...

Member Data Documentation

◆ index

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

Definition at line 66 of file segmented_list.hpp.

◆ r

template<typename T>
const SegmentedList& mtcore::SegmentedList< T >::PtrIter::r

Definition at line 67 of file segmented_list.hpp.

◆ s

template<typename T>
Segment* mtcore::SegmentedList< T >::PtrIter::s

Definition at line 69 of file segmented_list.hpp.

◆ segmentIndex

template<typename T>
size_t mtcore::SegmentedList< T >::PtrIter::segmentIndex = 0

Definition at line 68 of file segmented_list.hpp.


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