Sorting STL Vector of Pointers (Split)
[Mod note: split from here: http://cboard.cprogramming.com/cplus...pointers.html]
Hi! I know that this topi is very old but I will try anyway...
I had exactly the same problem with the sorting of a vector of pointer to objects. But my situation is a bit different:
I have a the files Function.cc and Function.hh that define the object Function. I call this object in a main file and there I fill a vector with Function*. Now I want to sort the vector in this main file.
If i define the comparing struct in the main file before int main{} (so as a function) it works perfectly... but can I define it inside the Fuction.cc (or .hh) file and then call it for the sort in the main file? At the momenti I just get "Compare is not defined in main.cpp"
thanks in advace!
Giulia