#include <boost/shared_ptr.hpp>
#include <vector>
#include <iostream>
using namespace boost;
using namespace std;

class Test
{
private:
	int a;
	int b;
public:
	void Show() 
	{
		cout << a << b << endl;
	}
	Test(int a1, int b1)
	{
		a = a1;
		b = b1;
	}
	~Test()
	{
		cout << a << b << "destroy \n";
	}
};	

typedef shared_ptr<Test> TestPtr;

int main()
{
	vector<TestPtr> con;

	TestPtr test1( new Test(1,2) );
	TestPtr test2( new Test(3,4) );
	TestPtr test3( new Test(5,6) );
	TestPtr test4( new Test(7,8) );

	con.push_back(test1);
	con.push_back(test2);
	con.push_back(test3);
	con.push_back(test4);
	
	for(int i = 0 ; i < con.size() ; ++i)
		con[i]->Show();

	return 0;
}
Retrieved from http://wiki.zeropage.org/wiki.php/TheWarOfGenesis2R/Temp
last modified 2021-02-07 05:28:13