Library of Assembled Shared Sources
lass::python::FreeIndexedRangeView< SelfType, ValueType, SizeType, AtFunc, SizeFunc > Class Template Reference

View that adapts index-based element access to a PyIteratorRange. More...

#include <pyiteratorrange.h>

Related Symbols

(Note that these are not member symbols.)

template<typename T, typename AtFunc, typename SizeFunc>
auto makeFreeIndexedRangeView (const ShadoweePtr< T > &self, AtFunc atFunc, SizeFunc sizeFunc)
 Returns a FreeIndexedRangeView iterating over atFunc(*self, index) for index in 0 to sizeFunc(*self) - 1
 
template<typename T, typename AtFunc, typename SizeFunc>
auto makeFreeIndexedRangeViewFactory (AtFunc atFunc, SizeFunc sizeFunc)
 Returns a callable that creates FreeIndexedRangeView iterating over atFunc(*self, index) for index in 0 to sizeFunc(*self) - 1
 

Detailed Description

template<typename SelfType, typename ValueType, typename SizeType, typename AtFunc, typename SizeFunc>
class lass::python::FreeIndexedRangeView< SelfType, ValueType, SizeType, AtFunc, SizeFunc >

View that adapts index-based element access to a PyIteratorRange.

IndexedRangeView holds a ShadoweePtr to the container, and iterates ove the elements by index. It uses the supplied member functions atMethod and sizeMethod to access the elements and the size of the container.

It retrieves the size of the container by calling (self->*sizeMethod)() once when the iteration starts, and accesses the elements by calling (self->*atMethod)(index) for each index from 0 to size-1.

iter() produces a PyIteratorRange and sets self as its owner, keeping the container alive for the duration of the iteration.

Template Parameters
SelfTypeC++ container type
ValueTypeElement type returned by the container's iterators
SizeTypeArgument type of AtMethod and return type of SizeMethod
AtMethodMember function type of the element accessor; expected to accept a SizeType index and return a ValueType
SizeMethodMember function type of the size accessor; expected to return a SizeType

Definition at line 629 of file pyiteratorrange.h.


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