C++11 带有std::vector::at的luabind返回值';试图使用未注册的类';
我正在尝试将luabind与std::vector一起使用。我将GCC4.8.1与c++11一起使用。转换代码如下所示C++11 带有std::vector::at的luabind返回值';试图使用未注册的类';,c++11,lua,luabind,C++11,Lua,Luabind,我正在尝试将luabind与std::vector一起使用。我将GCC4.8.1与c++11一起使用。转换代码如下所示 template <typename T> void luabindVector(lua_State* S, std::string tname) { module(S)[class_<std::vector<T> >(tname.c_str()).def(constructor<>()).def( "pushBa
template <typename T>
void luabindVector(lua_State* S, std::string tname) {
module(S)[class_<std::vector<T> >(tname.c_str()).def(constructor<>()).def(
"pushBack",
static_cast<void (std::vector<T>::*)(
const T&)>(&std::vector<T>::push_back)).
def("at",(T& (std::vector<T>::*)(size_t))(&std::vector<T>::at)).
def("resize",static_cast<void (std::vector<T>::*)(size_t)>(&std::vector<T>::resize)).
def("size",&std::vector<T>::size).
def("assign",static_cast<void (std::vector<T>::*)(size_t, const T&)>(&std::vector<T>::assign))];
}
这将产生错误std::runtime_error:“尝试使用未注册的类”,错误为2
请注意,push_back、resize、size和assign都可以正常工作,但是程序在调用tans:at(1)时失败。从文档中不清楚我应该如何正确地做到这一点。有人知道我做错了什么吗
luabindVector<double>(L,"vectorDouble");
tans = vectorDouble()
tans:resize(3)
a=tans:at(1)