智能指針
// 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;
}

浙公网安备 33010602011771号