|
Boost : |
From: Ian Bruntlett (Ian.Bruntlett_at_[hidden])
Date: 2000-03-28 03:23:07
Hi,
I wanted to use a generic class to handle resources for me (was going to
call it auto_destruct but finally settled on auto_resource).
Although auto_ptr isn't perfect (what is?), I figured that supporting the
same interface would make it easier to use through familiarity with
auto_ptr.
I wasn't too sure how to get the destructor to do what I wanted - it would
be simple to pass in a function object. Which I didn't want to do.I suppose
I follow the Occam's Razor approach to OO - I prefer to avoid un-necessary
classes.
So I hit on the idea that auto_resource<> shouldn't implement its destructor
at all - the user implements the destructor.
I'd like to ask a few questions:
1. Has this been done already?
2. Is it feasable?
3. For a library implementor, is it sensible to implement auto_ptr<> in
terms of auto_resource<> ?
TIA
Ian Bruntlett
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk