-
Notifications
You must be signed in to change notification settings - Fork 758
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Embind port #7239
base: main
Are you sure you want to change the base?
Embind port #7239
Conversation
When using
const ArenaVector<X>* getField() const {
return &field;
}
...
property("field", &Foo::getField, return_value_policy::reference()); |
I played a bit more with your example and I am now running into some other issues using a getter. Since class_<ArenaVectorBase<ArenaVector<int>, int>>("Base")
.function("insertAt", &ArenaVectorBase<ArenaVector<int>, int>::insertAt)
.function("getAt", &ArenaVectorBase<ArenaVector<int>, int>::operator[])
;
class_<ArenaVector<int>, base<ArenaVectorBase<ArenaVector<int>, int>>>("Derived");
However, if I then try to do something like I'm still thinking about how we could better handle this, but a current alternative is to not use a class_<Foo>("Foo").function("getField", +[](Foo& foo) { return &foo.field; }, return_value_policy::reference()); |
I thought about this a little more and the |
Thanks! I'll try a function here. I don't think we need to write to the vector, which is good. |
That gets me a little further. Now I see that some of the automation I was hoping to get will not "just work" as I'd hoped. We can automate creation of |
For #6225
Basic stuff works, but I am having trouble with the return policy @brendandahl
I am doing
Reference is what I want for fields which are vectors of names - we don't want to copy them, and they'll be around while the object is. But I get
That requirement for a move constructor or copy assignment operator confuse me, as the docs for a return value policy of reference say "Constructor: none". What am I doing wrong?