Re: Smart Pointers and Microsoft Foundation Classes
On Tue, 19 Feb 2008 11:42:47 -0500, Joseph M. Newcomer
<newcomer@flounder.com> wrote:
"Joseph M. Newcomer" <newcomer@flounder.com> ha scritto nel messaggio
news:o65lr31ims8isd5klmg68vfov39cberave@4ax.com...
Smart pointers do not maintain reference counts, as
far as I can tell
If the boost library is being used, SURELY the OP would have said "In using
boost::shared_ptr..."
joe
I think Giovanni's point was that "smart pointer" is a pretty generic term.
For example, I named the smart pointer classes I wrote 10 years ago due to
dissatisfaction with std::auto_ptr "nc_ptr" and "rc_ptr", where "nc" means
"Non-Copyable" and "rc" means "Reference-Counted". It's really
std::auto_ptr that is the oddball here; its weird (though very occasionally
useful) copy semantics are sort of an unsatisfactory compromise between NC
and RC, which happens sometimes when a standards group invents something.
Concerning the OP's post, I kind of gave up when he said he was using smart
pointers "to guard against the issues of multithreaded processes". That
didn't make any sense to me. Also, when he said, "I do not know if my
pointer is unique and owns the object or whether it's a shared pointer to
the pointee object or whether it's a copy on write type of object", the
answer to that is, if he needs to know those things, he should use a smart
pointer class that supports them. The Boost library offers several types of
smart pointers with different capabilities that may help that aspect of his
problem.
--
Doug Harrison
Visual C++ MVP