"Adi Shavit" <adish@gentech.co.il> wrote in message news:eturnn$6cq$1@digitalmars.com...Indeed, it does!
Can you explain what the difference is between each of the versions, and why this (confusing) redundancy exists?
Here they are for reference:
//...Thanks,
stlsoft::ref_ptr<IGraphBuilder> pGraph;
stlsoft::ref_ptr<IMediaControl> pMediaControl;
//...
1. pMediaControl.set(interface_cast_addref<IMediaControl*>(pGraph.get()), false); // this is OK
2. pMediaControl.set(interface_cast_addref<IMediaControl*>(pGraph), false); // this blows up.
3. pMediaControl = interface_cast<IMediaControl>(pGraph); // this is OK
Adi
Matthew Wilson wrote:As far as I can remember, the adjustment to interface_cast_addref<> to take ref_ptr<X> arguments has _not_ been done, so the code as you've written it will not work.However, the following (cleaner, nicer, more transparent) version should://...
stlsoft::ref_ptr<IGraphBuilder> pGraph;
stlsoft::ref_ptr<IMediaControl> pMediaControl;
//...
if(SUCCEEDED(co_create_instance(CLSID_FilterGraph, pGraph)))
{
pMediaControl = interface_cast<IMediaControl>(pGraph);
//...:-)Matt