#include <iostream>
#include <vector>
#include <list>
#include <algorithm>
using namespace std;
struct stock{
int numOrder, numStock, price;
};
list <stock> Stock[5][2];
vector <int> Price[5]; int bestPrice[5] = {0, };
bool cmp1(const stock &a, const stock &b){
if(a.price < b.price) return true;
else if(a.price == b.price){
if(a.numOrder < b.numOrder) return true;
}
return false;
}
int buy(int mNumber, int mStock, int mQuantity, int mPrice)
{
mStock--;
sort(Stock[mStock][1].begin(), Stock[mStock][1].end(), cmp1);
return 0;
}
And compile error message is this:
/opt/gcc10/gcc-10.3.0/include/c++/10.3.0/bits/stl_algo.h:1980:22: error: no match for ‘operator-’ (operand types are ‘std::_List_iterator<stock>’ and ‘std::_List_iterator<stock>’)
but I don't know how to correct it.