I have a compilation error: “no matching function for call to find(std::_List_iterator<Process>, std::_List_iterator<Process>, Process&)” in my c++ program.
The mfqueue class looks like:
MFQueue::MFQueue() {
list<Process> queue;
vector<int> ran;
int time_quantum = 0;
int run_for = 0;
}
MFQueue::MFQueue(int quantum) {
list<Process> queue;
vector<int> ran;
int time_quantum = quantum;
int run_for = 0;
}
“Process” is one of my class
bool MFQueue::contains(Process p) {
list<Process>::iterator itr = find(queue.begin(), queue.end(), p);
return (p == *itr);;
}
Does anyone know how to fix this problem? Thanks in advance!
Add
#include <algorithm>to your CPP file.