lua-users home
lua-l archive

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


Does anyone know whether toLua++ support classes wrapped by smart
pointers? Specifically the boost::shared_ptr class. If I have to I can
run some tests, but I've burned a lot of time on trying various other
binding libraries already, and I'm hoping someone has a quick answer.

I see that it supports class templates, which is a start, but is not
necessarily sufficient, depending on implementation. Specifically, say I
have this:

class Base;
class Derived;
typedef shared_ptr<Base> BaseRef;
typedef shared_ptr<Derived> DerivedRef;

class Base
{
public:
  void foo( BaseRef b );
}

class Derived: public Base
{
 ...
}

Now I have an object of type Derived that I want to pass into
Base::foo(). In C++ this works fine:

DerivedRef d = ...;
BaseRef b = ... ;

b->foo(d); // will work

But will it work in ToLua++? I ask because DerivedRef is not actually a
derived class of BaseRef, though in C++ they convert correctly. LuaBind
does handle this, but is causing so much code bloat that I'd like to
avoid using it.

Thanks in advance,

Tim