Re: class hierarchies and smart pointers
Ilia Trendafilov <[email protected]>
| Newsgroups | gmane.comp.lang.lua.bind.user |
|---|---|
| Message-ID | <[email protected]> |
Uhm, scratch that, it's an answer to another question :-/ On Mon, Aug 31, 2009 at 9:03 PM, Ilia Trendafilov<[email protected]> wrote: > Hi, > > Try this: > > class_<Base, Holder<Base> >("Base"); > class_<Derived, Base, Holder<Base> >("Derived"); > > I haven't tried it, but there's an example in luabind docs (in the end > of 8.7 Smart Pointers section): > > ... > class_<base, boost::shared_ptr<base> >("base") > .def(constructor<>()), > class_<derived, base, boost::shared_ptr<base> >("base") > .def(constructor<>()) > ... > > Hope this helps > > > On Mon, Aug 31, 2009 at 8:30 PM, David Raulo<[email protected]> wrote: >> On Mon, 17 Aug 2009 12:06:16 +0200 >> David Raulo <[email protected]> wrote: >> >>> Hi, >>> >>> I have a class hierarchy whose instances need to be managed with a >>> smart pointer Holder<> when passed to/from lua. So I declared the >>> classes like this: >>> class_<Base, Holder<Base> >("Base"); >>> class_<Derived, Holder<Base> >("Derived"); >>> >>> The problem is I also have functions like : >>> Holder<Derived> foo() >>> >>> and I really need to access the result as a Derived instance. >>> Luabind complains at runtime that Holder<Derived> is not registered. >>> I'm curious to know if anyone on the list faced this, and of course >>> how they solved it :) Thanks! >> >> So, anybody knows? >> >> Thanks >> >> - David >> >> ------------------------------------------------------------------------------ >> Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day >> trial. Simplify your report design, integration and deployment - and focus on >> what you do best, core application coding. Discover what's new with >> Crystal Reports now. http://p.sf.net/sfu/bobj-july >> _______________________________________________ >> luabind-user mailing list >> [email protected] >> https://lists.sourceforge.net/lists/listinfo/luabind-user >> > ------------------------------------------------------------------------------ Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july _______________________________________________ luabind-user mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/luabind-user