public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/100795] New: ranges::sample should not use std::sample directly
@ 2021-05-27 10:07 hewillk at gmail dot com
  2021-05-27 10:17 ` [Bug libstdc++/100795] " redi at gcc dot gnu.org
                   ` (9 more replies)
  0 siblings, 10 replies; 11+ messages in thread
From: hewillk at gmail dot com @ 2021-05-27 10:07 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 100795
           Summary: ranges::sample should not use std::sample directly
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: hewillk at gmail dot com
  Target Milestone: ---

Since some random access ranges are only input ranges in C++17, this will cause
ranges::sample to incorrectly reject the following valid case:


#include <algorithm>
#include <iostream>
#include <random>
#include <ranges>

int main() {
  std::ranges::sample(
    std::views::iota(0, 42),
    std::ostream_iterator<int>{std::cout, " "},
    42,
    std::mt19937{std::random_device{}()});
}

https://godbolt.org/z/dbWWTPKhx

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2022-07-20  6:30 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-27 10:07 [Bug libstdc++/100795] New: ranges::sample should not use std::sample directly hewillk at gmail dot com
2021-05-27 10:17 ` [Bug libstdc++/100795] " redi at gcc dot gnu.org
2021-05-27 11:55 ` hewillk at gmail dot com
2021-05-27 12:11 ` hewillk at gmail dot com
2021-05-27 14:53 ` hewillk at gmail dot com
2021-05-27 14:58 ` hewillk at gmail dot com
2021-07-16 16:01 ` ppalka at gcc dot gnu.org
2021-07-16 16:22 ` hewillk at gmail dot com
2021-11-23 16:54 ` barry.revzin at gmail dot com
2022-02-16  0:44 ` pinskia at gcc dot gnu.org
2022-07-20  6:30 ` hewillk at gmail dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).