Go to:
Gentoo Home
Documentation
Forums
Lists
Bugs
Planet
Store
Wiki
Get Gentoo!
Gentoo's Bugzilla – Attachment 861648 Details for
Bug 902851
dev-libs/darts-0.32h_pre20181117064816: build failed with sys-devel/clang-16.0.0 (error: no member named 'random_shuffle' in namespace 'std')
Home
|
New
–
[Ex]
|
Browse
|
Search
|
Privacy Policy
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch using custom random_shuffle
0001-Using-custom-random_shuffle.patch (text/plain), 1.40 KB, created by
Brahmajit Das
on 2023-05-14 05:51:40 UTC
(
hide
)
Description:
Patch using custom random_shuffle
Filename:
MIME Type:
Creator:
Brahmajit Das
Created:
2023-05-14 05:51:40 UTC
Size:
1.40 KB
patch
obsolete
>From dbf839b982ecb8f3456c14195204d9d1a8a18a7d Mon Sep 17 00:00:00 2001 >From: Brahmajit Das <brahmajit.xyz@gmail.com> >Date: Sun, 14 May 2023 11:15:13 +0530 >Subject: [PATCH] Using custom random_shuffle > >C++17 have removed random_shuffle (deprecated in C++14). Upstream seems >dead too, hence using custom implementation of random_shuffle from >https://en.cppreference.com/w/cpp/algorithm/random_shuffle. > >Closes: https://bugs.gentoo.org/902851 >Signed-off-by: Brahmajit Das <brahmajit.xyz@gmail.com> >--- > src/lexicon.h | 14 +++++++++++++- > 1 file changed, 13 insertions(+), 1 deletion(-) > >diff --git a/src/lexicon.h b/src/lexicon.h >index a2935f4..3653194 100644 >--- a/src/lexicon.h >+++ b/src/lexicon.h >@@ -11,6 +11,18 @@ > > #include "./mersenne-twister.h" > >+template<class RandomIt, class RandomFunc> >+void random_shuffle(RandomIt first, RandomIt last, RandomFunc&& r) >+{ >+ typedef typename std::iterator_traits<RandomIt>::difference_type diff_t; >+ >+ for (diff_t i = last - first - 1; i > 0; --i) >+ { >+ using std::swap; >+ swap(first[i], first[r(i + 1)]); >+ } >+} >+ > namespace Darts { > > class Lexicon { >@@ -60,7 +72,7 @@ class Lexicon { > void randomize() { > Darts::MersenneTwister mt( > static_cast<Darts::MersenneTwister::int_type>(std::time(NULL))); >- std::random_shuffle(keys_.begin(), keys_.end(), mt); >+ random_shuffle(keys_.begin(), keys_.end(), mt); > } > > void split(); >-- >2.40.1 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 902851
:
858767
|
858769
| 861648