hello every one here, hoping u're all doing fine.
i am face with a wierd error while trying to encode a class about courses and students ( student is itself a class)
i'm give this error, and googling seems of no help!
error C2784: 'bool std::operator <(const std::pair<_Ty1,_Ty2> &,const std::pair<_Ty1,_Ty2> &)' : could not deduce template argument for 'const std::pair<_Ty1,_Ty2> &' from 'const Student'
c:\program files\microsoft visual studio 9.0\vc\include\utility(84) : see declaration of 'std::operator <'
i highly appriciate every single help! i'm not left with much time!
class Student
{
private:
string name;
string family;
double mean;
public:
int SID;
Student(int SID,char* name,char* family,double mean);
Student(const Student&);
~Student();
int getSID()const;
bool operator==(Student s);
};
class Course
{
private:
int CID;
string name;
string profName;
int numOfTAs;
int numOfStudents;
vector<Student> TAs;
map<Student,int> studentGrades;
public:
Course(int CID,char* name,char*profname);
Course(const Course&);
~Course();
//bool setGrade(Student student);
bool addStudent(Student student);
bool addTA(Student ta);
Student getTAByStudentNumber(int num);
Student getStudentBystudentNumber(int num);
double average();
double maximum();
double minimum();
int numOfFailedStudents();
vector<Student>failedStudents();
};
Student Course::getStudentBystudentNumber(int num)
{
map<Student,int>::iterator i;
for(i=studentGrades.begin();i!=studentGrades.end();i++)
if((i->first).getSID()==num)
return(i->first);
cout<<"Student not found."<<"The first Student is returned by default"<<endl;
return studentGrades.begin()->first;
}
int Course::numOfFailedStudents()
{
int count=0;
map<Student,int>::iterator i=studentGrades.begin();
for(i=studentGrades.begin();i!=studentGrades.end();i++)
if((i->second)<10)
count++;
return count;
}
other implimentations are more or less the same, the problem must originate somewhere inside this function..
thanks in advance.