You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It would be nice to be able to construct things like std::shared_ptrs (ala. make_shared<>()) from Julia. Possibly the Julia interface for this could be SharedPtr{World}(StdString(...)).
On the C++ side this could internally be implemented via make_shared and the wrapper code could look like:
Is the use case for this to be able to call functions/constructors from julia which take shared_ptr's as arguments on the C++ side? If so then yes, would be very useful.
My current hack to wrap a constructor like
class Handle{
Handle(const std::shared_ptr<Foo>& p);
...
}
is to create a factory method create_handle in the wrapper
Now on the julia side if I try and call the Handle constructor directly then it will fail with a type error but the factory works and I can pass the handle to other functions.
foo = Foo()
handle1 = Handle(foo) # fails with type error because Handle expects a shared_ptr
handle1 = Handle(SharedPtr{Foo}(foo)) # with the above feature I could write this, which is convenient
handle2 = create_handle(foo) // works by calling the factory method
I wonder if currently there is a better way to do this, rather than having to create a custom wrapper function for every constructor/method that takes a smart pointer?? I have literally 100s of such functions to wrap.
It would be nice to be able to construct things like
std::shared_ptr
s (ala.make_shared<>()
) from Julia. Possibly the Julia interface for this could beSharedPtr{World}(StdString(...))
.On the C++ side this could internally be implemented via
make_shared
and the wrapper code could look like:The text was updated successfully, but these errors were encountered: