错误:Char 26: fatal error: reference to non-static member function must be called

主要原因是我使用了函数指针,而函数指针所指函数须得是静态才行

class Solution {
public:
    vector<int> exchange(vector<int>& nums) {
        return ReOrder(nums,iseven);
    }
    vector<int> ReOrder(vector<int>& nums,bool (*func)(int)) {
		......
    }
    bool iseven(int n){//这里有误,应改成static
        return (n&0x1)==0;
    }
};

添加static,完美解决:

class Solution {
public:
    vector<int> exchange(vector<int>& nums) {
        return ReOrder(nums,iseven);
    }
    vector<int> ReOrder(vector<int>& nums,bool (*func)(int)) {
		......
    }
    static bool iseven(int n){
        return (n&0x1)==0;
    }
};
原文地址:https://www.cnblogs.com/dindin1995/p/13059074.html