c++ - how to access map of vectors? -
c++ - how to access map of vectors? -
i have created map of vectors , populated follows. here code. not able post original code. contains vectors of doubles
map <int, vector <double> > maptest; (int = 0 ; < id1; i++) { (int j = 0 ; j < id2; j++) { maptest[i].push_back(j*0.01); } } map <int, vector <double> >::iterator maptestitr; cstring teststring; ( j = 0 ; j < id2; j++) { (i = 0 ; < id1; i++) { maptestitr = maptest.find(i); if (maptestitr != maptest.end()) { teststring.format(_t("%f",maptestitr->second.at(j))); } myfile << teststring<< ',' ; } } but values updated '0' (teststring '0'). in ide, values correctly shown in watch.
what missing here?
std::vector::at() expects integer parameter. specifically, size_t.
i don't know type id2 is, code gave doesn't appear size_t.
c++ stl mfc map vector
Comments
Post a Comment