The full error message reads:
Error C2679: binary '<<' : no operator found which takes a right-hand operand of type 'std::_Vector_iterator< std ::_Vector_val < std::_ Simple _ types < projects > > >' (or there is no acceptable conversion)
Not the prettiest but here's my code up to the error, with the getters and setter functions happening elsewhere, but they don't seem important to this error:
#include "Project.hpp"
#include <iostream>
#include <sstream>
#include <string>
#include <fstream>
#include <list>
#include <ostream>
#include <stdlib.h>
using namespace std;
int main(){
cout << "Welcome to our project topic allocator, please enter the student spreadsheet; " << endl;
vector<student> studentvector;
vector<projects> projectsvector;
vector<projects> availchoicevector;
//string excelsupervisor;
//supervisor staff;
string excelstudent;
student pupil;
string excelprojects;
projects selections;
selections.zbbb(excelprojects);
//pupil.xbbb(excelstudent);
//staff.ybbb(excelsupervisor);
int counter;
vector<student>::iterator first1 = studentvector.begin(), last1 = studentvector.end(), fileline1;
vector<projects>::iterator first2 = projectsvector.begin(), last2 = projectsvector.end(), fileline2;
for (fileline1 = studentvector.begin(), fileline2 = projectsvector.begin(); fileline1 != studentvector.end(), fileline2 != projectsvector.end(); fileline1++, fileline2++){
cout << "Student ID " << fileline1->get_studentname() << endl;
int var1 = fileline1->get_numberofselections();
if (var1 = !4){
cout << "Student has not made 4 choices, consult student!" << endl;
fileline2 = fileline2 + (var1 - 1);
continue;
}
else{
//for (fileline2; fileline2 < fileline2 + 4; fileline2++){
const auto &p = fileline2->get_projectID(); //fileline2 = 1st choice
auto y = find(availchoicevector.begin(), availchoicevector.end(), p);
if (y != availchoicevector.end()){
cout << "Project ID . Supervisor ID of allocated choice: " << *y << "." << fileline2->get_supervisorIDproj << endl;}
With the error occurring on the last line at the "<<" before the "*y".
Here's the header that corresponds to this part of the code.
class projects{
private:
string projectname, projectsup, supervisornameproj, stunameproj;
float projectID;
int itterator, rank, classs, supervisorIDproj, stuIDproj, regnumproj;
public:
projects();
~projects();
void set_projectname(string);
void set_supervisornameproj(string);
void set_stunameproj(string);
void set_stuIDproj(int);
void set_supervisorIDproj(int);
void set_projectID(int);
void set_regnumproj(int);
void set_rank(int);
void set_classs(int);
string get_projectname(){return projectname;}
string get_stunameproj(){return stunameproj;}
string get_supervisornameproj(){return supervisornameproj;}
int get_regnumproj(){return regnumproj;}
int get_supervisorIDproj(){return supervisorIDproj;}
int get_stuIDproj(){return stuIDproj;}
int get_projectID(){return projectID;}
int get_rank(){return rank;}
int get_classs(){return classs;}
bool zbbb(string);
bool sorting(int);
vector<projects> projectsvector;
vector<projects> availchoicevector;
};
I wish to know how to resolve this matter. I understand I should overload the << operator but I have no idea how to do it for this case!
Any help would be greatly appreciated!