lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

On Wed, Jul 4, 2012 at 11:32 PM, Vinnie Falco <> wrote:
> LuaBridge stores the smart pointer object inside the userdata, for the
> Shared lifetime model. However, this does not solve the problem. The
> reason that std::shared_ptr<> doesn't work is because of aliasing. Two
> different instances of shared_ptr can point to the same object, and
> their reference counts will not be shared. This is explained in the
> documentation. When Lua passes a shared_ptr wrapped object using
> LuaBridge to a C++ function that takes only a pointer to the object,
> it has no way of knowing that the object is really wrapped by a smart
> pointer.

Have you considered the case of the type in question inheriting from