I have two methods that I'm using with QT. The PRINTR function just prints information from my COURSE object and PRINTN is supposed to find the difference between two vectors and print the result using PRINTR. The PRINTR function works fine but I'm having problems getting PRINTN to work:
void course::printr(vector<course*> c){
QString string1,string2;
for(int i = 0; i < (int)c.size();i++){
string1 = c[i]->getSubjectCourse();
string2 = c[i]->getTitle();
emit send(QString("%1\t%2").arg(string1).arg(string2));
}
}
When I try to use just a simple object vector I get an error saying QObject is private that is dozens of lines long. For this reason I have to use pointer vectors.
void course::printn(vector<course> a,vector<course> compA){
sort(a.begin(),a.end());
sort(compA.begin(),compA.end());
vector<course*> diff;
set_difference(a.begin(),
a.end(),
compA.begin(),
compA.end(),
inserter(diff,diff.begin()));
course().printr(diff);
}
The problem occurs when I use the pointer vector DIFF in the PRINTN method at the line:
inserter(diff,diff.begin()));
The error message is really long but I think its complaining because I'm trying to pass a pointer vector to the inserter function. When I use a regular object vector the inserter function works by itself but I get the QObject is private error. Is there any way I get get this to work with my current structure? I've tried a couple different variations but they don't work due to QT's structure. I hope I have explained this all clearly but if you need more explanation on what I'm trying to accomplish please let me know. Thanks in advance.