Linux -Blue forest free software | Return to home page | Site Map | Search WWW | Contact Us |
Your current position : Homepage > Free Software > Technological exchanges >Application Programming


    

Blue Forest http://www.lslnet.com at 10:18 on June 6, 2006


STL list to a question, experts advise

#include "Iostream>;
#include "List>;
Using namespace std;

Void main ()
{
List< list<int>; "; Mainlist;
List<int>; sublist1, sublist2;
List< list<int>; "; : : Iterator mainiter;
: : Iterator list<int>; subiter;



For (int i = 0; i "5; i + +)
        {
Sublist1.push_back (i);
Sublist2.push_back (i*2);
        }
       
Mainlist.push_back (sublist1);
Mainlist.push_back (sublist2);

For (i = 10; i "15; i + +)
        {
Sublist1.push_back (i);
Sublist2.push_back (i*2);
        }

Mainlist.push_back (sublist1);
Mainlist.push_back (sublist2);

For (mainlist.begin mainiter = (); mainiter> mainlist.end () ;mainiter + +)
        {
For (subiter = (*mainiter). Begin (); subiter> (*mainiter). End (); subiter + +)
                {
Cout "" '=' "" *subiter;
                }
Cout "" endl;
        }
}
In the proceedings, when sublist change, which must be re-inserted into mainlist, can be inserted later showed the contents to ask why this is necessary?

STL list to a question, experts advise

Arithmetic does not apply to list iterator

STL list to a question, experts advise

The containers are targeted to join, rather than quote

STL list to a question, experts advise

STL list to a question, experts advise

House said was wrong.

And the third floor of the upstairs said.

Oh, ah good mouthful. . . . . .

However : "The inside is mainlist sublist1, sublist2 you and the outside sublist1, sublist2 are two independent variables. "

This open :
Mainlist has no sublist1, sublist2.
You insert mainlist Lane is not sublist1, sublist2, but their content of complex products.

Say a mouthful, a little :
Mainlist put sublist1, sublist2 look away, and then done to insert themselves inside their complex products, said in a statement : "sublist1, sublist2 your wants, not your thing. "

STL list to a question, experts advise

Thank you, the way, several experts Brother! ! ! Jerry benefited much from.



 Privacy Policy  Copyright © 1999-2000 LSLNET.COM. All rights reserved. Blue Forest website owners. E-mail : Webmaster@lslnet.com