std list 的使用


#include <iostream>
using namespace std;
#include <list>  //stl list是一双向链表,可高效地进行插入删除元素
#include <string>
int main () 
{
  list<string> cc;
  list<string>::iterator pointCC; //iterator迭代器
  cc.push_back("Chocolate");
  cc.push_back("Strawberry");
  cc.push_front("Lime");
  cc.push_front("Vanilla");
  cout << cc.size() << endl;
  for(pointCC=cc.begin();pointCC!=cc.end();++pointCC) 
  {
    cout << *pointCC << endl; //遍历list元素
  }     

  return 0;
}


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM