"Adi Shavit" <adish@gentech.co.il> wrote in message news:4575C6FD.9060408@gentech.co.il...I see that ref_ptr doesn't have a set() method.
How can I implement the code I posted before:
// Create a source filter specified by filenameAm I missing something??
interface_ptr<IBaseFilter> pSource; // The interface_ptr<> object
{
IBaseFilter* ppSource= NULL; // temporary bare pointer
if(FAILED(pGraph->AddSourceFilter(a2w(c_str_ptr(filename)),0,&ppSource)))
{
//...
return 0;
}
pSource.set(ppSource, false); // setting the smart pointer.
}
Adi
Adi Shavit wrote:I wasn't even aware of ref_ptr.
I'll try it and let you know how it goes.
Adi
Matthew wrote:Adi comstl::interface_ptr<> is obsolete. It offers nothing that stlsoft::ref_ptr<> does not; it actually offers less. I don't know why this component has continued to be available. I've just grepped all my sources and can find only a single use of it (which I've just changed). My apologies for having left it in there. The preferred approach is to use stlsoft::ref_ptr<>. Why? Because it facilitates forward declaration of a smart pointer specialisation. (I'm working on a small article to explain how/why, which I hope to publish - perhaps on CodeProject - soonish.) I'm changing comstl/smartptr/interface_ptr.hpp as we speak to issue a warning if included, and will redefine the class to be implemented in terms of stlsoft::ref_ptr<>. Sorry about that ... :$ Matthew And now to the next question ...