Capture fileName by reference since it is now one, and give a type to currentFuture

This commit is contained in:
Username404 2021-08-20 10:39:17 +02:00
parent fdb8579941
commit 8c63f1ae8b
Signed by: Username404-59
GPG Key ID: 7AB361FBB257A5D1
1 changed files with 2 additions and 2 deletions

View File

@ -44,7 +44,7 @@ int main(int argc, char* argv[]) {
const launch& Policy = not parallel ? launch::deferred : launch::async; const launch& Policy = not parallel ? launch::deferred : launch::async;
for (const string_view& fileName: uniqueFiles) { for (const string_view& fileName: uniqueFiles) {
if (fileName != "none") { if (fileName != "none") {
Units.push_back(async(Policy, [fileName, &compile]() { Units.push_back(async(Policy, [&fileName, &compile]() {
try { try {
return pair(compile(fileName), optional<Yerbacon::Exception>()); return pair(compile(fileName), optional<Yerbacon::Exception>());
} catch (const Yerbacon::Exception& e) { } catch (const Yerbacon::Exception& e) {
@ -66,7 +66,7 @@ int main(int argc, char* argv[]) {
} }
} }
if (printResult) cout << "~~~~[Yerbacon compilation result]~~~~\n\n"; if (printResult) cout << "~~~~[Yerbacon compilation result]~~~~\n\n";
for (auto& currentFuture: Units) { for (future<pair<string, optional<Yerbacon::Exception>>>& currentFuture: Units) {
const auto&& result = currentFuture.get(); const auto&& result = currentFuture.get();
if (not result.second.has_value()) { if (not result.second.has_value()) {
if (printResult) cout << result.first << "\n\n"; if (printResult) cout << result.first << "\n\n";