Using TSwizzle operators

Using the conversion to T* operator

In the following code fragment, the compiler invokes the T*() operator (because a pointer is required) for the TSwizzle<CClassB> object iB, before calling delete.

CClassABC::~CClassABC()
    {
    ...
    if (iB.IsPtr())
        delete iB;
    }

Using the indirection operator

In the following code fragment, the *() operator returns a reference to the CClassB object represented by the swizzle TSwizzle<CClassB> object, iB.

TStreamId CClassABC::StoreL()
    {
    ...
    outstream  << *iB;
    ...
    }

Using the indirect component selector

In the following code fragment, the operator -> gives access to the member iFixBuf of the CClassB object which is represented by the TSwizzle<CClassB> swizzle, iB.

void CClassABC::ConstructB(...,...,...,...)
    {
    iB->iFixBuf    = aData;
    ...
    }