|
Boost : |
From: Peter Dimov (pdimov_at_[hidden])
Date: 2001-09-03 09:10:31
From: "David Abrahams" <david.abrahams_at_[hidden]>
> From: "Peter Dimov" <pdimov_at_[hidden]>
> > Although my point was more along the lines that even given a
policy-based
> > smart pointer, your particular case would most probably still call for
an
> > old school, hand written implementation.
>
> I don't see why. Why do you say that?
It seems to me that you needed a type that
* is like shared_ptr, but with an intrusive count, i.e. has reference
semantics;
* is a dynamically-allocated array, i.e. has a constructor like
my_shared_array(int n);
* remembers this 'n', i.e. has a size() member.
This is something that is halfway between shared_array and vector. In a
situation like this I'd have created a shared_ptr<vector<T> >-based
prototype first. I assume that you didn't like the performance of the
prototype.
Perhaps I've misunderstood, but I think that a policy-based design would
likely allow you to specify interface and behavior, but not provide the
tools necessary to achieve the low-level customizations needed for this kind
of performance-tuning. I may be wrong.
-- Peter Dimov Multi Media Ltd.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk