|
Boost : |
From: Darin Adler (darin_at_[hidden])
Date: 2001-03-23 12:30:50
on 3/23/01 7:13 AM, Bill Klein at bill_at_[hidden] wrote:
> I have a class that has member of type scoped_array<> to handle some
> memory I allocate... The crux of the situation is that I'd like to
> implement a non-throwing swap() for my class (for other reasons), and
> to do this, the scoped_array<> would need a swap(). shared_array is
> overkill in this situation, but of course I can roll my own that
> does what I need... Just thought this might be a common desire,
> although I do understand the drive to keep it as simple as possible.
You might be able to get scoped_array to work for this case, but it's not
likely. The scoped_xxx classes work well enough for use in local variables,
but they're unlikely to be good enough to work well for class members.
The normal solution for what you describe would to to use a vector instead
of a scoped_array. Is there a good reason you can't do that instead?
-- Darin
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk