从vector看列表初始化

C++11新标准提供的,可以在数组中同时初始化多个对象

vector v1 = {"a","an","the"};
vector v2{"a","an","the"};

C++无法列表初始化时会尝试其他方式。这样感觉挺乱套的

vector v7 = {10};     //初始化10个默认初始化的元素
vector v2{10,"hi"};   //

你可能感兴趣的:(C++语言)