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;
}
Alte URL:
/snippet/verwendung-von-boostsharedptr/794
und wozu ist das gut 😉 weiß ich natürlich, aber für anfänger.