summaryrefslogtreecommitdiffstats
path: root/contrib/restricted/abseil-cpp/absl/algorithm
diff options
context:
space:
mode:
authorthegeorg <[email protected]>2025-06-18 00:36:34 +0300
committerthegeorg <[email protected]>2025-06-18 11:57:29 +0300
commit9d9c0304a08db64ad08584ae698127aef5d36c2a (patch)
tree0447e420e3ef180a285026b18fd719f53fb4aaa0 /contrib/restricted/abseil-cpp/absl/algorithm
parent74b335270a63a46379d471b54fa509cce3ec9c1e (diff)
Update contrib/restricted/abseil-cpp to 20250512.0
Abseil now requires at least `C++17` and follows _Google's Foundational C++ Support Policy_. commit_hash:9209d4b467d10405bf5b082471dcd65c2546c6bc
Diffstat (limited to 'contrib/restricted/abseil-cpp/absl/algorithm')
-rw-r--r--contrib/restricted/abseil-cpp/absl/algorithm/container.h21
1 files changed, 2 insertions, 19 deletions
diff --git a/contrib/restricted/abseil-cpp/absl/algorithm/container.h b/contrib/restricted/abseil-cpp/absl/algorithm/container.h
index 3193656f889..6f9c1938fa8 100644
--- a/contrib/restricted/abseil-cpp/absl/algorithm/container.h
+++ b/contrib/restricted/abseil-cpp/absl/algorithm/container.h
@@ -44,7 +44,6 @@
#include <cassert>
#include <iterator>
#include <numeric>
-#include <random>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
@@ -76,8 +75,8 @@ using ContainerIter = decltype(begin(std::declval<C&>()));
// An MSVC bug involving template parameter substitution requires us to use
// decltype() here instead of just std::pair.
template <typename C1, typename C2>
-using ContainerIterPairType =
- decltype(std::make_pair(ContainerIter<C1>(), ContainerIter<C2>()));
+using ContainerIterPairType = decltype(std::make_pair(
+ std::declval<ContainerIter<C1>>(), std::declval<ContainerIter<C2>>()));
template <typename C>
using ContainerDifferenceType = decltype(std::distance(
@@ -847,25 +846,9 @@ template <typename C, typename OutputIterator, typename Distance,
typename UniformRandomBitGenerator>
OutputIterator c_sample(const C& c, OutputIterator result, Distance n,
UniformRandomBitGenerator&& gen) {
-#if defined(__cpp_lib_sample) && __cpp_lib_sample >= 201603L
return std::sample(container_algorithm_internal::c_begin(c),
container_algorithm_internal::c_end(c), result, n,
std::forward<UniformRandomBitGenerator>(gen));
-#else
- // Fall back to a stable selection-sampling implementation.
- auto first = container_algorithm_internal::c_begin(c);
- Distance unsampled_elements = c_distance(c);
- n = (std::min)(n, unsampled_elements);
- for (; n != 0; ++first) {
- Distance r =
- std::uniform_int_distribution<Distance>(0, --unsampled_elements)(gen);
- if (r < n) {
- *result++ = *first;
- --n;
- }
- }
- return result;
-#endif
}
//------------------------------------------------------------------------------