1
有沒有辦法將std :: map索引作爲參數傳遞給const函數?在const函數內通過參數索引返回std :: map的值
const SurfaceProperties & SurfacePropertiesImpl::getSurfaceProperties(const std::string entityId) const
{
return mSurfaceProperties[entityId];
}
-
error: passing ‘const std::map<std::__cxx11::basic_string<char>, SurfaceProperties>’ as ‘this’ argument discards qualifiers [-fpermissive]
return mSurfaceProperties[entityId];