We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Let say I have this simple C++ class:
class test{ public: int my_data_member; int my_function(){ return 1; } };
I know how to map the my_function member function:
my_function
JLCXX_MODULE define_julia_module(jlcxx::Module& mod) { mod.method("greet", &greet); mod.add_type<test>("test") .constructor() .method("my_function",&test::my_function); }
How do I map the my_data_member data member so I can get and set the value from Julia?
my_data_member
tst = CppHello.test() tst.my_data_member = 1 # How do I do this? x = tst.my_data_member #and this
In Boost.Python they have this: https://www.boost.org/doc/libs/1_84_0/libs/python/doc/html/tutorial/tutorial/exposing.html#tutorial.exposing.class_data_members
The text was updated successfully, but these errors were encountered:
Hi, currently, the only way is to add setters and getters explicitly, e.g:
mod.add_type<test>("test") .constructor() .method("get_my_data_member", [] (const test& t) { return t.my_data_member; }) .method("set_my_data_member", [] (test& t, int d) { t.my_data_member = d; });
Sorry, something went wrong.
No branches or pull requests
Let say I have this simple C++ class:
I know how to map the
my_function
member function:How do I map the
my_data_member
data member so I can get and set the value from Julia?In Boost.Python they have this: https://www.boost.org/doc/libs/1_84_0/libs/python/doc/html/tutorial/tutorial/exposing.html#tutorial.exposing.class_data_members
The text was updated successfully, but these errors were encountered: