jeudi 27 juillet 2017

C++ lambda predefined_ops.h:123:46: error: void value not ignored as it ought to be

I got this error message while compiling my C++ code where I am using a lambda to sort my vector.

vector<Myobj*> container;
sort(container.begin(), container.end(), [](Myobj* a, Myobj* b){ a->getFieldx() < b->getFieldx(); });

It took a few minute before I could realize where I got it wrong.

Aucun commentaire:

Enregistrer un commentaire