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

redi at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Thu May 27 10:17:33 GMT 2021


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

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2021-05-27
     Ever confirmed|0                           |1

--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> ---
This works though:

--- include/bits/ranges_algo.h
+++ include/bits/ranges_algo.h
@@ -1762,8 +1762,10 @@
            // which may take linear time.
            auto __lasti = ranges::next(__first, __last);
            return _GLIBCXX_STD_A::
-             sample(std::move(__first), std::move(__lasti), std::move(__out),
-                    __n, std::forward<_Gen>(__g));
+             __sample(std::move(__first), std::move(__lasti),
+                      forward_iterator_tag{},
+                      std::move(__out), 0,
+                      __n, std::forward<_Gen>(__g));
          }
        else
          {


More information about the Gcc-bugs mailing list