的伪代码(这是我的课):矢量==操作符
struct cTileState {
cTileState(unsigned int tileX, unsigned int tileY, unsigned int texNr) : tileX(tileX), tileY(tileY), texNr(texNr) {}
unsigned int tileX;
unsigned int tileY;
unsigned int texNr;
bool operator==(const cTileState & r)
{
if (tileX == r.tileX && tileY == r.tileY && texNr == r.texNr) return true;
else return false;
}
};
然后,我有两个容器:
std::list < std::vector <cTileState> > changesList; //stores states in specific order
std::vector <cTileState> nextState;
而且某处PROGRAMM我想做的事情在我的国家交换功能:
if (nextState == changesList.back()) return;
然而,当我想编译它,我有一些毫无意义的,我的错误,如:
/usr/include/c++/4.7/bits/stl_vector.h:1372:58: required from ‘bool std::operator==(const std::vector<_Tp, _Alloc>&, const std::vector<_Tp, _Alloc>&) [with _Tp = cMapEditor::cActionsHistory::cTileState; _Alloc = std::allocator]’
error: passing ‘const cMapEditor::cActionsHistory::cTileState’ as ‘this’ argument of ‘bool cMapEditor::cActionsHistory::cTileState::operator==(const cMapEditor::cActionsHistory::cTileState&)’ discards qualifiers [-fpermissive]
它说什么是错在stl_vector.h和我不尊重const的预选赛,但老实说,有没有,我不尊重const的预选赛。这里有什么问题?
更重要的是,IDE不显示我的任何特定行的错误在我的文件 - 它只是显示在构建日志,这一切。
错误永远不会毫无意义。 –
对,我改变了。 – user1873947