Skip to content

Commit 3a07428

Browse files
Abseil Teamcopybara-github
Abseil Team
authored andcommitted
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
1 parent 5f3435a commit 3a07428

File tree

1 file changed

+0
-17
lines changed

1 file changed

+0
-17
lines changed

absl/algorithm/container.h

-17
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@
4444
#include <cassert>
4545
#include <iterator>
4646
#include <numeric>
47-
#include <random>
4847
#include <type_traits>
4948
#include <unordered_map>
5049
#include <unordered_set>
@@ -847,25 +846,9 @@ template <typename C, typename OutputIterator, typename Distance,
847846
typename UniformRandomBitGenerator>
848847
OutputIterator c_sample(const C& c, OutputIterator result, Distance n,
849848
UniformRandomBitGenerator&& gen) {
850-
#if defined(__cpp_lib_sample) && __cpp_lib_sample >= 201603L
851849
return std::sample(container_algorithm_internal::c_begin(c),
852850
container_algorithm_internal::c_end(c), result, n,
853851
std::forward<UniformRandomBitGenerator>(gen));
854-
#else
855-
// Fall back to a stable selection-sampling implementation.
856-
auto first = container_algorithm_internal::c_begin(c);
857-
Distance unsampled_elements = c_distance(c);
858-
n = (std::min)(n, unsampled_elements);
859-
for (; n != 0; ++first) {
860-
Distance r =
861-
std::uniform_int_distribution<Distance>(0, --unsampled_elements)(gen);
862-
if (r < n) {
863-
*result++ = *first;
864-
--n;
865-
}
866-
}
867-
return result;
868-
#endif
869852
}
870853

871854
//------------------------------------------------------------------------------

0 commit comments

Comments
 (0)