You use the f parameter in the lambda inside asort(), but you don’t capture it. Try adding f to the capture list (change [] to read [&f]).
You use the f parameter in the lambda inside asort(), but you don’t capture it. Try adding f to the capture list (change [] to read [&f]).