#include <iostream>
class vec
{
public:
int arr[2];
};
int main()
{
vec a = { { 1,2 } };// works
vec b = { 1,2 };// works too ,but why ?
std::cin.get();
}
vec has no constructor other than the default constructor .
But this piece of code compiles ,I wonder why .
Aggregate initialization is amazing, you don't even have to get the nesting right to make it work, and you can also provide less values than there are members:
Live