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

Const reference for mutating elements Using custom iterator for speed. More...

#include <segmented_list.hpp>

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

Public Member Functions

Optional< T > next ()
 Gets next item.
 

Public Attributes

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

Detailed Description

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

Const reference for mutating elements Using custom iterator for speed.

Definition at line 125 of file segmented_list.hpp.

Member Function Documentation

◆ next()

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

Gets next item.

Returns
Returns next elem or nullopt

Definition at line 135 of file segmented_list.hpp.

135 {
136 if (s == nullptr || index >= r.size()) {
137 return nullopt;
138 }
139 if (s->elements.size() <= segmentIndex) {
140 s = s->next;
141 segmentIndex = 0;
142 }
143 if (s == nullptr) {
144 return nullopt;
145 }
146 ++index;
147 return s->elements[segmentIndex++];
148 }
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 >::ConstIter::index = 0

Definition at line 126 of file segmented_list.hpp.

◆ r

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

Definition at line 127 of file segmented_list.hpp.

◆ s

template<typename T>
const Segment* mtcore::SegmentedList< T >::ConstIter::s

Definition at line 129 of file segmented_list.hpp.

◆ segmentIndex

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

Definition at line 128 of file segmented_list.hpp.


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