CHStringArray::operator [ ]
[The CHStringArray class is part of the WMI Provider Framework which is now considered in final state, and no further development, enhancements, or updates will be available for non-security related issues affecting these libraries. The MI APIs should be used for all new development.]
CHString& operator ( int nIndex ); CHString operator ( int nIndex ) const;
An integer index that is greater than or equal to zero and less than or equal to the value returned by GetUpperBound
The subscript operators return the CHString pointer element currently at this index.
You can use the first operator, which calls for arrays that are not const, on either the right (r-value) or the left (l-value) side of an assignment statement. The second, which calls for const arrays, can be used only on the right.
The debug version of the library asserts if the subscript (either on the left or right side of an assignment statement) is out of bounds.
The following code example shows the use of CHStringArray::operator .
CHStringArray array; CHString s; array.Add( L"String 1" ); // Element 0 array.Add( L"String 2" ); // Element 1 s = array; // Get element 0 assert( s == L"String 1" ); array = L"String 3"; // Replace element 0 assert( array == L"String 3" );
|Minimum supported client
|Minimum supported server
||Windows Server 2008