public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/104561] New: std::ranges::sort, std::ranges::stable_sort and std::ranges::partial_sort do not support proxy references
@ 2022-02-15 23:58 Berenger.Berthoul at onera dot fr
  2022-02-16  0:43 ` [Bug libstdc++/104561] " hewillk at gmail dot com
  2022-02-16  0:44 ` pinskia at gcc dot gnu.org
  0 siblings, 2 replies; 3+ messages in thread
From: Berenger.Berthoul at onera dot fr @ 2022-02-15 23:58 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 104561
           Summary: std::ranges::sort, std::ranges::stable_sort and
                    std::ranges::partial_sort do not support proxy
                    references
           Product: gcc
           Version: og11 (devel/omp/gcc-11)
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: Berenger.Berthoul at onera dot fr
  Target Milestone: ---

std::ranges::sort, std::ranges::stable_sort and std::ranges::partial_sort are
implemented by calls to the old std::sort, std::stable_sort and
std::partial_sort

This is wrong because the non-range algorithms assume that the reference type
of the iterator is a true C++ reference, so it does not work with proxy
references.

I have some code with a proxy reference type that (I think) demonstrates the
problem. However it would be non-trivial to extract in a complete compilable
example... I can do it if necessary, but I don't think this is needed, I am
sure libstdc++ devs know the problem since most other std::ranges:: algorithms
were implemented without the use of the non-range equivalent. (As a side-note,
using std::ranges::partition, it is pretty easy to come up with a quicksort
that works with proxy references)

So my guess would be that the developpers know the problem but did not have
time to implement a correct std::ranges::sort (and the like). But I was unable
to find anything (bug report, standard conformance limitation...). The page
https://en.cppreference.com/w/cpp/compiler_support says that C++20 ranges are
completely implemented since GCC 10.

I am understanding things correcly here?

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

end of thread, other threads:[~2022-02-16  0:44 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-15 23:58 [Bug libstdc++/104561] New: std::ranges::sort, std::ranges::stable_sort and std::ranges::partial_sort do not support proxy references Berenger.Berthoul at onera dot fr
2022-02-16  0:43 ` [Bug libstdc++/104561] " hewillk at gmail dot com
2022-02-16  0:44 ` pinskia at gcc dot gnu.org

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).