码迷,mamicode.com
首页 > 其他好文 > 详细

(六)STL序列容器(list)

时间:2020-11-17 13:02:23      阅读:27      评论:0      收藏:0      [点我收藏+]

标签:sys   nbsp   back   stream   for   ios   pause   push   print   

list: 底层实现为双向链表

 

1、基本用法

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

// list:双向链表
void ShowPrint(list<int> d)
{
    for (list<int>::iterator it = d.begin(); it != d.end(); ++it) {
        cout << *it << endl;
    }
}
int main()
{
    list<int>val;
    val.push_back(1);
    val.push_back(9);
    val.push_back(5);

    val.sort();
    ShowPrint(val);
    system("pause");
    return 0;
}

  

(六)STL序列容器(list)

标签:sys   nbsp   back   stream   for   ios   pause   push   print   

原文地址:https://www.cnblogs.com/oytt/p/13962491.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!