This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
rel_ops (was Re: GCC 3.1 Release)
- From: Joe Buck <Joe dot Buck at synopsys dot com>
- To: gdr at codesourcery dot com (Gabriel Dos Reis)
- Cc: mark at codesourcery dot com (Mark Mitchell),gdr at codesourcery dot com (Gabriel Dos Reis),Joe dot Buck at synopsys dot COM (Joe Buck), phil at jaj dot com (Phil Edwards),gcc at gcc dot gnu dot org (gcc at gcc dot gnu dot org), bkoz at redhat dot com (bkoz at redhat dot com),libstdc++ at gcc dot gnu dot org (libstdc++ at gcc dot gnu dot org)
- Date: Tue, 16 Apr 2002 09:47:51 -0700 (PDT)
- Subject: rel_ops (was Re: GCC 3.1 Release)
Gaby:
> | > I'll apply the same thing to mainline. Branch requires your approval
> | > if I understand correctly.
Mark:
> | Do it. And thank you. And please close the high-priority PR. :-)
Gaby:
> Done. Thanks.
I see that Gaby couldn't resist throwing in an editorial comment attacking
std::rel_ops. After the attack, Gaby asks "Can someone remind me what
generic programming is about?"
I will remind him that the ability to define just operator== and operator<
and automatically get correct definitions of the other four, every time,
(at least for a large number of cases) is a powerful instance of of
generic programming, and this is exactly what generic programming is
about. I have a large C++ project that greatly benefits from that
feature.
Sometimes this is not what's desired (especially when operator== and
operator< return some class rather than bool), but that is solved by
creating the rel_ops namespace. Library implementers must pay a price for
rel_ops, as the standard library has to work even if the user imports the
rel_ops namespace, but it is not a large price.
I'm not going to ask that the comment be stricken, but I'm not crazy
about the idea of a lot of editorial commentary in the headers.
The one-line comment I originally had would have been enough for
maintainers (who need to be told why there is a seemingly redundant
definition).