Boost logo

Boost :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2001-12-21 14:58:02


From: "Ed Brey" <edbrey_at_[hidden]>
> From: "Peter Dimov" <pdimov_at_[hidden]>
>
> > On second thought, this actually makes sense to me. Scoped_ptr
requirements
> > will change slightly, in that it will require a complete type only when
its
> > constructor is instantiated.
> >
> > sizeof(scoped_ptr) will increase, but since scoped_ptr is noncopyable,
this
> > will not have much impact (it's not meant to be put in containers.)
>
> Not so fast. Containers don't directly contain scoped_ptrs, but they can
contain them indirectly (e.g. contain pointers to objects that house them).
It is not uncommon to have lots of a smallish, noncopyable class that would
use scoped_ptr. Even given heap overhead, increasing the size of scoped_ptr
can make a big difference in overall memory used.
<

Do you have a concrete example of a real-world project where increasing the
size of scoped_ptr from 4 to 8 makes a big difference?

--
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