Library of Assembled Shared Sources
lass::python::ContainerRangeView< SelfType, ValueType > Class Template Reference

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()
 

Detailed Description

template<typename SelfType, typename ValueType>
class lass::python::ContainerRangeView< SelfType, ValueType >

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.

Template Parameters
SelfTypeC++ container type
ValueTypeElement type returned by the container's iterators

Definition at line 241 of file pyiteratorrange.h.


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