Library of Assembled Shared Sources
|
View that adapts member iterator accessors to a PyIteratorRange. More...
#include <pyiteratorrange.h>
Related Symbols | |
(Note that these are not member symbols.) | |
template<typename T, typename GetIterator> | |
auto | makeMemberRangeView (const ShadoweePtr< T > &self, GetIterator begin, GetIterator end) |
Returns a MemberRangeView iterating over (self->*begin)() and (self->*end)() | |
View that adapts member iterator accessors to a PyIteratorRange.
MemberRangeView holds a ShadoweePtr to the container, and obtains the iterator pair by calling the supplied member accessors (self->*begin)()
and (self->*end)()
when iter()
is invoked.
iter()
produces a PyIteratorRange
and sets self
as its owner, keeping the container alive for the duration of the iteration.
The main benefit of returning a MemberRangeView over a plain PyIteratorRange is that it correctly types the iterator's value type in the generated Python stubs as ValueType
, in contrast to the generic Any
type used by PyIteratorRange.
SelfType | C++ container type |
ValueType | Element type returned by the container's iterators |
GetIterator | Function type of the member iterator accessors. |
Definition at line 315 of file pyiteratorrange.h.