Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » Community » Coffee corner » C++11
Re: C++11 [message #38183 is a reply to message #38182] Tue, 04 December 2012 08:08 Go to previous messageGo to previous message
mirek is currently offline  mirek
Messages: 14267
Registered: November 2005
Ultimate Member
Lance wrote on Mon, 03 December 2012 18:55

Thanks Mirek. I got it.

So U++'s Vector would still outperform std::vector significantly for classes have move constructor and move assignment defined?


Well, it depends on many factors, but generally yes.

The difference is that when expanding std::vector, the code still has to iterate through all elements and move them (albeit using &&). Vector simply performs memcpy on raw data.

Now it is possible that the std::vector iteration could in the end be optimized by compiler to something like memcpy, as long as compiler sees the inlined move contructor, in that case the performace should be similar. But in the end, Vector always does memcpy Smile

Mirek
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: live session Prague 8.3.2013
Next Topic: Have Visual Studio? Looking for prebuilt SDL 2.0
Goto Forum:
  


Current Time: Thu Aug 14 19:42:04 CEST 2025

Total time taken to generate the page: 0.11747 seconds