On Thu, Oct 30, 2008 at 3:09 PM, klaas.holwerda <[EMAIL PROTECTED]> wrote: > John Labenski wrote: >>> obj = iter3:op_mul() >> >> This should error out since op_mul() expects an argument. > > No it really works. And operator*() generates things different compared too > operator*( const a2dAffineMatrix& m ) >
I guess this was just a lucky, genwxbind.lua doesn't check everything since we assume that the compiler will get the rest. >>> If possible adding an extra op_deref or something like that would be >>> nice. Added as op_deref(). >> Can you explain why you need to dereference an object pushed into Lua? >> wxLua uses pointers to all class objects, gets them as pointers in the >> bindings and simply puts a * in front if necessary. Unless I'm >> misunderstanding, the operator will convert the pointer to the object, >> but then immediately convert it back to a pointer to push it into Lua. > > First of all a2dCanvasObjectListIter is internal in my code a: > > typedef a2dCanvasObjectList::iterator a2dCanvasObjectListIter; > > and > > a2dCanvasObjectList is derived from a template instantiation of a smart > pointer list called a2dSmrtPtrList<a2dCanvasObject>, which contain > a2dCanvasObjectPtr, this last is a > > typedef a2dSmrtPtr<a2dCanvasObject> a2dCanvasObjectPtr; > > a2dSmrtPtrList is on it turn a normal STL list containing Smart Pointers. > > Now STL lists only work properly/best with complete objects in the list, > so not pointers. STL makes copies of the objects you put in the list, > and deletes them itself. > And that is why the STL list works very well with Smart Pointer, since ... Ok, I figured there was probably a good reason, but I just wanted to be sure that there wasn't some simple work-around that would be more Lua like. You may want to consider writing an %override function just to give the function a better name, like GetItem(), instead of the more cryptic op_deref(). Actually, the %rename tag should work if you decide to go this route. -John ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ wxlua-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/wxlua-users
