双方向リスト

#include < iostream >
#include < list >
using namespace std;

int main()
{
    list lst;
    list revlst;
    int i;
    
    for(i=0; i< 10; i++) lst.push_back('A'+i);
    
    cout << "lst size = " << lst.size() << endl;
    cout << "size: ";
    
    list< char >::iterator p;
    
    while(!lst.empty()){
        p = lst.begin();
        cout << *p;
        lst.pop_front();
        revlst.push_front(*p);
    }
    
    cout << endl << endl;
    
    cout << "revlst size = ";
    cout << revlst.size() << endl;
    cout << "content: ";
    p = revlst.begin();
    while(p != revlst.end()){
        cout << *p;
        p++;
    }
    
    return 0;
}