This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
Paolo Carlini wrote:Connected to this, I've been investigating a number of the algorithms where it can be much more efficent to implement them purely in terms of swap rather than assignments (reverse, sort, and others) for those classes where a swap is MUCH cheaper than an assignment (lists and vectors come to mind). However a swap is twice as expensive as an assignment for scalar classes, and could in theory be 3 times as expensive for a big class which didn't implement a swap (although I'm tempted to ignore these).
Can you spot anything wrong with this kind of change? If we agree that it's good, there are quite a few places to tweak, both in stl_algo and in stl_algobase (besides locale_facets ;)
*But*, now I remember std::fill and std::fill_n: in order to avoid expensive
copies when _ValueType is "big", we should probably use temporary vars
(like __value) *only* when __is_scalar<_ValueType>::_M_type is true...
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |