|
Boost : |
From: Gary Powell (Gary.Powell_at_[hidden])
Date: 2000-12-20 11:01:56
> I think the scoped_ptr class should have a release() function, similar
> to the one in std::auto_ptr. This would help in cases like the following
>
>
Seems reasonable to me. (I have to code in a C/C++ environment where
returning a C pointer is required by the called API.)
Would a better example be:
void foo(std::list<data *> &myList, int x)
{
shared_ptr<data> theData(new data(x) );
myList.push_back(theData.get() );
theData.release();
}
(I know it could be improved by having a list of shared_ptrs, but sometimes
that change isn't possible due to who controls the code. Third party
software etc. )
-gary-
gary.powell_at_[hidden]
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk