C++14 provides the initialization list and we can use it to initialize elements in a class or struct. What are the differences of the two initialization manners in the following code?
struct MyItem {
MyItem() : val{0} {}
int val;
};
struct MyItem {
MyItem() {}
int val{0};
};