Library of Assembled Shared Sources
|
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 | |
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.
SelfType | C++ container type |
ValueType | Element type returned by the container's iterators |
SizeType | Argument type of AtMethod and return type of SizeMethod |
AtMethod | Member function type of the element accessor; expected to accept a SizeType index and return a ValueType |
SizeMethod | Member function type of the size accessor; expected to return a SizeType |
Definition at line 629 of file pyiteratorrange.h.