samedi 4 juillet 2020

What does " auto var = [&](int i){ } " signify in the code below in C++? [duplicate]

I'm having trouble understanding the meaning behind the line 2 in the code below, please help if you know.


    int best = -1;
    auto consider = [&](int j) {
        if(best == -1 || make_pair(abs(j - i), j) < make_pair(abs(best - i), i))
            best = j;
    };

Aucun commentaire:

Enregistrer un commentaire