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
Paolo Carlini <pcarlini@suse.de> writes:
| 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().
| >
| It seems to me that in principle we could avoid such troubles and pursue
| Chris proposal by preliminarily checking whether the comparison operator
| is actually empty (using a technique inspired from tr1::is_empty, f.i.).
| Summarizing we would have 3 cases:
| 1- Empty base, safely exploit EBO.
| 2- Non-empty base, don't exploit EBO, therefore don't inherit.
| 3- Function, use a specialization for functions (already done).
|
| This way, in the largely common case we would still fix the problem at
| issue and, moreover we could also proceed to simplify the implementation
| of many other algorithms (as originally envisaged).
|
| Makes sense?
I understood nothing. Sorry.
-- Gaby