How to use parallel_sort with this struct:
struct d
{
char name[5];
};
struct less_than_key
{
inline bool operator() (const d& struct1, const d& struct2) const
{
return strcmp(struct1.name, struct2.name) == -1;
}
};
vector<d> my_d;
my_d.resize(3);
strcpy(my_d[0].name, "mike");
strcpy(my_d[1].name, "joe");
strcpy(my_d[2].name, "anna");
parallel_sort(my_d.begin(), my_d.end(), less_than_key());
DONE!, I hope this helps someone else.
Guess it's time to take my Phd in sorting algorithms!