|
Boost Users : |
From: Nat Goodspeed (ngoodspeed_at_[hidden])
Date: 2007-01-04 13:27:00
________________________________________
From: boost-users-bounces_at_[hidden] [mailto:boost-users-bounces_at_[hidden]] On Behalf Of Philipp Henkel
Sent: Thursday, January 04, 2007 12:34 PM
To: boost-users_at_[hidden]
Subject: [Boost-users] COM and boost::intrusive_ptr
1. I need to access the address of the raw pointer (to use QueryInterface). Therefore I
implemented operator& for intrusive_ptr. Like in COM this pointer-pointer will only
be used for intialization purposes. My implementation relies on the intrusive_ptr's
memory layout and returns reinterpret_cast<T**>(addressof(ptr)). I know, this is evil...
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);
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net