Improve the lambda used to return the compilation result in main.cpp
This commit is contained in:
parent
66e1926783
commit
facf460923
|
@ -44,9 +44,10 @@ 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]() {
|
pair<string, optional<Yerbacon::Exception>> returnedPair;
|
||||||
|
Units.push_back(async(Policy, [&returnedPair, &fileName, &compile]() {
|
||||||
try {
|
try {
|
||||||
return pair(compile(fileName), optional<Yerbacon::Exception>());
|
returnedPair.first = compile(fileName);
|
||||||
} catch (const Yerbacon::Exception& e) {
|
} catch (const Yerbacon::Exception& e) {
|
||||||
unsigned long lastSlash = 0;
|
unsigned long lastSlash = 0;
|
||||||
unsigned long position1 = fileName.find_last_of('/');
|
unsigned long position1 = fileName.find_last_of('/');
|
||||||
|
@ -60,8 +61,10 @@ int main(int argc, char* argv[]) {
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
return pair(string(fileName.substr(lastSlash + 1)), make_optional(e));
|
returnedPair.first = fileName.substr(lastSlash + 1);
|
||||||
|
returnedPair.second.emplace(e);
|
||||||
}
|
}
|
||||||
|
return move(returnedPair);
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue