Added pybind11::make_key_iterator for map iteration
This allows exposing a dict-like interface to python code, allowing
iteration over keys via:
for k in custommapping:
...
while still allowing iteration over pairs, so that you can also
implement 'dict.items()' functionality which returns a pair iterator,
allowing:
for k, v in custommapping.items():
...
example-sequences-and-iterators is updated with a custom class providing
both types of iteration.
diff --git a/docs/advanced.rst b/docs/advanced.rst
index 6f57d0b..c68c33a 100644
--- a/docs/advanced.rst
+++ b/docs/advanced.rst
@@ -957,6 +957,12 @@
| | indicate wrong value passed |
| | in ``container.remove(...)`` |
+--------------------------------------+------------------------------+
+| :class:`pybind11::key_error` | ``KeyError`` (used to |
+| | indicate out of bounds |
+| | accesses in ``__getitem__``, |
+| | ``__setitem__`` in dict-like |
+| | objects, etc.) |
++--------------------------------------+------------------------------+
| :class:`pybind11::error_already_set` | Indicates that the Python |
| | exception flag has already |
| | been initialized |