Is it possible to construct a pointer instead of shared_ptr?
Issue #1
wontfix
Could we construct a pointer instead of shared_ptr directly? We need a unique_ptr actually, but as it's forbidden to passed out by dicpp, create by raw pointer may be a workaround.
Comments (6)
-
repo owner -
I'm sorry, I couldn't find an example, and based on my limited knowledge of C++, I don't know how to implement 1&2-_-(I do tried...) Would you mind provide an example please? Great thanks!
-
repo owner If your knowledge of C++ is limited then I suggest you not go down this path for now.
-
repo owner - marked as proposal
Not sure on the usefulness of creating unmanaged memory via dicpp.
-
repo owner - changed status to on hold
Not sure on the usefulness of creating unmanaged memory via dicpp.
-
repo owner - changed status to wontfix
Check out Boost.DI instead: https://github.com/boost-experimental/di
- Log in to comment
What you're looking for is the ability to allocate memory that is unmanaged by dicpp but use all of the other niceness.
So one option is the following:
r.add(r.type<Whatever>().provider<unmanaged>())
Then you can use std::unique_ptr as a parameter for your constructors.
Let me know if you have any problems with this.