ofSort: not properly working?

Hi,
I’m trying to use the function ofSort to order a vector.

To learn how does it work I’ve try to create an example to sort and int vector. I write the code below.

In testApp.h

  
  
vector<int>::iterator it;  
bool ordina(int &a, int &b);  
vector<int> numbers;  
  

In testApp.cpp:

  
  
void testApp::setup(){  
    numbers.push_back(3);  
    numbers.push_back(2);  
    numbers.push_back(4);  
    numbers.push_back(1);  
  
    ofSort(numbers,testApp::ordina);  
  
    it = numbers.begin();  
  
    while(it != numbers.end()){  
        cout << *it;  
        ++it;  
    }  
}  
  

And a function to order called “ordina”:

  
  
bool testApp::ordina(int &a, int &b){  
    return a<b;  
}  
  

When I try to compile the code, I have this error:
C:\Program Files (x86)\CodeBlocks\of\apps\myApps\Vector\src\testApp.cpp|18|error: no matching function for call to ‘ofSort(std::vector&, )’|

I don’t understard where is the error, I consulted also this example: https://github.com/openframeworks/openFrameworks/pull/965/files

Thanks if someone can halp me.

Hi,
it works if I declare a function directly in testApp.ccp before the “testApp::setup” function for example called “ordina”:

  
  
bool ordina(const int &a, const int &b){  
  return a<b;  
}  
  

and in the “ofSort” function i call the following function:

  
  
ofSort(numbers, ordina);  
  

Thanks if someone can help me understand the problem.