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]

Re: Implementing clean and simple move symantics


Joe Buck wrote:
> [ memmove better than swap for many types ]

On Wed, Nov 24, 2004 at 11:01:12AM +0000, Chris Jefferson wrote:
> Hmm.. I'll have to think about this a bit. In actual fact, I think all 
> of the standard containers look like they can be moved by memmove, and 
> (quick test program), that is faster even for things like sorting 
> vectors of vectors and such things. However using memmove involves being 
> quite careful if its being used for things like sorting, and I suspect 
> it would be very hard to avoid code duplication (which is what I was 
> trying to do before). It might simply be unavoidable, in which case 
> we'll have to live with it :)

If we specialize for memmove'able types, then clearly we have separate
code for those types that are not memmove'able.  swap has the advantage
that it works for everything.  But since swap is 3x worse in many
situations, I think the price in added complexity is worth paying.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]