XII Release 0.1.0
Loading...
Searching...
No Matches
xiiRangeView< ValueType, IteratorType > Class Template Reference

Copyright (c) Theophilus Eriata. All Rights Reserved. More...

#include <RangeView.h>

Classes

struct  ConstIterator
 Const iterator, don't use directly, use ranged based for loops or call begin() end(). More...
struct  Iterator
 Iterator, don't use directly, use ranged based for loops or call begin() end(). More...

Public Types

using BeginCallback = xiiDelegate<IteratorType()>
using EndCallback = xiiDelegate<IteratorType()>
using NextCallback = xiiDelegate<void(IteratorType&)>
using ValueCallback = xiiDelegate<ValueType(const IteratorType&)>

Public Member Functions

XII_ALWAYS_INLINE xiiRangeView (BeginCallback begin, EndCallback end, NextCallback next, ValueCallback value)
 Initializes the xiiRangeView with the delegates used to enumerate the range.
Iterator begin ()
Iterator end ()
ConstIterator begin () const
ConstIterator end () const
ConstIterator cbegin () const
ConstIterator cend () const

Friends

struct Iterator
struct ConstIterator

Detailed Description

template<typename ValueType, typename IteratorType>
class xiiRangeView< ValueType, IteratorType >

Copyright (c) Theophilus Eriata. All Rights Reserved.

This class uses delegates to define a range of values that can be enumerated using a forward iterator.

Can be used to create a contiguous view to elements of a certain type without the need for them to actually exist in the same space or format. Think of IEnumerable in c# using composition via xiiDelegate instead of derivation. ValueType defines the value type we are iterating over and IteratorType is the internal key to identify an element. An example that creates a RangeView of strings that are stored in a linear array of structs.

[this]()-> xiiUInt32 { return 0; },
[this]()-> xiiUInt32 { return array.GetCount(); },
[this](xiiUInt32& it) { ++it; },
[this](const xiiUInt32& it)-> const char* { return array[it].m_String; });
for (const char* szValue : range)
{
}
XII_ALWAYS_INLINE xiiRangeView(BeginCallback begin, EndCallback end, NextCallback next, ValueCallback value)
Initializes the xiiRangeView with the delegates used to enumerate the range.
Definition RangeView_inl.h:4

Constructor & Destructor Documentation

◆ xiiRangeView()

template<typename ValueType, typename IteratorType>
xiiRangeView< ValueType, IteratorType >::xiiRangeView ( BeginCallback begin,
EndCallback end,
NextCallback next,
ValueCallback value )

Initializes the xiiRangeView with the delegates used to enumerate the range.

Copyright (c) Theophilus Eriata. All Rights Reserved.


The documentation for this class was generated from the following files:
  • /home/runner/work/XII/XII/Source/Engine/Foundation/Types/RangeView.h
  • /home/runner/work/XII/XII/Source/Engine/Foundation/Types/Implementation/RangeView_inl.h