English 中文(简体)
D. 重载功能和舱载荷问题
原标题:Problems with overload function and luabind

我有一类人想受lu。 减少的法典可以是:

class CSprite2D{
    void setPosition(glm::ivec2 val) { m_position = val; }
    void setPosition(int posX, int posY) { m_position.x = posX; m_position.y = posY; }
    static void exposeAPI(lua_State* L,const unsigned char* data)
    {
        assert(L);
        luabind::module(L)[
        luabind::class_<CSprite2D>("CSprite2D")
        .def("setPosition",(void(*)(int,int))&CSprite2D::setPosition)
    ];
    }

在我试图汇编时,编辑们 throw倒和错误:

Error   1   error C2440:  type cast  : cannot convert from  overloaded-function  to  void (__cdecl *)(int,int)  c:directogameprojects2008zeleste2dsrcgraphicsgpxsprite2d.cpp 74
Error   2   error C2780:  luabind::class_<T> &luabind::class_<T>::def(luabind::detail::operator_<Derived>)  : expects 1 arguments - 2 provided  c:directogameprojects2008zeleste2dsrcgraphicsgpxsprite2d.cpp 74
Error   3   error C2784:  luabind::class_<T> &luabind::class_<T>::def(luabind::detail::operator_<Derived>,const Policies &)  : could not deduce template argument for  luabind::detail::operator_<Derived>  from  const char [12]   c:directogameprojects2008zeleste2dsrcgraphicsgpxsprite2d.cpp 74
Error   4   error C2784:  luabind::class_<T> &luabind::class_<T>::def(luabind::constructor<A0,A1,A2,A3,A4,A5,A6,A7,A8,A9>,const Policies &)  : could not deduce template argument for  luabind::constructor<A0,A1,A2,A3,A4,A5,A6,A7,A8,A9>  from  const char [12]   c:directogameprojects2008zeleste2dsrcgraphicsgpxsprite2d.cpp 74
Error   5   error C2780:  luabind::class_<T> &luabind::class_<T>::def(luabind::constructor<A0,A1,A2,A3,A4,A5,A6,A7,A8,A9>)  : expects 1 arguments - 2 provided  c:directogameprojects2008zeleste2dsrcgraphicsgpxsprite2d.cpp 74
Error   6   error C2780:  luabind::class_<T> &luabind::class_<T>::def(const char *,F,Default,const Policies &)  : expects 4 arguments - 2 provided  c:directogameprojects2008zeleste2dsrcgraphicsgpxsprite2d.cpp 74
Error   7   error C2780:  luabind::class_<T> &luabind::class_<T>::def(const char *,F,DefaultOrPolicies)  : expects 3 arguments - 2 provided c:directogameprojects2008zeleste2dsrcgraphicsgpxsprite2d.cpp 74

我知道,造成这一问题的原因是,旋转的罐头推卸了最好的超负荷功能,但reading the luabind documentation I m 正确地界定了该功能。

任何想法?

预 收

最佳回答

你们将这一职能归入错误类别,你们需要把工作推到一个逐人的职能。

Try:

.def("setPosition", (void (CSprite2D::*)(int, int))&CSprite2D::setPosition)
问题回答

暂无回答




相关问题
Undefined reference

I m getting this linker error. I know a way around it, but it s bugging me because another part of the project s linking fine and it s designed almost identically. First, I have namespace LCD. Then I ...

C++ Equivalent of Tidy

Is there an equivalent to tidy for HTML code for C++? I have searched on the internet, but I find nothing but C++ wrappers for tidy, etc... I think the keyword tidy is what has me hung up. I am ...

Template Classes in C++ ... a required skill set?

I m new to C++ and am wondering how much time I should invest in learning how to implement template classes. Are they widely used in industry, or is this something I should move through quickly?

Print possible strings created from a Number

Given a 10 digit Telephone Number, we have to print all possible strings created from that. The mapping of the numbers is the one as exactly on a phone s keypad. i.e. for 1,0-> No Letter for 2->...

typedef ing STL wstring

Why is it when i do the following i get errors when relating to with wchar_t? namespace Foo { typedef std::wstring String; } Now i declare all my strings as Foo::String through out the program, ...

C# Marshal / Pinvoke CBitmap?

I cannot figure out how to marshal a C++ CBitmap to a C# Bitmap or Image class. My import looks like this: [DllImport(@"test.dll", CharSet = CharSet.Unicode)] public static extern IntPtr ...

Window iconification status via Xlib

Is it possible to check with the means of pure X11/Xlib only whether the given window is iconified/minimized, and, if it is, how?

热门标签