Vector<Medicine*>* Controller::sortByStockAsc(){
Vector<Medicine*>* all =repo->getAll();
qsort(all, all->getSize(),sizeof(Medicine*), (comparefunction) compareNA);
return all;
}
所以,我有上面的函数,它应该对一个对象数组进行排序。我得到了错误
cannot convert 'Vector<Medicine*>' to 'Vector<Medicine*>*' in initialization
但是,如果我写它,因为Vector<Medicine*> all =repo->getAll();
我在第 3 行收到一堆新错误(如果我在第 2 行有上一个错误,则不存在):
Multiple markers at this line
- Method 'getSize' could not be resolved
- Invalid arguments ' Candidates are: void qsort(void *, unsigned int, unsigned int, int (*)(const void *, const
void *)) '
- base operand of '->' has non-pointer type 'Vector<Medicine*>'
这有什么问题,我该如何解决?