diff options
| author | ignat <[email protected]> | 2024-08-06 11:18:40 +0300 |
|---|---|---|
| committer | ignat <[email protected]> | 2024-08-06 12:39:57 +0300 |
| commit | 1f8ff429f58361372263a2a5e85ddf5a7c83890d (patch) | |
| tree | 4473688dc19ae216d7afc024bdb987ac528a27c8 | |
| parent | 71b83d2d0c089e0192004d1c08ec46c9b330f327 (diff) | |
YT-22431: add patch to thrift for C++-17 compatibility
6cc1faf90b8b7c009e9df27e7e3c657b56698771
| -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 9aad9b38108..0511f45d1b0 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) { |
