MCPcopy Create free account
hub / github.com/pybind/pybind11 / sentinel

Method sentinel

include/pybind11/pytypes.h:1583–1583  ·  view source on GitHub ↗

\rst 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; } } \endrst */

Source from the content-addressed store, hash-verified

1581 }
1582 \endrst */
1583 static iterator sentinel() { return {}; }
1584
1585 friend bool operator==(const iterator &a, const iterator &b) { return a->ptr() == b->ptr(); }
1586 friend bool operator!=(const iterator &a, const iterator &b) { return a->ptr() != b->ptr(); }

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected