Compile error at pure_out_value

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

Compile error at pure_out_value

Lars 'Levia' Wesselius
Hey,

Im trying to compile

module(lvm->getLuaState())
        [
            class_<HUDElement>("HUDElement
")
                .def("getPosition", &HUDElement::getPosition, pure_out_value(_1) + pure_out_value(_2))
       ];


Where the function definition looks like

void getPosition(float &x, float &y)
    {
        x = 3.0f;
        y = 6.0f;
    }

but I always get numerous compiler errors:

'luabind::detail::char_array<sizeof(identity<T>::type)> luabind::detail::indirect_sizeof_test(luabind::detail::by_const_pointer<T>)' : could not deduce template argument for 'luabind::detail::by_const_pointer<T>' from 'luabind::detail::by_reference<T>'  luabind\out_value_policy.hpp    78   

which is shown 2 times then:

'luabind::detail::char_array<sizeof(identity<T>::type)> luabind::detail::indirect_sizeof_test(luabind::detail::by_pointer<T>)' : could not deduce template argument for 'luabind::detail::by_pointer<T>' from 'luabind::detail::by_reference<T>' luabind\out_value_policy.hpp    78   

which is shown 2 times then:

'Size' : invalid template argument for 'luabind::detail::pure_out_value_converter', expected compile-time constant expression luabind\out_value_policy.hpp    228   

Why do these errors occure and how can I fix it? Any help is greatly appreciated.
Thanks

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
luabind-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/luabind-user
Reply | Threaded
Open this post in threaded view
|

Re: Compile error at pure_out_value

Arvid Norberg-2
On Jan 13, 2007, at 6:59 , Lars 'Levia' Wesselius wrote:

> Hey,
>
> Im trying to compile
>
> module(lvm->getLuaState())
>         [
>             class_<HUDElement>("HUDElement
> ")
>                 .def("getPosition", &HUDElement::getPosition,  
> pure_out_value(_1) + pure_out_value(_2))
>        ];
>
>
> Where the function definition looks like
>
> void getPosition(float &x, float &y)
>     {
>         x = 3.0f;
>         y = 6.0f;
>     }

Hi, take a look at:

http://www.rasterbar.com/products/luabind/docs.html#policies

_1 refers to the this-pointer (as if it was passed as an explicit  
argument)

So I presume what you really want is to pass _2 and _3 to the pure  
out value policy.


--
Arvid Norberg



-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
luabind-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/luabind-user
Reply | Threaded
Open this post in threaded view
|

Re: Compile error at pure_out_value

Caligola900
I would like to ask a question: it is possible to use
pure_out_value/out_value policies with classes, and not only with
primitive types? I tried some time ago, and I couldn't compile the code.

Thanks in advance,
Paolo


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
luabind-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/luabind-user
Reply | Threaded
Open this post in threaded view
|

Re: Compile error at pure_out_value

Arvid Norberg-2

On Jan 15, 2007, at 4:33 , Caligola900 wrote:

> I would like to ask a question: it is possible to use
> pure_out_value/out_value policies with classes, and not only with
> primitive types? I tried some time ago, and I couldn't compile the  
> code.

non-primitive types can be passed by reference, and don't need a  
policy for that functionality.

--
Arvid Norberg



-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
luabind-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/luabind-user