
14 Feb
2003
14 Feb
'03
12:50 p.m.
bjorn.karlsson@readsoft.com wrote:
HANDLE hPrinter=0; OpenPrinter(_T("Some printer"),&hPrinter,0); if (boost::shared_ptr<void> p(hPrinter,&ClosePrinter)) {
}
While this works, it doesn't convey the intent of the code (nor preserve it): the resource should typically not be shared, only scoped, and I believe that scoped_ptr
would be a perfect fit.
A zero-overhead scoped_ptr