I believe it worked when I defined the structure in the same header file as my class but outside the function definition. In other words, as peter suggested, define the structure in my .h file.
I think it worked because the compiler doesn't give any errors.
it doesn't work.
Can you see anything wrong with this function definition? Am I parsing a string date correctly by using the DateParser::parseISO(vec[4]) ? vec[4] is a string as you can see below but in my struct Rows, it expects a Date.
map<int,test_load::Rows> test_load::Load_Ports_Struct()
{
string data ("testfile.csv");
string line;
ifstream Ports(data.c_str());
typedef tokenizer <escaped_list_separator <char> > Tokenizer;
vector<string>vec;
int key;
//the actual data structure
map<int,test_load::Rows> Options; //////////////
while (getline(Ports,line))
{
Tokenizer tok(line);
vec.assign(tok.begin(),tok.end());
key=atoi(vec[0].c_str()); //tradeid in every row is the key
Rows each_option ={
vec[1],vec[2], vec[3], QuantLib::DateParser::parseISO(vec[4]), vec[5],atof(vec[6].c_str()),atof(vec[7].c_str()),vec[8],atof(vec[9].c_str()),
atof(vec[10].c_str()),atof(vec[11].c_str()),atof(vec[12].c_str()), QuantLib::DateParser::parseISO(vec[13])
};
//put the sample data into the map
Options[key]=each_option;
}
cout << Options[6003].Notional <<endl;
Ports.close();
return Options;