Hello folks! I have just joined this forum.
This is actually my first Thread on the internet and need help with using STL sort function. I searched the forum but no related answer was found.
Okay...here's my code;
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
struct MyStruct{
int array[10];
};
vector<MyStruct> str_a(100); //array of structures
int main(){
sort(str_a.begin(), str_a.end()); //call to STL sort
}
I am using a Dev C++ compiler 4.9.9.2 (latest)
It gave several errors related to intra_sort(or intro_sort), partial_sort...
Half of the errors are unknown (the compiler isnt friendly at all)
I tried some modifications..for example:
struct MyStruct{
int array[10];
bool operator< (const MyStruct &);
};
and
std::sort(phone.begin(), phone.end());
I added the operator overloading because one of the errors i get is something like this:
no match found for
intra_sort(_first, _last......)
if(_a < _b){
......
i just dont seem to compile it.
All I wants to do is sort the array in the structure using sort().
If any specifications about the code or errors are needed please let me know.
Thank You.