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

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

#include <segmented_list.hpp>

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

Public Member Functions

Optional< const 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 >::ConstPtrIter

Pointer iterator for mutating elements Using custom iterator for speed.

Definition at line 95 of file segmented_list.hpp.

Member Function Documentation

◆ next()

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

Gets next item.

Returns
Returns next elem or nullopt

Definition at line 105 of file segmented_list.hpp.

105 {
106 if (s == nullptr || index >= r.size()) {
107 return nullopt;
108 }
109 if (s->elements.size() <= segmentIndex) {
110 s = s->next;
111 segmentIndex = 0;
112 }
113 if (s == nullptr) {
114 return nullopt;
115 }
116 ++index;
117 return &s->elements[segmentIndex++];
118 }
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 >::ConstPtrIter::index = 0

Definition at line 96 of file segmented_list.hpp.

◆ r

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

Definition at line 97 of file segmented_list.hpp.

◆ s

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

Definition at line 99 of file segmented_list.hpp.

◆ segmentIndex

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

Definition at line 98 of file segmented_list.hpp.


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