Fix for C++17: switch out random_shuffle for shuffle.
For details see https://clang.llvm.org/extra/clang-tidy/checks/modernize-replace-random-shuffle.html
This commit is contained in:
parent
59bb99e7ee
commit
a309aa732b
57
external/patch-omptl
vendored
57
external/patch-omptl
vendored
@ -113,3 +113,60 @@ diff -ur omptl.old/omptl_tools.h omptl/omptl_tools.h
|
||||
|
||||
namespace omptl
|
||||
{
|
||||
diff -ur omptl.old/omptl_algorithm_par.h omptl/omptl_algorithm_par.h
|
||||
--- omptl.old/omptl_algorithm_par.h 2012-04-22 16:29:41.000000000 +0200
|
||||
+++ omptl/omptl_algorithm_par.h 2022-06-09 13:50:05.000000000 +0200
|
||||
@@ -20,6 +20,7 @@
|
||||
#include <utility>
|
||||
#include <cmath>
|
||||
#include <cstdlib>
|
||||
+#include <random>
|
||||
|
||||
#include <omptl/omptl_tools.h>
|
||||
#include <omptl/omptl_numeric>
|
||||
@@ -1309,14 +1310,14 @@
|
||||
void random_shuffle(RandomAccessIterator first, RandomAccessIterator last,
|
||||
const unsigned P)
|
||||
{
|
||||
- std::random_shuffle(first, last);
|
||||
+ std::shuffle(first, last, std::mt19937(std::random_device()()));
|
||||
}
|
||||
|
||||
template <class RandomAccessIterator, class RandomNumberGenerator>
|
||||
void random_shuffle(RandomAccessIterator first, RandomAccessIterator last,
|
||||
RandomNumberGenerator& rgen, const unsigned P)
|
||||
{
|
||||
- std::random_shuffle(first, last, rgen);
|
||||
+ std::shuffle(first, last, std::mt19937(std::random_device()()));
|
||||
}
|
||||
|
||||
// Not (yet) parallelized, not straightforward due to possible dependencies
|
||||
diff -ur omptl.old/omptl_algorithm_ser.h omptl/omptl_algorithm_ser.h
|
||||
--- omptl.old/omptl_algorithm_ser.h 2012-04-22 16:29:41.000000000 +0200
|
||||
+++ omptl/omptl_algorithm_ser.h 2022-06-09 13:50:41.000000000 +0200
|
||||
@@ -14,7 +14,7 @@
|
||||
// You should have received a copy of the GNU Lesser General Public
|
||||
// License along with this library; if not, write to the Free Software
|
||||
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
-
|
||||
+#include <random>
|
||||
|
||||
namespace omptl
|
||||
{
|
||||
@@ -463,14 +463,14 @@
|
||||
void random_shuffle(RandomAccessIterator first, RandomAccessIterator last,
|
||||
const unsigned P)
|
||||
{
|
||||
- return ::std::random_shuffle(first, last);
|
||||
+ return ::std::shuffle(first, last, std::mt19937(std::random_device()()));
|
||||
}
|
||||
|
||||
template <class RandomAccessIterator, class RandomNumberGenerator>
|
||||
void random_shuffle(RandomAccessIterator first, RandomAccessIterator last,
|
||||
RandomNumberGenerator &rgen, const unsigned P)
|
||||
{
|
||||
- return ::std::random_shuffle(first, last, rgen);
|
||||
+ return ::std::shuffle(first, last, std::mt19937(std::random_device()()));
|
||||
}
|
||||
|
||||
template <class ForwardIterator, class T>
|
||||
|
Loading…
Reference in New Issue
Block a user