From: Gregory Colvin (gregory.colvin_at_[hidden])
Date: 2003-08-28 18:33:19
On Thursday, Aug 28, 2003, at 16:26 America/Denver, E. Gladyshev wrote:
> --- Gregory Colvin <gregory.colvin_at_[hidden]> wrote:
>>> How will I even know it, the documentation is completely
>>> ignorant on the memory issues.
>> Perhaps because you work with the authors of the documentation to
>> make it sure it says what needs saying?
> Are the documentation authors monitoring this mailing list?
>> And I have no objection myself to adding an allocator parameter
>> to the shared_ptr constructor, or to making some other change that
>> serves the purpose. So if you need a change, why not just do it,
>> try it out, and submit a patch?
> How about
> template< typename T, typename Counter = int >
> typedef Counter counter; //counter type should be public
> template <typename DataAlloc = std::allocator<T>, typename
> shared_ptr( const DataAlloc& da = DataAlloc(), const IntAlloc ia& =
> CountAlloc() );
shared_ptr doesn't allocate the data, it only deletes it, which is the
job of the
current deleter parameter. And the counter type is by design not part
shared_ptr type, so it doesn't belong as parameter to the shared_ptr
So you what you might want is to add something more like this to
template<typename Data, typename Deleter, template<class Counter>
Deleter> >& );
The idea being that you can use this constructor to get complete
control over how
a particular shared_ptr manages memory.
Boost list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk