[Bug libstdc++/100795] ranges::sample should not use std::sample directly

hewillk at gmail dot com gcc-bugzilla@gcc.gnu.org
Thu May 27 12:11:31 GMT 2021


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100795

--- Comment #3 from 康桓瑋 <hewillk at gmail dot com> ---
(In reply to 康桓瑋 from comment #2)
> ranges::inplace_merge has the same issue:
> 
> 
> #include <algorithm>
> #include <array>
> #include <ranges>
> 
> int main() {
>   std::array a{42, 42, 42};
>   auto r = std::views::iota(0, 3) | 
>            std::views::transform([&a](int i) -> int& { return a[i]; });
>   std::ranges::inplace_merge(r, r.begin());
> }
> 
> https://godbolt.org/z/q6jbxGMjd

Same for ranges::stable_sort and ranges::stable_partition.
(https://godbolt.org/z/qffGMW477)


More information about the Gcc-bugs mailing list