Initializing vector<string> with double curly braces
Can someone explain the difference in behavior between initializing with double and single curly braces in the example below? Code #1: vector<string> v = {"a", "b"}; string c(v[0] + v[1]); cout << "c = " << c; cout << "c.c_str() = " << c.c_str(); Output #1: c = ab c.c_str() = ab Code #2: vector<string> v = {{"a", "b"}}; string c(v[0] + v[1]); cout << "c = " << c; cout << "c.c_str() = " << c.c_str(); Output #2: c = a\acke�Z\ c.c_str() = a Implicit conversion central. That's what's going on. vector<string> v = {"a", "b"}; You initialize the vector by providing an initializer list with two