shuffle_random removed in C++17 on FreeBSD/Clang??
Hi,
As a consequence of the move to C++17 I'm running into this problem.
--WjW
I'm getting this error:/home/jenkins/workspace/ceph-master/src/osd/ReplicatedBackend.cc:1369:8: error: no member named 'random_shuffle' in namespace 'std'
std::random_shuffle(shuffle.begin(), shuffle.end());
~~~~~^
1 error generated.
And the includefile tells me:
template <class RandomAccessIterator>
void
random_shuffle(RandomAccessIterator first, RandomAccessIterator
last); // deprecated in C++14, removed in C++17
Quoted 13 lines · Willem Jan Withagen
Hi,
As a consequence of the move to C++17 I'm running into this problem.
--WjW
I'm getting this error:
/home/jenkins/workspace/ceph-master/src/osd/ReplicatedBackend.cc:1369:8:
error: no member named 'random_shuffle' in namespace 'std'
std::random_shuffle(shuffle.begin(), shuffle.end()); ~~~~~^
1 error generated.
Quoted 5 lines
And the includefile tells me:
template <class RandomAccessIterator>void random_shuffle(RandomAccessIterator first, RandomAccessIterator last);// deprecated in C++14, removed in C++17
Hmm, yep! http://en.cppreference.com/w/cpp/algorithm/random_shuffle
Looks like we're just using it to re-order the list and pick a random source, so it should be easy enough to replace with a range-restricted integer selection. Here's a quick hack of a fix:
https://github.com/ceph/ceph/pull/19873
-Greg
On Tue, 9 Jan 2018, Willem Jan Withagen wrote:
Hi Willem,
Quoted 1 line
As a consequence of the move to C++17 I'm running into this problem.
std::random_shuffle() was deprecated in C++14 and removed in C++17. Use std::shuffle().
The process is:
0) make a random device (ie. std::random_device)
1) make a distribution associated with that device (ie. std::mt19937)
2) shuffle!
I hope that helps,
-Jesse
Quoted 6 lines · Jesse Williamson
On Tue, 9 Jan 2018, Willem Jan Withagen wrote:
Hi Willem,
Quoted 1 line
As a consequence of the move to C++17 I'm running into this problem.
Quoted 7 lines
std::random_shuffle()was deprecated in C++14 and removed in C++17. Usestd::shuffle().The process is:
0) make a random device (ie.
std::random_device)
1) make a distribution associated with that device (ie.std::mt19937)
2) shuffle!
Yup,
That was what I found as well.
PR was submitted.
--WjW