From 3a074281f32d92e56c2068954cd64d207fd52eba Mon Sep 17 00:00:00 2001 From: Abseil Team Date: Wed, 30 Apr 2025 10:22:14 -0700 Subject: [PATCH] Remove fallback code in absl/algorithm/container.h The fallback code is dead code since C++14 is no longer supported. PiperOrigin-RevId: 753219255 Change-Id: I79cf1d2c8678f066a4154e35f114b79a99fff90b --- absl/algorithm/container.h | 17 ----------------- 1 file changed, 17 deletions(-) diff --git a/absl/algorithm/container.h b/absl/algorithm/container.h index 3193656f..913268dd 100644 --- a/absl/algorithm/container.h +++ b/absl/algorithm/container.h @@ -44,7 +44,6 @@ #include #include #include -#include #include #include #include @@ -847,25 +846,9 @@ template 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(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(0, --unsampled_elements)(gen); - if (r < n) { - *result++ = *first; - --n; - } - } - return result; -#endif } //------------------------------------------------------------------------------