operator=

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

operator=

Alexander Luddy
Hello,

I recently upgraded from 1.24 to 1.26.2.5 and have encountered a problem
  in regards to object::operator= .

I have code similar to the code shown below:

luabind::object result(luabind::from_stack(LuaTools::luaState(), -1));
float foo = 5;
result = foo;

Previously this code compiled fine however I now get a compile error
suggesting that the following object operator mentioned in the
documentation:

template<class T>
object& operator=(T const&);

is not being found.

Here is the error:

error C2679: binary '=' : no operator found which takes a right-hand
operand of type 'float' (or there is no acceptable conversion)

Looking at the object declaration in the luabind code it looks as if
operator= is no longer declared for object in version 1.26.2.5 like it
was in version 1.24.

Have I missed something?

Is there something special I need to do to get the above code to work?

Any help is greatly appreciated.

Thanks
Alex


-------------------------------------------------------
All the advantages of Linux Managed Hosting--Without the Cost and Risk!
Fully trained technicians. The highest number of Red Hat certifications in
the hosting industry. Fanatical Support. Click to learn more
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=107521&bid=248729&dat=121642
_______________________________________________
luabind-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/luabind-user
Reply | Threaded
Open this post in threaded view
|

Re: operator=

Arvid Norberg-2
On Mon, May 29, 2006 at 07:13:16PM +1000, Alexander Luddy wrote:

> Hello,
>
> I recently upgraded from 1.24 to 1.26.2.5 and have encountered a problem
>  in regards to object::operator= .
>
> I have code similar to the code shown below:
>
> luabind::object result(luabind::from_stack(LuaTools::luaState(), -1));
> float foo = 5;
> result = foo;
>
> Previously this code compiled fine however I now get a compile error
> suggesting that the following object operator mentioned in the
> documentation:
>
> template<class T>
> object& operator=(T const&);
>
> is not being found.
>
> Here is the error:
>
> error C2679: binary '=' : no operator found which takes a right-hand
> operand of type 'float' (or there is no acceptable conversion)
>
> Looking at the object declaration in the luabind code it looks as if
> operator= is no longer declared for object in version 1.26.2.5 like it
> was in version 1.24.
>
> Have I missed something?

That operator was lost in the rewrite of object. We should probably put it
back. Right now you can use a slightly more cumbersome syntax where you
construct an object from your float.

result = object(LuaTools::luaState(), foo);

> Is there something special I need to do to get the above code to work?

I will apply the lua 5.1 patches and add this operator back and check it in
to the cvs.

--
Arvid Norberg


-------------------------------------------------------
All the advantages of Linux Managed Hosting--Without the Cost and Risk!
Fully trained technicians. The highest number of Red Hat certifications in
the hosting industry. Fanatical Support. Click to learn more
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=107521&bid=248729&dat=121642
_______________________________________________
luabind-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/luabind-user