[RFA] Algorithms vs operator* and operator==
Paolo Carlini
pcarlini@suse.de
Sat Nov 6 22:29:00 GMT 2004
chris jefferson wrote:
> Therefore, similarily I have 3 options..
>
> 1) Make the int, float, etc. case efficent
> 2) Make the vector, list, etc case efficent
> 3) Use somethiing like _is_scalar (and perhaps others.. is_pod comes
> to mind) to try to decide when to make the choice
>
> Any opinions? :)
I would suggest 3) :)
By the way, this is a preliminary list of algorithms taking
input_iterators, first candidates for the optimization that I presented
at the outset:
replace_copy
replace_copy_if
remove_copy
remove_copy_if
unique_copy
partial_sort_copy
merge
includes
set_*
find_first_of
lexicographical_compare (+, unrelated, specialization for wchar_t?)
Some are "more" candidates than others, either because are very simple -
sparing operator* calls can make for a big difference - or because don't
have already sets of overloaded helpers (-> the total number of
templates would grow very large affecting badly /compile time/
performance! We never discussed this issue in detail, by the way...)
Paolo.
More information about the Libstdc++
mailing list