Feedback

Verwendung von boost::shared_ptr

Sprache: C++

Zeigt die Verwendung von boost::shared_ptr
#include <iostream>
#include <boost/shared_ptr.hpp>
using namespace std;

class Foo
{
public:
	Foo()
	{
		cout<<"foo ctor"<<endl;
	}

	virtual ~Foo()
	{
		cout<<"foo dtor"<<endl;
	}
};

int main(int argc, char *argv[]) 
{	
	{
		boost::shared_ptr<Foo> t(new Foo());
	}

	system("pause");
	return 0;
}
#include <iostream>
#include <boost/shared_ptr.hpp>
using namespace std;

class Foo
{
public:
	Foo()
	{
		cout<<"foo ctor"<<endl;
	}

	virtual ~Foo()
	{
		cout<<"foo dtor"<<endl;
	}
};

int main(int argc, char *argv[]) 
{	
	{
		boost::shared_ptr<Foo> t(new Foo());
	}

	system("pause");
	return 0;
}

1 Kommentar