Skip to content
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

[Request] Option to allow constructors to pass a shared_ptr<T> to JS, rather than T* #13

Open
benjymous opened this issue Apr 13, 2018 · 0 comments

Comments

@benjymous
Copy link

Most of my C++ codebase uses shared_ptr for all pointers passed around - this makes it awkward interfacing with JS code that creates new objects - I'm either forced to use raw pointers in my C++ classes, or implement my own factory functions to expose to JS instead of using new.

Would it be possible to add an overridden constructor declaration that creates a shared_ptr and passes that down rather than T*?

e.g.

dukglue_register_constructor_sharedptr<TestClass>(ctx, "TestClass");

that would do exactly the same functionality as dukglue_register_constructor but would use make_shared instead of new internally.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant