Hi I am a newbie in C++ and I just cannot initialize a vector using {}, even if the code is copied with a book. For example, when I do these
vector
uniform initialization
is introduced since C++11, You should use a recent compiler that supports this new feature.
If your compiler does not support this feature, you may try the following:
string arrOfString[3] = {"a", "an", "the"};
vector<string> articles(arrOfString, arrOfString +3);
EDIT:
with MSVC11, you can do (by courtesy of @chris):
string arrOfString[3] = {"a", "an", "the"};
vector<string> articles(std::begin(arrOfString), std::end(arrOfString));