Re: non const reference
Muller Remy <[email protected]> Fri, 24 Feb 2012 11:02:07 +0100
| Newsgroups | gmane.comp.lang.lua.bind.user |
|---|---|
| Message-ID | <[email protected]> |
no answer?
Le 08/02/2012 12:12, Remy Muller a écrit :
> hi,
>
> here's a toy example I'd like to wrap using luabind:
>
> struct A
> {
> private
> A(const A&) {}
> };
>
> struct B
> {
> virtual void foo(A &a)
> {
> }
> };
>
> struct B_wrap : public B, public wrap_base
> {
> virtual void foo(A &a)
> {
> call<void>("foo", a);
> }
>
> static void default_foo(B *p, A &a)
> {
> p->B::foo(a);
> }
> };
>
> module(L)[
> class<A>,
> class_<B, B_wrap>("B"),
> .def("foo", &B::foo, &B_wrap::default_foo)
> ];
>
> I have questions regarding this:
>
> the compiler complains because A constructor is private
>
> 1) Is there a non-intrusive way to inform luabind that a pointer to A*
> could be used instead of the reference to avoid the copy?
>
> 2) I guess a static forwarding function like:
> static function void static_foo(B *b, A *a)
> {
> assert(b && a);
> b->foo(*a);
> }
>
> would solve my first question, but how to make that play well with
> virtual function overloading?
>
> 3) how can I tell luabind that the lifetime of this object is only
> guaranteed during this function call and shouldn't be acquired by lua
> code?
>
> best
>
> remy
>
>
------------------------------------------------------------------------------
Virtualization & Cloud Management Using Capacity Planning
Cloud computing makes use of virtualization - but cloud computing
also focuses on allowing computing to be delivered as a service.
http://www.accelacomm.com/jaw/sfnl/114/51521223/