STL容器之forward_list

#include 
#include 			//前向链表(单链表)
#include 
#include 
using namespace std;

void PrintList(forward_list<int> &list)
{
	for (forward_list<int>::iterator it = list.begin(); it != list.end(); it++)
	{
		cout << *it << " ";
	}
	cout << endl;
}
void test01()
{
	forward_list<int> list;	
	//提供头插/尾删
	list.push_front(3);
	list.push_front(23);
	list.push_front(543);
	list.push_front(35);
	PrintList(list);
}


int main()
{
	test01();

	return 0;
}

你可能感兴趣的:(C++,c++,开发语言)