Boost logo

Boost :

From: Beman Dawes (bdawes_at_[hidden])
Date: 2003-02-03 12:50:19


At 09:46 PM 2/2/2003, Howard Hinnant wrote:

>Could someone review the motivations for wanting an implicit conversion
>to T* ? I'm failing to come up with any myself.

It is useful when it is desirable for the smart pointer to mimic a built-in
pointer as closely as possible.

One case where that happens is when making extensive use of a third-party
library which passes a lot of arguments as raw pointers. Writing p.get() a
great deal tends to make code less readable.

Another case is when trying to toughen up legacy code by replacing a raw
pointer variable with a smart pointer. Changes are minimized if the smart
pointer mimics a raw pointer closely.

To me, a major benefit of a policy based design is to be able to
accommodate a wide range of features, including those which find only
limited use.

If a policy based smart pointer can't accommodate a wide range of features,
I start to wonder if the design itself is inflexible and flawed. That's why
I worry a lot about whether a given PBSP design can handle apparently
marginal uses.

--Beman

  


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