Boost logo

Boost :

From: Beman Dawes (bdawes_at_[hidden])
Date: 2002-01-14 13:25:42


At 10:19 AM 1/14/2002, Iain.Hanson_at_[hidden] wrote:

>>The extreme case occurs when there are so many calls to legacy functions

>>taking raw pointers that use of shared_ptr::get() makes the code
>>unreadable. That's when the ability to enable implicit conversion may
be
>>worthwhile, even though dangerous.
>
>Personally, I got so badly burnt with implicit pointer conversions in the

>early 90's that I'd rather write wrapper functions to the legacy code
than
>use implicit pointer conversions - no matter how much work it was.

The wonderful thing about Andrei's policy based design is that you get to
disallow implicit conversions (that's the default, so you don't have to do
anything) while someone else who wants them can enable them. Yet because
it is done at compile time, there is no runtime cost.

And unlike the boost::xxx_ptr approach, the policy differences aren't based
on macros. Much easier and safer to use; no problem of inadvertently
turning conversion on in one smart pointer because it was needed in
another.

--Beman


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