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   |
 |
mirek
Messages: 14267 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
|
|
|
Goto Forum:
Current Time: Wed Aug 27 18:00:29 CEST 2025
Total time taken to generate the page: 0.11332 seconds
|