mirror of
https://codeberg.org/guix/guix.git
synced 2025-10-02 02:15:12 +00:00
daemon: Replace ‘random_shuffle’ with ‘shuffle’.
‘std::random_shuffle’ was removed in C++14. * nix/libstore/gc.cc (LocalStore::collectGarbage): Use ‘std::random’ and ‘std::shuffle’. Change-Id: If91ed3ec3596a419ae7c87d7ce677e0970853e9f Signed-off-by: Ludovic Courtès <ludo@gnu.org>
This commit is contained in:
parent
437bb9ece5
commit
5f3518ca83
1 changed files with 4 additions and 1 deletions
|
@ -4,6 +4,7 @@
|
|||
|
||||
#include <functional>
|
||||
#include <queue>
|
||||
#include <random>
|
||||
#include <algorithm>
|
||||
|
||||
#include <sys/types.h>
|
||||
|
@ -745,7 +746,9 @@ void LocalStore::collectGarbage(const GCOptions & options, GCResults & results)
|
|||
alphabetically first (e.g. /nix/store/000...). This
|
||||
matters when using --max-freed etc. */
|
||||
vector<Path> entries_(entries.begin(), entries.end());
|
||||
random_shuffle(entries_.begin(), entries_.end());
|
||||
std::random_device seeder;
|
||||
std::default_random_engine generator(seeder());
|
||||
std::shuffle(entries_.begin(), entries_.end(), generator);
|
||||
|
||||
foreach (vector<Path>::iterator, i, entries_)
|
||||
tryToDelete(state, *i);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue