1
这里是我在类SuffixArray功能:无效使用非静态成员函数的
int pstrcmp(const void *a, const void *b) {
return strcmp((const char *)*(char **)a, (const char *)*(char **)b);
}
我用的qsort该比较功能:
qsort(ap, len1+len2, sizeof(char *),pstrcmp);
哪个AP是一个指针数组的后缀
当我编译它时,出现一个错误: 非法使用非静态成员函数
我用记事本++编译它,它提供了
error: cannot convert 'SuffixArray::pstrcmp' from type 'int (SuffixArray::)(const void*, const void*)' to type 'int (*)(const void*, const void*)'
qsort(ap, len1+len2, sizeof(char *),pstrcmp);
有任何人能帮助我吗?
您使用C++标记标记了此标记。如果这是C++,那么避免C风格的转换,使用C++转换来使你的意图更清晰。我不喜欢你在看似不合时宜的表演中应用你的论点的方式。 – Dai
@Dai OP用C标记它,我为C++重新标记,因为它显然不是C问题。 – dasblinkenlight