[patch] : Improve std::search on v7

Chris Jefferson caj@cs.york.ac.uk
Sun Jun 19 11:48:00 GMT 2005


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



More information about the Libstdc++ mailing list