Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/date/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C++ C++;struct-作为此参数传递常量将丢弃限定符_C++_Reference_Constants - Fatal编程技术网

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;
}