mirror of
https://github.com/chromium/crashpad.git
synced 2025-03-09 22:16:13 +00:00
Declare the random number generator lambda for std::random_shuffle as a local.
When not building against the C++11 library headers, the compiler cannot treat the lambda as lvalue. When building against the C++11 library headers, it is converted to an rvalue. BUG=chromium:542321 R=mark@chromium.org Review URL: https://codereview.chromium.org/1406733003 .
This commit is contained in:
parent
f059c21048
commit
1f1a24cb51
@ -207,9 +207,10 @@ TEST(PruneCrashReports, PruneOrder) {
|
||||
reports.push_back(temp);
|
||||
}
|
||||
// The randomness from std::rand() is not, so use a better rand() instead.
|
||||
std::random_shuffle(reports.begin(), reports.end(), [](int rand_max) {
|
||||
const auto random_generator = [](int rand_max) {
|
||||
return base::RandUint64() % rand_max;
|
||||
});
|
||||
};
|
||||
std::random_shuffle(reports.begin(), reports.end(), random_generator);
|
||||
std::vector<CrashReportDatabase::Report> pending_reports(
|
||||
reports.begin(), reports.begin() + 5);
|
||||
std::vector<CrashReportDatabase::Report> completed_reports(
|
||||
|
Loading…
x
Reference in New Issue
Block a user