Closed nyckmaia closed 3 years ago
@nyckmaia, you can just add a method __getitem__
and __setitem__
. operator.h
mainly provides some syntactic sugar, but doesn't do anything more than define these special "dunder methods" from Python: https://docs.python.org/3/reference/datamodel.html#object.__getitem__
Note: the docs just mention it's a shorthand: https://pybind11.readthedocs.io/en/stable/advanced/classes.html#operator-overloading
I was reading the
include/pybin11/operator.h
...Link hereBut I do not found the array index operator in the list. So, look this example below:
Is this possible?