All pastes #398690 Raw Edit

Someone

public text v1 · immutable
·published 2007-03-17 13:25 UTC
rendered paste body
/usr/include/c++/4.1.2/bits/stl_function.h: In member function ‘bool std::less<_Tp>::operator()(const _Tp&, const _Tp&) const [with _Tp = Process]’:
/usr/include/c++/4.1.2/bits/stl_heap.h:279:   instantiated from ‘void std::__adjust_heap(_RandomAccessIterator, _Distance, _Distance, _Tp, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator<Process*, std::vector<Process, std::allocator<Process> > >, _Distance = int, _Tp = Process, _Compare = std::less<Process>]’
/usr/include/c++/4.1.2/bits/stl_heap.h:404:   instantiated from ‘void std::make_heap(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator<Process*, std::vector<Process, std::allocator<Process> > >, _Compare = std::less<Process>]’
/usr/include/c++/4.1.2/bits/stl_queue.h:367:   instantiated from ‘std::priority_queue<_Tp, _Sequence, _Compare>::priority_queue(const _Compare&, const _Sequence&) [with _Tp = Process, _Sequence = std::vector<Process, std::allocator<Process> >, _Compare = std::less<Process>]’
fcfs.cpp:4:   instantiated from here
/usr/include/c++/4.1.2/bits/stl_function.h:227: error: passing ‘const Process’ as ‘this’ argument of ‘bool Process::operator<(Process)’ discards qualifiers

fcfs.cpp
----------

#include "fcfs.h"
using namespace std;

Fcfs::Fcfs(Process* processes, int num) {
	// take all processes and put onto the ready queue, set ready time to arrival time
	for (int i = 0; i < num; i++) {
		processes[i].readyTime = processes[i].arrival_time;
		queue.push(processes[i]);
	}
}