|
HepMC3 event record library
|
#include <pytypes.h>
Inheritance diagram for iterator:
Collaboration diagram for iterator:Public Types | |
| using | iterator_category = std::input_iterator_tag |
| using | difference_type = ssize_t |
| using | value_type = handle |
| using | reference = const handle |
| using | pointer = const handle * |
Public Member Functions | |
| iterator & | operator++ () |
| iterator | operator++ (int) |
| reference | operator* () const |
| pointer | operator-> () const |
| PYBIND11_DEPRECATED ("Use reinterpret_borrow<object>() or reinterpret_steal<object>()") object(handle h | |
| handle | release () |
| template<typename T > | |
| T | cast () const & |
| template<typename T > | |
| T | cast () && |
| template<typename T > | |
| T | cast () const & |
| template<typename T > | |
| T | cast () && |
| template<> | |
| void | cast () const & |
| template<> | |
| void | cast () && |
| template<typename T > | |
| T | cast () const |
| PyObject * | ptr () const |
Return the underlying PyObject * pointer. More... | |
| PyObject *& | ptr () |
| const handle & | inc_ref () const & |
| const handle & | dec_ref () const & |
| operator bool () const | |
Return true when the handle wraps a valid Python object. More... | |
| bool | operator== (const handle &h) const |
| bool | operator!= (const handle &h) const |
| bool | check () const |
Static Public Member Functions | |
| static iterator | sentinel () |
Data Fields | |
| bool | is_borrowed: handle(h) { if (is_borrowed) inc_ref() |
Protected Attributes | |
| PyObject * | m_ptr = nullptr |
Private Member Functions | |
| void | advance () |
Private Attributes | |
| object | value = {} |
Friends | |
| bool | operator== (const iterator &a, const iterator &b) |
| bool | operator!= (const iterator &a, const iterator &b) |
Wraps a Python iterator so that it can also be used as a C++ input iterator
Caveat: copying an iterator does not (and cannot) clone the internal state of the Python iterable. This also applies to the post-increment operator. This iterator should only be used to retrieve the current value using operator*().
|
inherited |
|
inlineinherited |
|
inlineinherited |
|
inlineexplicitinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
Resets the internal pointer to nullptr without decreasing the object's reference count. The function returns a raw handle to the original Python object.
Definition at line 249 of file pytypes.h.
References handle::handle().
|
inlinestatic |
The value which marks the end of the iteration. it == iterator::sentinel() is equivalent to catching StopIteration in Python.
.. code-block:: cpp
void foo(py::iterator it) {
while (it != py::iterator::sentinel()) {
use *it ++it; } }
1.8.14