|
Boost : |
From: Noel Yap (Noel.Yap_at_[hidden])
Date: 2003-04-15 07:30:43
This has probably been asked many times, but here it goes: Why doesn't
boost have a dumb_ptr<> to replace the "left-over" use of free pointers
(eg no ownership semantics, copyable, ...)?
For example, if I wanted to transfer ownership, I'd do something like:
extern std::auto_ptr< C > createC();
OTOH, there's a lot of legacy code that has:
extern C* createC();
Which means if I wanted to write a function that doesn't pass ownership,
its ownership semantics is ambiguous:
extern C* blah(); // should pointer be free'd by caller?
If, instead, I could do:
extern dumb_ptr< C > blah();
the intent is clearer.
Thanks,
Noel
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk