Someone recently demonstrated a C++ horribleness (here):
cout << string(50, 'x'); // xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
cout << string{50, 'x'}; // 2x
std::string sees the second line as an initialiser list.
I'm very fond of using {} initialiser syntax, however I'm about to implement a class that could be initialised with an initialiser list.
Is there any way to code the following syntax:
Foo{x}; // initialise a Foo object with x
Foo{{x,y,z}}; // initialise a Foo object with initialiser list
Foo{{x}}; // initialise a Foo object with initialiser list with ONE item