public inbox for libstdc++@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jonathan Wakely <jwakely@redhat.com>
To: libstdc++@gcc.gnu.org, gcc-patches@gcc.gnu.org
Subject: [committed] libstdc++: Update documentation comments for namespace rel_ops
Date: Fri, 23 Jul 2021 11:45:24 +0100	[thread overview]
Message-ID: <YPqdxOyyws+M2RhA@redhat.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 730 bytes --]

The comments in <bits/stl_relops.h> describe problems that were solved
years ago (for GCC 3.1). The comparison operators in <iterator> are no
longer ambiguous with the rel_ops ones, so the linked mailing list
thread and FAQ entry aren't relevant now. The reference to std_utility.h
is also outdated as it's just called utility now, both in the source
tree and when installed.

The use of rel_ops is still frowned upon though, so replace the
discussion of ambiguities within libstdc++ headers with adminition about
using rel_ops in user code.

Signed-off-by: Jonathan Wakely <jwakely@redhat.com>

libstdc++-v3/ChangeLog:

	* include/bits/stl_relops.h: Update documentation comments.

Tested powerpc64le-linux. Committed to trunk.


[-- Attachment #2: patch.txt --]
[-- Type: text/plain, Size: 2392 bytes --]

commit 5b965dc49a6a4293ce85bc3a24ca3f3855469e68
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Fri Jul 23 11:03:23 2021

    libstdc++: Update documentation comments for namespace rel_ops
    
    The comments in <bits/stl_relops.h> describe problems that were solved
    years ago (for GCC 3.1). The comparison operators in <iterator> are no
    longer ambiguous with the rel_ops ones, so the linked mailing list
    thread and FAQ entry aren't relevant now. The reference to std_utility.h
    is also outdated as it's just called utility now, both in the source
    tree and when installed.
    
    The use of rel_ops is still frowned upon though, so replace the
    discussion of ambiguities within libstdc++ headers with adminition about
    using rel_ops in user code.
    
    Signed-off-by: Jonathan Wakely <jwakely@redhat.com>
    
    libstdc++-v3/ChangeLog:
    
            * include/bits/stl_relops.h: Update documentation comments.

diff --git a/libstdc++-v3/include/bits/stl_relops.h b/libstdc++-v3/include/bits/stl_relops.h
index 276894c435a..ef522031318 100644
--- a/libstdc++-v3/include/bits/stl_relops.h
+++ b/libstdc++-v3/include/bits/stl_relops.h
@@ -52,13 +52,8 @@
  *  This is an internal header file, included by other library headers.
  *  Do not attempt to use it directly. @headername{utility}
  *
- *  Inclusion of this file has been removed from
- *  all of the other STL headers for safety reasons, except std_utility.h.
- *  For more information, see the thread of about twenty messages starting
- *  with http://gcc.gnu.org/ml/libstdc++/2001-01/msg00223.html, or
- *  http://gcc.gnu.org/onlinedocs/libstdc++/faq.html#faq.ambiguous_overloads
- *
- *  Short summary: the rel_ops operators should be avoided for the present.
+ *  This file is only included by `<utility>`, which is required by the
+ *  standard to define namespace `rel_ops` and its contents.
  */
 
 #ifndef _STL_RELOPS_H
@@ -72,6 +67,12 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
   {
     /** @namespace std::rel_ops
      *  @brief  The generated relational operators are sequestered here.
+     *
+     *  Libstdc++ headers must not use the contents of `rel_ops`.
+     *  User code should also avoid them, because unconstrained function
+     *  templates are too greedy and can easily cause ambiguities.
+     *
+     *  C++20 default comparisons are a better solution.
      */
 
     /**

                 reply	other threads:[~2021-07-23 10:45 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YPqdxOyyws+M2RhA@redhat.com \
    --to=jwakely@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=libstdc++@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).