Boost logo

Boost :

From: Gary Powell (Gary.Powell_at_[hidden])
Date: 2001-04-10 15:46:43

> Just my .02, but I believe the auto_ptr_base class hurts more than it
> helps. It doesn't save on code bloat. It doesn't reduce code
> duplication. It does increase complexity both for the human reader, and
> for the compiler. And it increases the required inline depth on the
> compiler. I'm fond of this technique when it saves on code bloat or
> code duplication, but I'm not seeing that here (please educate me if I'm
> wrong).
> -Howard
From Greg's original post

> When I needed such a class, I created auto_array_ptr from auto_ptr (cut &
> paste) and changed delete to delete [].
> Inelegant? yes.
> Quick & painless? yes.
> Did it work? yes.
> Would I rather see a version with a parameterized deleter function? Yes.

I just tried that, but discovered in testing that it would incorrectly
convert from Derived[] to Base[].


So parameterization on the deleter function is not enough for a correct
auto_array_ptr. What it seems to take is to remove the templatization of
the constructor, assignment, and auto_ptr_ref members.
So I hadn't tried to remove it. (I thought that Greg meant he needed the
void * to make this base/derived bit work correctly.)

I don't have any kind of lock on this sort of design so feel free to modify
the code and repost it. (Or email me directly with suggestions, I'll try
them and repost them.) I'm just trying to "boost" it, and shepherd it along
and when the doc gets done submit it.



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