Dylan wrote:
what is the best way of initializing a static std::vector data member
with some values?
By static, you mean static member? You can initialize it with an array.
#include <vector>
#include <iostream>
struct Foo
{
static std::vector<int> vec;
private:
static const int array[];
};
const int Foo::array[] = { 1, 10, 100, 1000, 10000, 42 };
std::vector<int> Foo::vec(array, array + sizeof(array)/sizeof(*array));
int main()
{
std::cout << Foo::vec.back() << '\n';
}
If your vector is also constant, you might just as well use the array
directly instead.