O'Reilly logo

ATL Internals: Working with ATL 8, Second Edition by Chris Sells, Brent Rector, Kirk Fertitta, Christopher Tavares

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 3. ATL Smart Types

VARIANTs, SAFEARRAYs, and Interface Pointers

COM has a number of data types beyond the numeric types available in the C and C++ languages. Three such data types are the VARIANT data type, interface pointers, and the SAFEARRAY data type. ATL provides useful classes that encapsulate each of these data types and their special idiosyncrasies.

The CComVariant class is a smart VARIANT class. The class implements the special initialization, copy, and destruction semantics of the COM VARIANT data type. CComVariant instances can be used in most, but not all, of the places you would use a VARIANT.

The CComPtr, CComQIPtr, and CComGITPtr classes are smart pointer classes. Smart pointer classes are definitions of objects that “act” ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required