Boost logo

Boost :

From: Marshall Clow (marshall_at_[hidden])
Date: 2000-12-26 14:34:18

At 2:04 PM -0500 12/26/00, Daryle Walker wrote:
>I haven't looked at the 'scoped_ptr' stuff, but aren't these suggestions
>overkill? No other object ('tcpipbuf' is noncopyable) or subclass
>('tcpip_data_' is private) is supposed to look at the implementation. The
>'tcpipbuf' class could take care of the destruction itself.

There are two things that are going on here.

1) A pointer to an implementation class in the header.
--> This is, in general, a great idea, because the "pointer to implementation"
(hence the name 'pImpl') lets you associate a bunch of data and methods with
a 'tcpipbuf' object in a type-safe manner, and not expose any of that information
to the calling object. A 'void *' doesn't give you type-safety nor methods.

2) Using a scoped_ptr to the implementation object rather than a raw pointer.
--> This, to my mind is more of a "good idea" rather than a requirement. If I use
a scoped_ptr, the memory management is taken care of for me. If I use a raw
pointer, then I have to remember to de-allocate it myself. Code I don't have to
write has very few bugs.

-- Marshall
"The era of big government is over."
           Bill Clinton, State of the Union Address, January 23, 1996
Marshall Clow     MusicMatch   <mailto:mclow_at_[hidden]>

Boost list run by bdawes at, gregod at, cpdaniel at, john at