Fix the pairs returned by the futures of the Units set
This commit is contained in:
parent
700ab109d2
commit
43b4629a6d
12
src/main.cpp
12
src/main.cpp
|
@ -42,10 +42,10 @@ int main(int argc, char* argv[]) {
|
|||
vector<future<pair<string, optional<Yerbacon::Exception>>>> Units;
|
||||
const launch& Policy = not parallel ? launch::deferred : launch::async;
|
||||
for (const string_view& fileName: files) {
|
||||
pair<string, optional<Yerbacon::Exception>> returnedPair;
|
||||
Units.push_back(async(Policy, [&returnedPair, &fileName, &compile]() {
|
||||
Units.push_back(async(Policy, [&fileName, &compile]() {
|
||||
pair<string, optional<Yerbacon::Exception>> 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";
|
||||
|
|
Loading…
Reference in New Issue