I have played a lot the new Uniform Initialization with {}
. Like this:
vector<int> x = {1,2,3,4};
map<int,string> getMap() {
return { {1,"hello"}, {2,"you"} };
}
It is undisputed that this initialization may change we program C++. But I wonder if I missed some of the magic possibilities when reading Alfonses's question in the Herb Sutter FAQs.
Alfonse: Uniform initialization (the use of {} to call constructors when the type being constructed can be deduced) has the potential to radically reduce the quantity of typing necessary to create C++ types. It's the kind of thing, like lambdas, that will change how people write C++ code. [...]
Can someone give me an example of what Alfonse exactly envisions here?