May be you should take a look at Loki Library http://loki-lib.sourceforge.net initiated by A. Alexandrescu (Author of "Modern C++ Design"). There is a policy based smart pointer implementation and a policy to handle COM pointers. I just came across it some few weeks ago. With Kind Regards, Ovanes Markarian On Wed, January 17, 2007 13:08, Philipp Henkel wrote:
Hi,
On 1/8/07, Trent Nelson wrote:
Philipp Henkel wrote:
I would like to discuss some code I'm using to manage COM objects with intrusive_ptr.
Out of interest, what's your motivation for using intrusive_ptr over the smart pointer facilities (via #import of your COM DLL/EXE) provided by Visual Studio?
Internally the CComPtr often casts its raw pointer to IUnknown. That's no problem as long as you are using the CComPtr with COM interface classes only. Unfortunately I need a smart pointer for my implementation classes, too. Casts to IUnknown are ambiguous if the class implements two or more COM interfaces (dreaded diamond inheritance hierarchy) and therefore I thought about using another smart pointer. Additionally I'm not big fan of COM and that's why I prefer a lightweight reference counting solution like intrusive_ptr to handle my COM stuff.
You'd lose the benefits of
things like IntelliSense completion for COM types if you wrolled your own wrapper, I would think.
That's not a problem. I'm using another code completion tool for VS. :-)
Best regards, Philipp _______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users