Boost logo

Boost Users :

From: Philipp Henkel (threadpool_at_[hidden])
Date: 2007-01-17 07:08:15


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 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