diff --git a/src/main.cpp b/src/main.cpp index 0ccfeb8..89b7d63 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -42,10 +42,10 @@ int main(int argc, char* argv[]) { vector>>> Units; const launch& Policy = not parallel ? launch::deferred : launch::async; for (const string_view& fileName: files) { - pair> returnedPair; - Units.push_back(async(Policy, [&returnedPair, &fileName, &compile]() { + Units.push_back(async(Policy, [&fileName, &compile]() { + pair> resultingPair; try { - returnedPair.first = compile(fileName); + resultingPair.first = compile(fileName); } catch (const Yerbacon::Exception& e) { unsigned long lastSlash = 0; unsigned long position1 = fileName.find_last_of('/'); @@ -59,10 +59,10 @@ int main(int argc, char* argv[]) { } #endif } - returnedPair.first = fileName.substr(lastSlash + 1); - returnedPair.second.emplace(e); + resultingPair.first = fileName.substr(lastSlash + 1); + resultingPair.second.emplace(e); } - return move(returnedPair); + return resultingPair; })); } if (printResult) cout << "~~~~[Yerbacon compilation result]~~~~\n\n";