how to use set STL for class type

Hi ,
I have one class like this with following data members.

class student
{

char stud_name[30];
char birth_date[9] ;
int stud_id;
char address[50];
};

I would like to store all student name in set STL so for that I would like to declare set variable with own compare function.

I declared like this
set<student*,ltstr> studs;
set<student>::iterator it;

and compare function
struct ltstr
{
bool operator()(const student* s1, const student* s2) const
{
return strcmp(s1->stud_name, s2->stud_name) < 0;
}
};


however I am getting error while compiling
stud_ord.cpp: In member function `bool ltstr::operator()(const student*, const student*) const':
stud_ord.cpp:43: error: cannot convert `const student*' to `const char*' for argument `1' to `int strcmp(const char*, const char*)'


Please tell me how can I remove the above error
That's strange. The call looks correct. Are you sure that the line the error refers to?
Topic archived. No new replies allowed.