I have a custom compare function:
bool compare(int a, int b){
if(a>2*b) return true;
return false;
}
now I want to use this function like this:
vector<int> numbers;//say it contains random numbers
sort(numbers.begin(), numbers.end(), compare(a, b));//a and b are the numbers that sort function currently compares to each other
Obviously, this code won't work, because the program doesn't know what a and b are. My question is, how do I pass the required numbers to compare function?