You can do that with std::vector
constructor:
vector(size_type count,
const T& value,
const Allocator& alloc = Allocator());
Which takes count
and value
to be repeated.
If you want to use initializer lists you can write:
const int x = 5;
std::vector vec {x, x, x, x, x, x, x, x, x, x};