智能指針

// test03.cpp : 定义控制台应用程序的入口点。
//

#include "stdafx.h"
#include <iostream>
#include <vector>
#include <iterator>
#include <memory>

using namespace std;

class Foo {

public:
	void print()
	{
		cout << "hello" << endl;
	}

};

int main()
{

	vector<vector<string>> v;
	vector <string> v2;
	v2.push_back("111");
	v2.push_back("222");
	v2.push_back("333");
	v.push_back(v2);


	std::shared_ptr<Foo> foo(new Foo);
	foo->print();

	std::cout << "foo pointer:" << foo.get() << endl;


	int i;
	std::cin >> i;

	return 0;
}

  

posted @ 2017-04-22 09:13  微笑的''80  阅读(85)  评论(0)    收藏  举报