vector overloaded in x64 compiler

Issue #11 invalid
Qinghui Lai
created an issue

There is no error in 32 compiler but overloaded problems in 64 compiler.

This part of my code is:

typedef std::vector< double > dvector; OOLUA_PROXY(dvector)
OOLUA_MEM_FUNC(void, push_back, class_::const_reference) OOLUA_MEM_FUNC_CONST(class_::const_reference, at, unsigned int) OOLUA_PROXY_END

The Output information occur upon the function of "at":

error C2664: 'void OOLUA::INTERNAL::Proxy_caller<Return,Class,ReturnIsVoid>::call<funcType,P1_>(lua_State const ,C ,FuncType,unsigned int &)' : cannot convert parameter 3 from 'overloaded-function' to 'funcType '

Comments (9)

  1. Ilia Pavlovets

    I think this trouble because you can not use referenced values between Lua and C. You can create own class:

    class DoubleVector: public std::vector<double>
    {
    public:
        // double at(size_type i) const { return this->at(i); }
        double getAt(size_type i) const { return this->at(i); }
    };
    
  2. Liam Devine repo owner

    Hello Qinghui, The problem is due to the function signature which you have supplied to the macro(OOLUA_MEM_FUNC_CONST), as it has to match the actual function signature. However, you have specified that the parameter is an unsigned int which is not guaranteed to be the case. The most correct way of specifying this signature would be the following:

    OOLUA_MEM_FUNC_CONST(class_::const_reference, at, class_::size_type)

  3. Log in to comment