Bonjour, j'aurais une autre question sur l'utilisation des list :
je dispose de cela :
Code :
- typedef struct UpStruct
- {
- char * u_lrcTn;
- char * u_latitude;
- char * u_longitude;
- char * u_course;
- char * u_speed;
- } UpStruct ;
- typedef list <UpStruct> UpList;
|
Code :
- int main(int argc, char* argv[])
- {
- UpList UpListA;
- MasterList MasterListA;
- UpStruct My_UpStruct;
- MasterStruct My_MasterStruct;
- UpList::iterator i;
- MasterList::iterator j;
-
- //
- My_UpStruct.u_lrcTn = "0001";
- My_UpStruct.u_course = "123";
- My_UpStruct.u_speed = "100";
- My_UpStruct.u_latitude = "43:10:45 N";
- My_UpStruct.u_longitude = "01:14:21 E";
- UpListA.push_back(My_UpStruct);
- My_UpStruct.u_lrcTn = "0002";
- My_UpStruct.u_course = "223";
- My_UpStruct.u_speed = "200";
- My_UpStruct.u_latitude = "22:10:45 N";
- My_UpStruct.u_longitude = "22:14:21 E";
- UpListA.push_back(My_UpStruct);
- for (i = UpListA.begin(); i != UpListA.end(); ++i){
- cout << i->u_lrcTn << " ";
- cout << endl;
- }
-
- cout << endl;
- My_MasterStruct.p_lrcTn = "001";
- My_MasterStruct.MyList = UpListA;
- MasterListA.push_back(UpListA);
- for (j = MasterListA.begin(); j != MasterListA.end(); ++j){ .................. }
|
je voudrais dans le "for" afficher le contenu de la liste "MasterListA" mais comment accéder au contenu de "MyList"?
alors la question est :
Comment accéder au élément d'une list de list?