I'm wondering how I can sort a vector
of floats
.
I found various answers how to sort a vector
with custom objects
and adding compare method to them.
But what if I'm just want to sort a vector
of regular floats
.
e.g. std::vector<float> var {1.f, -3.14f, .12f};
?
I thought about this easy approach: std::sort(var.begin(), var.end());
but this gives me the following error:
'_First': you cannot assign to a variable that is const
'_Next1': you cannot assign to a variable that is const
'_Next1': you cannot assign to a variable that is const
Aucun commentaire:
Enregistrer un commentaire