I use qsort to sort an std::vector's items, based on a value they have.
This is my code:
It crashes on the qsort line. Anyone knows why?Code:typedef int (*compfn)(const void*, const void*); inline int comp(vector<CRTStaticMesh*>::const_iterator& a, vector<CRTStaticMesh*>::const_iterator& b) { return (static_cast<CRTStaticMesh*>(*a)->GetPosition(NULL)->z - static_cast<CRTStaticMesh*>(*b)->GetPosition(NULL)->z); } qsort((void*)&lst.front(), lst.size(), sizeof(float), (compfn)(comp));