This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: Remove algo duplication
- From: Marc Glisse <marc dot glisse at inria dot fr>
- To: Paolo Carlini <paolo dot carlini at oracle dot com>
- Cc: libstdc++ at gcc dot gnu dot org, Christopher Jefferson <chris at bubblescope dot net>, François Dumont <frs dot dumont at gmail dot com>, Jonathan Wakely <jwakely dot gcc at gmail dot com>
- Date: Tue, 17 Sep 2013 09:07:30 +0200 (CEST)
- Subject: Re: Remove algo duplication
- Authentication-results: sourceware.org; auth=none
- References: <52264074 dot 2050502 at gmail dot com> <alpine dot DEB dot 2 dot 10 dot 1309081625460 dot 3536 at laptop-mg dot saclay dot inria dot fr> <522E246F dot 5040608 at gmail dot com> <E2836BBC-F90D-4AE5-AAAB-EB3242BF030D at oracle dot com> <CA+jCFLtpCASpP1NTru=__hOQo5O-uj0m82YDqmB2wBYxspcQxA at mail dot gmail dot com> <alpine dot DEB dot 2 dot 10 dot 1309151125180 dot 3593 at laptop-mg dot saclay dot inria dot fr> <CA+jCFLsgUS3x0AVQDvn1OUgkYt6EJJojUrL4xrtVo9XQwq8J6A at mail dot gmail dot com> <alpine dot DEB dot 2 dot 10 dot 1309161348100 dot 3698 at laptop-mg dot saclay dot inria dot fr> <523706CD dot 5060707 at oracle dot com> <alpine dot DEB dot 2 dot 10 dot 1309161636200 dot 3698 at laptop-mg dot saclay dot inria dot fr> <52371F6F dot 80409 at oracle dot com> <alpine dot DEB dot 2 dot 10 dot 1309162232110 dot 3698 at laptop-mg dot saclay dot inria dot fr> <52379F90 dot 5000108 at oracle dot com>
- Reply-to: libstdc++ at gcc dot gnu dot org
On Tue, 17 Sep 2013, Paolo Carlini wrote:
I'm not sure however to understand in
detail how much of this is just helper code for the algo duplication work,
and how much is implementation of standard facilities. I suppose however,
that we should cleanly separate the C++11 code from the C++98 emulation and
have the latter only in predefined_ops.h or something.
In the same conversation I apparently invented, I think it was agreed that
less<void> should be provided as an extension in C++11 (not just as a
standard feature in C++14). This way would also provide a close enough
emulation in C++03, but I can totally understand if you don't want one. It
isn't specifically meant for the algo deduplication, which might use a
completely different scheme (François has already tried several). If we
don't do the C++03 emulation, using macros isn't worth it.
In terms of details, we are trying not to use the deprecated unary_function /
binary_function, not even as implementation details. In fact if we find
ourselves often doing that, I don't see why we deprecated the facilities ;)
The current code for std::less uses binary_function, I didn't change it.
It would be easy to change (a single place thanks to the macros). But in
some sense, std::less<T> with T!=void is almost deprecated, so it isn't
that strange that it uses a deprecated feature.
Anyway, I seem to remember that there are concrete issues, like deprecated
warnings in some cases aren't completely shut up in system headers, etc.
Let's try to avoid those.
With macros only used in the header where they are defined, I don't think
it is too hard for the compiler to determine that the location is in a
system header.
--
Marc Glisse