Library of Assembled Shared Sources
|
View that adapts a C++ Range (begin()/end()) to a PyIteratorRange. More...
#include <pyiteratorrange.h>
Public Member Functions | |
ContainerRangeView (TSelfPtr self) | |
Constructor creating a range view over a container. | |
Related Symbols | |
(Note that these are not member symbols.) | |
template<typename T> | |
auto | makeContainerRangeView (const ShadoweePtr< T > &self) |
Returns a ContainerRangeView iterating over self->begin() to self->end() | |
View that adapts a C++ Range (begin()/end()) to a PyIteratorRange.
ContainerRangeView owns a ShadoweePtr to the container and produces a PyIteratorRange via iter()
, setting the owner to the underlying container. The PyIteratorRange will iterate over self->begin()
to self->end()
.
The main benefit of returning a ContainerRangeView 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 |
Definition at line 241 of file pyiteratorrange.h.