nbind icon indicating copy to clipboard operation
nbind copied to clipboard

.field support for struct's members without getter /setters

Open tarun550 opened this issue 8 years ago • 2 comments

Embind has a concept of value_objects which allow us to define "fields" of simple structs.

Is there a similar concept in nbind?

I did see a "filed" macro, but there is no mention of it in the documentation. Basically I wish to avoid adding getter/setter code to my existing code base.

tarun550 avatar Sep 09 '17 15:09 tarun550

nbind currently has somewhat different kind of value objects explained under using objects. If your C++ class has a fromJS function taking a callback, JavaScript class has a fromJS function taking a callback and you call binding.bind to unite them, then you can pass the objects by value between languages.

The only getter/setter code needed then is a single function in both languages to pass all class members to a callback. Of course this is practical only if there is a small number of them.

A .field method is planned, but not yet implemented.

jjrv avatar Sep 11 '17 13:09 jjrv

Thanks for the update. Should I closed this issue or keep it opened until the method is implemented?

tarun550 avatar Sep 17 '17 16:09 tarun550