Can I initialize an STL vector with 10 of the same integer in an initializer list? My attempts so far have failed me.
Use the appropriate constructor, which takes a size and a default value.
int number_of_elements = 10;
int default_value = 1;
std::vector<int> vec(number_of_elements, default_value);