I am trying to iterate over all the elements of a static array of strings in the best possible way. I want to be able to declare it on one line and easily add/remove elements from it without having to keep track of the number. Sounds really simple, doesn't it?
Possible non-solutions:
vector<string> v;
v.push_back("abc");
b.push_back("xyz");
for(int i = 0; i < v.size(); i++)
cout << v[i] << endl;
There is no method to generate the vector on a single line with a list of strings.
Possible non-solution 2:
string list[] = {"abc", "xyz"};
Problems include the inability to obtain the number of strings automatically (that I know of).
There must be a simple method to accomplish this.