Consider this code:
class Foo
{
public:
Foo(){cout<<"empty"<<endl;}
Foo(initializer_list<int>){cout<<"init_list"<<endl;}
};
int main()
{
Foo(); // empty
Foo{}; // empty
Foo({}); // init_list for c++14, empty for c++17
}
I am wondering why they behave differently between C++14 and C++17, and how to construct a Foo
with an empty initializer_list
in C++17?