【发布时间】:2019-09-02 10:35:10
【问题描述】:
我正在尝试在类中使用自定义排序,
如sort(arr,arr+n,cust);
在类函数中。
自定义排序如下所示:
bool cust (int a, int b) {
return pos[a]<pos[b];
}
pos 是类内的数组。
但它不编译,并给出编译错误
“无效使用非静态成员函数” 如何摆脱编译错误。
我的代码 -> https://pastebin.com/W1zw0A5s
我试过写:
static bool cust (int a, int b) {
/* same code */
}
这没有帮助。
【问题讨论】:
-
请在此处发布最小代码,因为 pastebin 可能会被删除。