4 Jan
2007
4 Jan
'07
7:53 p.m.
CComPtr-like usage: boost::intrusive_ptr<IVideo> video; someObject->QueryInterface(IID_IVideo,(void**)&video);
Is there a better way? How do you bring intrusive_ptr and QueryInterface together?
[Nat] Sorry if this is naïve...
Wouldn't it work to do something like this?
IVideo* temp_video = NULL; someObject->QueryInterface(IID_IVideo, &temp_video); boost::intrusive_ptr<IVideo> video(temp_video);
As the construction of the intrusive_ptr increases the ref count you have
to call temp_video->Release(); afterwards. Anyway, in my opinion this obvious solution is too error-prone.