zoukankan      html  css  js  c++  java
  • list-size

    ////////////////////////////////////////
    //      2018/04/27 7:22:00
    //      list-size
    
    #include <iostream>
    #include <list>
    #include <algorithm>
    #include <iterator>
    
    using namespace std;
    
    int main(){
        list<int> l(5, 0);
        copy(l.begin(), l.end(), ostream_iterator<int>(cout," "));
        cout << endl;
    
        cout << "Size of list = " << l.size() << endl;
    
        int size = l.size();
    
        for (int i = 0; i < size; i++){
            l.pop_front();
            cout << "Size of list = " << l.size() << endl;
        }
    
        return 0;
    }
    
    /*
    OUTPUT:
        0 0 0 0 0
        Size of list = 5
        Size of list = 4
        Size of list = 3
        Size of list = 2
        Size of list = 1
        Size of list = 0
    */
  • 相关阅读:
    HiperLink
    三次贝塞尔曲线平滑多边形
    SimpleIni
    Segment
    SegIntersect
    OneTif
    OneSeg
    MiniDump
    MfcStrFile
    vmware workstation 如何配置NAT
  • 原文地址:https://www.cnblogs.com/laohaozi/p/12537935.html
Copyright © 2011-2022 走看看