I was wondering how I can initialize a std::vector
of strings, without having to use a bunch of push_back
's in Visual Studio Ultimate 2012.
I've tried vector<string> test = {"hello", "world"}
, but that gave me the following error:
Error: initialization with '{...}' is not allowed for an object of type "std::vector<std::string, std::allocator<std::string>>
- Why do I receive the error?
- Any ideas on what I can do to store the strings?