aCC+List

发表于:2007-06-08来源:作者:点击数: 标签:

采用List容器类,写的第二个STL演示程序.之后准备往其中填入自己的对象.

#include <iostream>
#include <string>
#include <list>
namespace std {} using namespace std;
int main()
{
  string *myword;
  myword=new string("List is:");
  cout<< myword->c_str()<<endl;
  delete myword;
  list<int> L;
  L.push_back(0);
  L.push_front(1);
  L.insert(++L.begin(), 2);
  copy(L.begin(), L.end(), ostream_iterator<int>(cout, " "));
  cout<<endl;
  return 0;
}

原文转自:http://www.ltesting.net