-
Let's say that I have struct Item {
Parent* parent;
};
struct Parent {
std::vector<Item> get_items() {
return {Item{this}, Item{this}};
}
}; All items should nurse their parent. If a single .def("get_single_item", &Parent::get_single_item, nb::keep_alive<0, 1>()) but if I try to do the same with a vector of items (the function .def("get_items", &Parent::get_items, nb::keep_alive<0, 1>()) it complains that How to solve it? If I could use |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
You're in luck: @oremanj added a new feature in the latest version of nanobind that I think could be used to support your use case: https://nanobind.readthedocs.io/en/latest/api_core.html#_CPPv4I0EN8nanobind11call_policyE |
Beta Was this translation helpful? Give feedback.
You're in luck: @oremanj added a new feature in the latest version of nanobind that I think could be used to support your use case: https://nanobind.readthedocs.io/en/latest/api_core.html#_CPPv4I0EN8nanobind11call_policyE