Board index » cppbuilder » Smart Pointers in BCB?

Smart Pointers in BCB?

is there a BCB equivalent to VC smart pointers?

 

Re:Smart Pointers in BCB?


Quote
"Michael Archambault" <michael.archamba...@thermobio.com> wrote in message

news:3AD1D68D.2175E9AB@thermobio.com...

Quote

> is there a BCB equivalent to VC smart pointers?

I know there is a STL equivalent called auto_ptr,
but it seems to have the reputation to be tricky.

Re:Smart Pointers in BCB?


Quote
"Michael Archambault" <michael.archamba...@thermobio.com> wrote in message

news:3AD1D68D.2175E9AB@thermobio.com...

Quote

> is there a BCB equivalent to VC smart pointers?

1- You can access the VC smart pointer just as VC does. BCB support the VC
smart pointer.

#include<atlbase.h>

    CComPtr<IMyInterface> IMyInterfacePtr;

2- The BCB equivalent is TComInterface

When you import an IDL file in BCB you'll get something like that

interface DECLSPEC_UUID("{FB3D5887-86EE-4F99-8E9C-B061DA8A250F}")
IMyInterface;
typedef TComInterface<IMyInterface, &IID_IMyInterface> IMyInterfacePtr;

IMyInterfacePtr is the BCB smart pointer.

Hope this helps,

Francois Belair

Other Threads