void SetAtGrow ( int nIndex, CObject * newElement );
gettare ( CMemoryException );
Parametri
nIndex
Un indice di integer che è maggiore o uguale a 0.
newElement
Il puntatore all'oggetto da aggiungere a questa matrice. Un valore NULL è consentito.
Osservazioni
Imposta l'elemento della matrice in corrispondenza dell'indice specificato. La matrice cresce automaticamente se necessario (cioè, il limite superiore è modificato per supportare il nuovo elemento).
La tabella seguente mostra altre funzioni membro che sono simili a CObArray::SetAtGrow.
| Classe | Funzione membro |
| CByteArray | public static void SetAtGrow (i&nt nIndex, BYTE newElement ); nbsp;gettare ( CMemoryException ); |
| CDWordArray | public static void SetAtGrow (i&nt nIndex, DWORD newElement ); nbsp;gettare ( CMemoryException ); |
| CPtrArray | public static void SetAtGrow (i&nt nIndex, void * newElement ); nbsp;gettare ( CMemoryException ); |
| CStringArray | public static void SetAtGrow (i&nt nIndex, LPCTSTR newElement ); nbsp;gettare ( CMemoryException ); |
| CUIntArray | public static void SetAtGrow (int nIndex, UI&NT newElement ); nbsp;gettare ( CMemoryException ); |
| CWordArray | public static void SetAtGrow (i&nt nIndex, WORD newElement ); nbsp;gettare ( CMemoryException ); |
Esempio
Vedere CObList::CObList per un elenco della CAge classe utilizzata in tutti gli esempi di raccolta.
/ / esempio per CObArray::SetAtGrow
nbsp; Matrice di CObArray;
matrice.Aggiungi (nuova gabbia (21)); / / Elemento 0
matrice.Aggiungi (nuova gabbia (40)); / / Elemento 1
matrice.SetAtGrow (3, nuova gabbia (65)); / / Elemento 2 deliberatamente
/ / ignorati.
ifdef debug
afxDump.SetDepth (1);
afxDump << "SetAtGrow esempio:" << & matrice << "\n";
# endif
I risultati di questo programma sono i seguenti:
Esempio SetAtGrow: un CObArray con 4 elementi
nbsp; [0] = una gabbia a $47 C 21 0
[1] = una gabbia di 4800 $ 40
[2] = &NULL
[3] = una gabbia di 4840 $ 65
Pa&noramica CObArray |nbsp; Membri della classe | Gerarchia Chart
Vedere a&nchenbsp;CObArray::GetAt, CObArray::SetAt, CObArray::ElementAt, CObArray::operator]