#include <iostream>
#include <loki/SmartPtr.h>
using namespace std;
using namespace Loki;
class Hoth
{
public:
Hoth() : name_("noname") {}
Hoth(const std::string& name) : name_(name) {}
~Hoth() { cout << name_ << " destroyed" << endl; }
Hoth* Clone() {return new Hoth(name_ + " (copy)");}
private:
string name_;
};
typedef SmartPtr <Hoth> HothPtr;
typedef SmartPtr <Hoth, DeepCopy> HothPtrDC;
typedef SmartPtr <
Hoth, RefCounted, DisallowConversion, AssertCheck, ArrayStorage
> HothArrayPtr;
int main()
{
HothPtr h1 = new Hoth("dynamic");
HothArrayPtr h2 = new Hoth[2];
HothPtrDC h3 = new Hoth("deep copy");
HothPtrDC h4 = h3;
return 0;
}