【发布时间】:2013-08-17 09:07:29
【问题描述】:
我正在尝试使用我编写的自定义函数对自定义结构类型的列表进行排序,但给我一个错误:
使用未声明的标识符
struct myStruct
{
int x1;
int x2;
};
bool CompareData(const myStruct& a, const myStruct& b)
{
if (a.x1 < b.x1) return true;
if (b.x1 < a.x1) return false;
// a=b for primary condition, go to secondary
if (a.x2 < b.x2) return true;
if (b.x2 < a.x2) return false;
return false;
}
void sortingList ()
{
std::list<myStruct> custom_dist;
//...Fill list
custom_dist.sort(CompareData); //Here i receive the error
}
这是错误:
因为似乎需要输入参数...
【问题讨论】:
-
你能发布完整的错误信息吗?
-
我添加了一个错误的图像...
-
发布构建日志...
-
什么是构建日志?
-
我也刚刚检查过,它使用 Xcode 为我编译。