To do this I have this function:
map<string,string> split_line_into_fields(const string& line);
Am I using the transform algorithm incorrectly?
list<map<string,string> > m_msg;
transform(msg.begin(), msg.end(), m_msg.begin(), split_line_into_fields);
map<string,string> m = *m_msg.begin();
for (map<string,string>::iterator it = m.begin(); it != m.end(); ++it) {
cout << "K = ''" << (*it).first << "''" << endl
<< "V = ''" << (*it).second << "''" << endl
<< endl;
}
If I handle the loop manually I have no problems:
list<map<string,string> > m_msg;
for (list<string>::iterator it = msg.begin(); it != msg.end(); ++it) {
m_msg.push_back(split_line_into_fields(*it));
}
map<string,string> m = *m_msg.begin();
for (map<string,string>::iterator it = m.begin(); it != m.end(); ++it) {
cout << "K = ''" << (*it).first << "''" << endl
<< "V = ''" << (*it).second << "''" << endl
<< endl;
}
(Note: I'm still in early development faze, so don't get all worried I'm just outputting a single element)
This post has been edited by code_m: 05 December 2012 - 07:12 AM

New Topic/Question
Reply



MultiQuote






|