diff options
author | ignat <ignat@yandex-team.com> | 2024-08-06 11:18:40 +0300 |
---|---|---|
committer | ignat <ignat@yandex-team.com> | 2024-08-06 12:39:57 +0300 |
commit | 1f8ff429f58361372263a2a5e85ddf5a7c83890d (patch) | |
tree | 4473688dc19ae216d7afc024bdb987ac528a27c8 /contrib/restricted | |
parent | 71b83d2d0c089e0192004d1c08ec46c9b330f327 (diff) | |
download | ydb-1f8ff429f58361372263a2a5e85ddf5a7c83890d.tar.gz |
YT-22431: add patch to thrift for C++-17 compatibility
6cc1faf90b8b7c009e9df27e7e3c657b56698771
Diffstat (limited to 'contrib/restricted')
-rw-r--r-- | contrib/restricted/thrift/thrift/transport/TSocketPool.cpp | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/contrib/restricted/thrift/thrift/transport/TSocketPool.cpp b/contrib/restricted/thrift/thrift/transport/TSocketPool.cpp index 9aad9b3810..0511f45d1b 100644 --- a/contrib/restricted/thrift/thrift/transport/TSocketPool.cpp +++ b/contrib/restricted/thrift/thrift/transport/TSocketPool.cpp @@ -21,11 +21,13 @@ #include <algorithm> #include <iostream> +#if __cplusplus >= 201703L +#include <random> +#endif #include <thrift/transport/TSocketPool.h> using std::pair; -using std::random_shuffle; using std::string; using std::vector; @@ -189,7 +191,13 @@ void TSocketPool::open() { } if (randomize_ && numServers > 1) { - random_shuffle(servers_.begin(), servers_.end()); +#if __cplusplus >= 201703L + std::random_device rng; + std::mt19937 urng(rng()); + std::shuffle(servers_.begin(), servers_.end(), urng); +#else + std::random_shuffle(servers_.begin(), servers_.end()); +#endif } for (size_t i = 0; i < numServers; ++i) { |