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.

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)
	{
	if(s.getSID()<=s.getSID())
		return true;
	else
		return false;
	}
	friend bool operator==(Student s,Student c)
	{
		if(s.getSID()==c.getSID())
			return true;
		else
			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.