0

I am starting to learn C++ here so pardon me if I am asking noob questions. My problem is that I cannot initialize my vector of pair of strings.

#include <assert.h>
#include <iostream>
#include <string>
#include <vector>

typedef std::vector<std::pair<std::string, std::string> > pair_of_strings;
 
int main()
{
pair_of_strings test1{
        {"hello", "world"},
        {"captain", "america"}};

return 0;
}

I am getting the following errors:

C:\Documents and Settings\support\Test.cpp(15) : error C2601: 'test1' : local function definitions are illegal
C:\Documents and Settings\support\Test.cpp(15) : error C2063: 'test1' : not a function
Toribio
  • 3,963
  • 3
  • 34
  • 48
Aryah T
  • 23
  • 2
  • 6

0 Answers0