
-----Original Message----- From: boost-users-bounces@lists.boost.org [mailto:boost-users-bounces@lists.boost.org] On Behalf Of mark cox Sent: Tuesday, November 28, 2006 2:37 PM To: boost-users@lists.boost.org Subject: Re: [Boost-users] Suggestion for boost`s smart pointers
wow, this seems like a great idea, a scoped_ptr with deleter would be v.useful. mark
I've been thinking something like (just something I hacked together just
now). Not sure if there is a nicer way.
#include <string>
#include <cstdio>
#include <iostream>
template<typename T>
struct DeletingDeleter
{
DeletingDeleter(T * p)
{
delete p;
std::cout << "DeletingDeleter" << std::endl;
}
};
struct FileCloser
{
FileCloser(FILE * f)
{
std::cout << "Closing file" << std::endl;
fclose(f);
}
};
template