Boost logo

Boost :

From: David Abrahams (dave_at_[hidden])
Date: 2003-08-26 12:48:51

"Peter Dimov" <pdimov_at_[hidden]> writes:

> E. Gladyshev wrote:
>> --- Gregory Colvin <gregory.colvin_at_[hidden]> wrote:
>>> For shared_ptr the count is allocated by the following line in the
>>> shared_count
>>> constructor:
>>> new sp_counted_base_impl<P, D>(p, d);
>>> So it might be possible to make the allocation customizable by
>>> specializing
>>> sp_counted_base_impl.
>> I think it would be great.
>> However there is another problem.
>> You have to new your object.
>> shared_ptr<MyClass> s( new MyClass );
> You can allocate your object however you want:
> shared_ptr<MyClass> s(MyClass::allocate(), MyClass::deallocate);
> and of course there is also the textbook way of defining a suitable
> MyClass::operator new.

That leaves out the question of count allocation.

Dave Abrahams
Boost Consulting

Boost list run by bdawes at, gregod at, cpdaniel at, john at