diff --git a/src/main.cpp b/src/main.cpp index 1e77e27..4f32749 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -44,9 +44,10 @@ int main(int argc, char* argv[]) { const launch& Policy = not parallel ? launch::deferred : launch::async; for (const string_view& fileName: uniqueFiles) { if (fileName != "none") { - Units.push_back(async(Policy, [&fileName, &compile]() { + pair> returnedPair; + Units.push_back(async(Policy, [&returnedPair, &fileName, &compile]() { try { - return pair(compile(fileName), optional()); + returnedPair.first = compile(fileName); } catch (const Yerbacon::Exception& e) { unsigned long lastSlash = 0; unsigned long position1 = fileName.find_last_of('/'); @@ -60,8 +61,10 @@ int main(int argc, char* argv[]) { } #endif } - return pair(string(fileName.substr(lastSlash + 1)), make_optional(e)); + returnedPair.first = fileName.substr(lastSlash + 1); + returnedPair.second.emplace(e); } + return move(returnedPair); })); } }