Boost logo

Boost :

From: Beman Dawes (bdawes_at_[hidden])
Date: 2002-01-13 11:39:48


At 05:00 AM 1/13/2002, Andrei Alexandrescu wrote:

>> This would not be a major issue for a rarely used function, but I have
>> found that I tend to make extensive use of 'boost::shared_ptr::get'.
>
>I'm not trying to make criticisms based on so little information here,
but
>I guess a good design would not need to have access to the underlying raw
>pointer managed by a smart pointer. I guess operator-> should be heavily
>used.

That's truest for new designs. But when interfacing with legacy functions
(which often take raw pointer arguments), shared_ptr::get() is used much
more often.

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.

--Beman

   


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