Reputation: 8001
Default initialization in C++11?
I am not sure which style should I use:
T o;
T o{};
Is there difference?
Upvotes: 2
Views: 159
Reputation: 47418
T o;
performs default initialization (in particular, it leaves non-class members uninitialized)
T o{};
performs value initialization (in particular, it zeroes out non-class members)
Upvotes: 7