#include #include #include class X { public: X() { printf ("X constructured\n"); } ~X() { printf ("X destructed\n"); } }; struct destroy_x_in_mmgr { void operator() (X* x, void* arg) { x->~X(); ::operator delete (x, (QSE::Mmgr*)arg); } }; int main () { QSE::HeapMmgr heap_mmgr (30000, QSE::Mmgr::getDFL()); { QSE::ScopedPtr x1 (new X); } printf ("----------------------------\n"); { QSE::ScopedPtr > x3 (new X[10]); } printf ("----------------------------\n"); { //QSE::ScopedPtr x2 (new(&heap_mmgr) X, destroy_x); QSE::ScopedPtr x2 (new(&heap_mmgr) X, &heap_mmgr); } printf ("----------------------------\n"); { QSE::ScopedPtr > x4 (new(&heap_mmgr) X, &heap_mmgr); } printf ("----------------------------\n"); return 0; }