This is the mail archive of the
mailing list for the GCC project.
Re: [patch] : Improve std::search on v7
- From: Paolo Carlini <pcarlini at suse dot de>
- To: Gabriel Dos Reis <gdr at integrable-solutions dot net>
- Cc: chris jefferson <caj at cs dot york dot ac dot uk>,libstdc++ <libstdc++ at gcc dot gnu dot org>, gcc-patches at gcc dot gnu dot org
- Date: Sun, 19 Jun 2005 13:06:28 +0200
- Subject: Re: [patch] : Improve std::search on v7
- References: <42B53A83.email@example.com> <firstname.lastname@example.org>
Gabriel Dos Reis wrote:
>chris jefferson <email@example.com> 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
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).