Mar 30, 2013 at 5:42am
I am trying to assign a list of values to a vector:
vector<string> words;
words[] = {"one", "two", "three"};
This does not work. How can I accomplish it?
Mar 30, 2013 at 5:47am
If you have C++11:
vector<string> words = {"one", "two", "three"};
Should work.
Otherwise you'll have to push them all in yourself or use a proxy array.
Mar 30, 2013 at 5:50am
I need to assign the values after the declaration.
words = {"one", "two", "three"};
does not work.
Mar 30, 2013 at 1:11pm
(use some high-level programming language which supports what humans need to express algorithms. Sorry ;-))