[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Alternative C++ binding
- From: "Wim Couwenberg" <w.couwenberg@...>
- Date: Fri, 15 Aug 2003 21:54:57 +0200
> As for the GC template I have an answer to your problem.
> The problem is that it is illegal to directly call destructors.
> You have to go through delete.
No, it's perfectly legal to explicitly call a destructor. Ben's example
could read something like this:
template<typename T>
int GCMethod(lua_State *L)
{
T *p = lua_userdata_cast(L, 1, T);
if (p)
p->~T();
}
This destructs the instance while Lua takes care of freeing the memory.
--
Wim