C++ C++;struct-作为此参数传递常量将丢弃限定符
因此,我试图创建一个结构C++ C++;struct-作为此参数传递常量将丢弃限定符,c++,reference,constants,C++,Reference,Constants,因此,我试图创建一个结构TileSet并覆盖您需要在操作符的定义中添加一个const限定符尝试使操作符
TileSet
并覆盖您需要在操作符的定义中添加一个const
限定符尝试使操作符我想您可以在询问之前搜索google:
struct TileSet
{
// ... other struct stuff, the only stuff that matters
TileSet(const TileSet& copy)
{
this->gid = copy.gid;
this->spacing = copy.spacing;
this->width = copy.width;
this->height = copy.height;
this->texture = copy.texture;
}
bool operator<(const TileSet &b)
{
return this->gid < b.gid;
}
};
bool operator<(const TileSet &b) const
// ^^^ add me
{
return this->gid < b.gid;
}