3
在此代碼:矢量擦除方法失敗
template <class TP> TP GCVVector<TP>::Remove(long Index)
{
TP Result = m_ObjectList.at(Index);
m_ObjectList.erase(&m_ObjectList.at(Index));
return Result;
}
我收到編譯時錯誤:
/trnuser1/rmtrain/DevelopmentEnv/Telstra/USM/../../Generic/CoreObjects/GCVVector.h: In member function âTP GCVVector<TP>::Remove(long int) [with TP = GCVString]â:
/trnuser1/rmtrain/DevelopmentEnv/Generic/ModulePopulator/GCVMPState.cpp:69: instantiated from here
/trnuser1/rmtrain/DevelopmentEnv/Telstra/USM/../../Generic/CoreObjects/GCVVector.h:241: error: no matching function for call to âstd::vector<GCVString, std::allocator<GCVString> >::erase(long int&)â
/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/vector.tcc:110: note: candidates are: typename std::vector<_Tp, _Alloc>::iterator std::vector<_Tp, _Alloc>::erase(__gnu_cxx::__normal_iterator<typename std::_Vector_base<_Tp, _Alloc>::_Tp_alloc_type::pointer, std::vector<_Tp, _Alloc> >) [with _Tp = GCVString, _Alloc = std::allocator<GCVString>]
/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/vector.tcc:122: note: typename std::vector<_Tp, _Alloc>::iterator std::vector<_Tp, _Alloc>::erase(__gnu_cxx::__normal_iterator<typename std::_Vector_base<_Tp, _Alloc>::_Tp_alloc_type::pointer, std::vector<_Tp, _Alloc> >, __gnu_cxx::__normal_iterator<typename std::_Vector_base<_Tp, _Alloc>::_Tp_alloc_type::pointer, std::vector<_Tp, _Alloc> >) [with _Tp = GCVString, _Alloc = std::allocator<GCVString>]
make[2]: *** [CMakeFiles/GCVMP.dir/trnuser1/rmtrain/DevelopmentEnv/Generic/ModulePopulator/GCVMPState.o] Error 1
make[1]: *** [CMakeFiles/GCVMP.dir/all] Error 2
有誰知道我如何刪除這些數據?