Replies: 1 comment
-
yes, I made a mistake. I place nb::class_<Demo>(m, "Demo")
.def(nb::init<>())
.def("sum", &Demo::sum)
.def(
"__iter__",
[](Demo& s) {
return nb::make_iterator<nb::rv_policy::reference_internal>(
nb::type<Demo>(), "iterator", s.data.begin(), s.data.end());
},
nb::keep_alive<0, 1>()); |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I want to modify the underlying data using
iterator
, but it does not work.in
Python
Did I make a mistake?
Thank you all!
Beta Was this translation helpful? Give feedback.
All reactions