Share via


CComSafeArray::SetAt

 

Sets the value of an element in a single-dimensional array.

Syntax

      HRESULT SetAt(
   LONG lIndex,
   const T& t,
   BOOL bCopy = TRUE
);

Parameters

  • lIndex
    The index number of the array element to set.

  • t
    The new value of the specified element.

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

Return Value

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

Remarks

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

See Also

CComSafeArray Class
CComSafeArray::GetAt
CComSafeArray::MultiDimSetAt