This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: [Patch] Remove workaround for copy_backward
Paolo Carlini <pcarlini@unitus.it> writes:
[...]
| I see... As you did (and wrote!) in cpp_type_traits.h, right?
yes.
| I will work out the approach you suggest (thanks!) for both copy and
| copy_backward, right?
if you volunteer to do that, yes! :-)
| Anyway, if this is the way to go (by the way, are you deadly sure that
| our beloved compiler ;) is able to generate code equally efficient in
| the two cases?)
Basically, what is happening is that the last argument (either a
__true_type or a __false_type) which we know is a compile-time
constant is "shifted" into an explicit template argument for the class
dispatcher, so one uses less function arguments or registers.
There might be a small slowdown (I don't know if it is measurable)
when one uses partial ordering because the compiler needs to pass more
arguments -- and does even emit instructions to use 0 as value for the
empty objects!
So the apparantly "broken" way might be efficient both in terms of
compile-time and generated codes :-)
| I think we have to rethink some code in basic_string
| too...
oh heah, but I'm not risking myself in that mine field :-) :-)
-- Gaby