Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove non-determinism in output when traversing directories #120

Merged
merged 1 commit into from
Jul 12, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/utils.cc
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

#include "utils.h"

#include <algorithm> // std::any_of, std::none_of
#include <algorithm> // std::any_of, std::none_of, std::sort
#include <cassert> // assert
#include <fstream> // std::ofstream
#include <iostream> // std::cerr
Expand Down Expand Up @@ -121,6 +121,9 @@ auto for_each_json(const std::vector<std::string> &arguments,
}
}

std::sort(result.begin(), result.end(),
[](const auto &left, const auto &right) { return left < right; });

return result;
}

Expand Down