Capture fileName by reference since it is now one, and give a type to currentFuture
This commit is contained in:
parent
fdb8579941
commit
8c63f1ae8b
|
@ -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";
|
||||||
|
|
Loading…
Reference in New Issue