MT Core (C++)
Core library for replacing C++ standard in project usage
Loading...
Searching...
No Matches
iter.hpp File Reference
#include "../traits.hpp"
#include "optional.hpp"
Include dependency graph for iter.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  mtcore::PtrIter< T >
 Iterator that gives pointers to elements of a collection. More...
 
struct  mtcore::ConstPtrIter< T >
 Iterator that gives const pointers to elements of a collection. More...
 
struct  mtcore::ValIter< T >
 Iterator that gives copies of elements of a collection. More...
 

Namespaces

namespace  mtcore
 Core library for C++ with Zig-related functionality.
 
namespace  mtcore::iter
 Generic iterator defaults built on common contracts Does not guarantee performance of iterators Actual performance is \(O(N * complexityOfOperator[])\) IE an operator[] with \(O(1)\) will get an iterator complexity of \(O(N)\), while an operator[] with \(O(N)\) will get an iterator complexity of \(O(N^2)\).
 

Functions

template<typename T>
PtrIter< T > mtcore::iter::ptr (T &r)
 Generic pointer iterator that uses the operator[] and incrementing indexes to iterate over a collection Returns pointers to elements inside the collection (can be modified)
 
template<typename T>
ValIter< T > mtcore::iter::val (const T &r)
 Generic value iterator that uses the operator[] and incrementing indexes to iterate over a collection Does copies when iterating`.
 
template<typename T>
ConstPtrIter< T > mtcore::iter::const_ptr (const T &r)
 Generic constant pointer iterator that uses the operator[] and incrementing indexes to iterate over a collection Returns constant pointers to elements inside the collection (cannot be modified) Useful for reads while avoiding copies.