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: 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
|
|
|
Goto Forum:
Current Time: Wed Jun 12 22:29:46 CEST 2024
Total time taken to generate the page: 0.01168 seconds
|