https://gcc.gnu.org/bugzilla/show_bug.cgi?id=122099
Bug ID: 122099
Summary: ranges::sample requires
std::uniform_random_bit_generator to have result_type
Product: gcc
Version: 15.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: libstdc++
Assignee: unassigned at gcc dot gnu.org
Reporter: hewillk at gmail dot com
Target Milestone: ---
which should not.
#include <vector>
#include <algorithm>
struct G {
std::size_t operator()() const;
constexpr static std::size_t min() { return 0; }
constexpr static std::size_t max() { return 42; }
};
int main() {
static_assert(std::uniform_random_bit_generator<G>);
std::vector<int> v;
std::ranges::sample(v, v.begin(), 5, G{});
}
https://godbolt.org/z/53c5eWGMW