Support for "adopt" to use a custom smart pointer, patch included

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Support for "adopt" to use a custom smart pointer, patch included

Ben Wilhelm-2

I recently found I needed to combine the "custom smart pointer" feature
for class creation, along with "adopt" for picking up the return value
from a function. I couldn't find any way to do this with the current
codebase so I implemented a new adopt function named adopt_container.
I'm attaching a patch for it - it hasn't yet been extensively tested,
but it seems to work.

Let me know if there are any problems with it, or any better way to
write it. I'd appreciate it if this functionality could make it into
luabind-0.10 whenever it shows up, one way or another, even if the
actual code behind it is different. :)

-Ben


------------------------------------------------------------------------------
ThinkGeek and WIRED's GeekDad team up for the Ultimate
GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the
lucky parental unit.  See the prize list and enter to win:
http://p.sf.net/sfu/thinkgeek-promo
_______________________________________________
luabind-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/luabind-user

adopt_container.patch (2K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Support for "adopt" to use a custom smart pointer, patch included

Daniel Wallin
On Tue, Jun 22, 2010 at 07:00:27PM -0700, Ben Wilhelm wrote:

>
> I recently found I needed to combine the "custom smart pointer"
> feature for class creation, along with "adopt" for picking up the
> return value from a function. I couldn't find any way to do this
> with the current codebase so I implemented a new adopt function
> named adopt_container. I'm attaching a patch for it - it hasn't yet
> been extensively tested, but it seems to work.
>
> Let me know if there are any problems with it, or any better way to
> write it. I'd appreciate it if this functionality could make it into
> luabind-0.10 whenever it shows up, one way or another, even if the
> actual code behind it is different. :)

Thank you. Excellent idea. I commited a slightly cleaned up patch, using
an overload of adopt() for both cases and giving the capability to
adopt_pointer rather than adding a new converter:

  http://github.com/luabind/luabind/commit/ed8cc7fbaff9e6ce

--
Daniel Wallin
BoostPro Computing
http://www.boostpro.com

------------------------------------------------------------------------------
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
_______________________________________________
luabind-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/luabind-user