Boost logo

Boost :

From: Gennadiy Rozental (rogeeff_at_[hidden])
Date: 2002-05-01 02:33:36

"Phil Nash" <phil.nash.lists_at_[hidden]> wrote in message


> Although these may not be the best examples, don't you think that even
> would be less obviously smart resources if they were all declared as
> smart_ptr? Especially the Print function. All you get coming in is a
> smart_ptr and a smart_resource. If you just had a smart_ptr called file
> coming in wouldn't you wonder if it was a pointer to a file class
> (especially if the resource type wasn't as obviously resourcy named as
> "HANDLE")?

To make names smooth for your eye I would use typedefs (templated typedefs).
It not only resolve confusion with smart_ptr, make the name domain specific,
but also could resolve confusion with smart_resource name. Foe unaware user
smart_resource could be as confusing as smart_ptr: what means smart, how
smart, will it be smart enough to handle multiple access correctly?While
definition like this make it all disappear in the user code:

typedef boost::smart_resource<HANDLE, file_open_policy, file_close_policy>

CFile dt( "myfile.dat");

For me smart_ptr is a well established idiom used to describe one class
wrapping another class for the purpose of managing its ownership and access
right. I do not see why arbitrary resource management does not fit this

> [)o
> IhIL..



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