In my TeamMatcher.C, I have the following bit of code:
void TeamMatcher::makeTeamSet(){
//Segmentation fault here:
Team tempTeam(rosterExcellent[0]);
//...more code in this method below this point, but it has all been commented out.
rosterExcellent is a vector
Here is the constructor for Team(Student member1):
Team::Team (Student member1)
{
// members is a vector<Student> instance variable in Team
// commonHrsAvailable is a vector<int> in Team
// members.push_back(member1);
//commonHrsAvailable = member1.hrsAvailable;
//numberOfCommonHrsAvailable = commonHrsAvailable.size();
}
Notice all the lines are commented out and I still get the segmentation fault. This is the last bit of code to be executed.
Now, I messed around changing members to vector, changing this constructor's parameter to a Student*, and the rosterExcellent to vector (as well as changing the . notation to -> where appropriate). I got it to the point where it would run the first line of the constructor (members.push_back(member1)), but it seg faulted on the next line (even after I changed to -> notation).
rosterExcellentis a null pointer or an empty vector?Student's copy constructor and destructor.