Boost logo

Boost :

From: Gernot Neppert (gn_at_[hidden])
Date: 2000-09-04 09:12:14


I've been using a reference-counted pointer class extensively in my
c++ programs, and I'd like to switch completely to boost::shared_ptr.
But there's one thing that puts me off: The constructor that accepts
a raw pointer is declared "explicit".
When you're passing around pointers as shared_ptr parameters, it's
just unnerving always having to provide the explicit ctor-call.
I couldn't come up with a compelling reason why this should be
necessary. When there's a function that expects a shared_ptr<Type>,
why not provide it simply a "new Type()"?
Am I overlooking any ambiguities or unexpected behavour that could
result from removing the "explicit" from shared_ptr's ctor?
Or is it plainly considered heresy to deviate from Standard
Library's "auto_ptr" pattern ;-)


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk