There is no need to initialize the vector in this way
vector<pair<string,string>> myVec();
This is a function declaration called myVec , which has no parameters and has a return type vector<pair<string,string>>
Just write
vector<pair<string,string>> myVec;
because in any case you are creating an empty vector.
Or, if you want the vector to have some initial values, and your compiler supports C ++ 2011, then you can also write
std::vector<std::pair<std::string, std::string>> myVec = { { "first", "first" }, { "second", "second" }, { "third", "third" } };
source share