1. 程式人生 > >STL list為雙向迴圈連結串列

STL list為雙向迴圈連結串列

示例證明:

#include<iostream>
#include<list>
using namespace std;
typedef list<int> li;
typedef li::iterator it;
int main()
{
    li one;
    one.push_back(1);
    one.push_back(2);
    one.push_back(3);
    int i=6;
    for(it last=one.begin();;++last)
 {
        printf("%d\n",*last);
        --i;
        if(!i)break;
    }
    return 0;
}