Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

CComSafeArray::Add

 

Adds one or more elements, or a SAFEARRAY structure, to a CComSafeArray.


      HRESULT Add(
   const SAFEARRAY * psaSrc 
);
HRESULT Add(
   ULONG ulCount,
   const T * pT,
   BOOL bCopy = TRUE
);
HRESULT Add(
   const T& t,
   BOOL bCopy = TRUE
);

psaSrc

A pointer to a SAFEARRAY object.

ulCount

The number of objects to add to the array.

pT

A pointer to one or more objects to be added to the array.

t

A reference to the object to be added to the array.

bCopy

Indicates whether a copy of the data should be created. The default value is TRUE.

Returns S_OK on success, or an error HRESULT on failure.

The new objects are appended to the end of the existing SAFEARRAY object. Adding an object to a multidimensional SAFEARRAY object is not supported. When adding an existing array of objects, both arrays must contain elements of the same type.

The bCopy flag is taken into account when elements of type BSTR or VARIANT are added to an array. The default value of TRUE ensures that a new copy is made of the data when the element is added to the array.

Requirements

Header: atlsafe.h

Show: