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 » U++ Library support » U++ Core » Using Vector::At doesn't initialize implicit types
Re: Using Vector::At doesn't initialize implicit types [message #17112 is a reply to message #17108] Tue, 29 July 2008 11:24 Go to previous messageGo to previous message
mirek is currently offline  mirek
Messages: 13984
Registered: November 2005
Ultimate Member
cbpporter wrote on Tue, 29 July 2008 05:10

Yes, using that At works if you want to initialize it there.

I was talking about the way user defined classes get their default constructor called, while implicit types get left initialized.
It should be more uniform.

And since user types do get their constructor called, I don't think there is any performance difference between what I'm proposing and the current situation.


Actually, this aspect of C++ is quite confusing. For any user type, creating a variable of that type without further params calls default constructor.

Not so for fundamentals. But you can "call default constructor" for them as well - which assigns zero to them.

Anyway, I think there is some small performance impact for At - assigning zero is not free. Usually, this would be negligible, but I can imagine several usages where it could have significant impact.

Mirek
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: zlib
Next Topic: Interesting struggle with "Moveable<T>" usage in GCC
Goto Forum:
  


Current Time: Wed Jun 12 22:29:46 CEST 2024

Total time taken to generate the page: 0.01168 seconds