This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [patch] : Improve std::search on v7
- From: Chris Jefferson <caj at cs dot york dot ac dot uk>
- To: Gabriel Dos Reis <gdr at integrable-solutions dot net>
- Cc: libstdc++ <libstdc++ at gcc dot gnu dot org>, gcc-patches at gcc dot gnu dot org
- Date: Sun, 19 Jun 2005 12:49:30 +0100
- Subject: Re: [patch] : Improve std::search on v7
- References: <42B53A83.9020405@cs.york.ac.uk> <m3fyvehdwh.fsf@uniton.integrable-solutions.net>
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Gabriel Dos Reis wrote:
> chris jefferson <caj@cs.york.ac.uk> writes:
>
> | This is quite a simple patch that does a few things.
> |
> | 1) Adds a new version of a more generic bind2nd to predefined_ops.h
> | (if anyone has the old copy, it should be dumped and the file replaced
> | with a clean CVS version, then this patch applied.
> |
> | This uses the "Empty Base Optimization" to avoid PR20408, but even if
>
>
> I think we have already proven in the past that non-careful uses of
> EBO change program semantics. Think of a function object with virtual
> operator().
>
Hmm.. out of interest, could you give an example of exactly how this can
break? I've heard of such problems with EBO, but couldn't find a
concrete example of it breaking, and failed to do so myself (possibly a
lack of imagination).
Regardless of this however, I shall do what I should probably have done
in the first place, which is something like:
template <typename Comp, typename Val>
struct __bind2nd
{
struct trivial : private Comp
{ Val& val; }
...
};
and this way there is no possibility of evil leakage.
Chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.0 (MingW32)
iD8DBQFCtVvJ3FpDzErifpIRAtyWAJ9fzKkwwHrJ/3sNMGhgqqcO9Xu4iwCfWUnQ
dYigwxfYQ3JcgLzQ5piZPcs=
=PoDq
-----END PGP SIGNATURE-----