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
	string name;
	string family;
	double mean;
	int SID;
	Student(int SID,char* name,char* family,double mean);
	Student(const Student&);
	int getSID()const;
	bool operator==(Student s);

class Course
	int CID;
	string name;
	string profName;
	int numOfTAs;
	int numOfStudents;
	vector<Student> TAs;
	map<Student,int> studentGrades;
	Course(int CID,char* name,char*profname);
	Course(const 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();


Student Course::getStudentBystudentNumber(int num)
	map<Student,int>::iterator i;


	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();

	return count;


other implimentations are more or less the same, the problem must originate somewhere inside this function..
thanks in advance.

The map class uses an overloaded operator< for maintaining the relation between keys. Your Student class doesn't have this overloaded operator. That should give you a starting point for researching a solution.

thank you very much, the problem is comming from this operator.
i overloaded the operator like this :

friend bool operator<(Student s,Student c)
		return true;
		return false;
	friend bool operator==(Student s,Student c)
			return true;
			return false;

the errors disappeared but i get a run time error, saying :
Invalid operator <
cant figure out why it is invalid !

i had to make the operator const,since const objects wouldnt then have access to it, moreover i brought the operator overloading inside the class ,rather than a friend function...and now it works. thanks after all.

This question has already been answered. Start a new discussion instead.