privatevoid SetAtGrow ( int nIndex, CObject * newElement );
lançar ( CMemoryException );
Parâmetros
nIndex
Um índice inteiro que é maior que ou igual a 0.
newElement
O ponteiro de objeto a ser adicionado a essa matriz. Um valor NULL é permitido.
Observações
Define o elemento de matriz no índice especificado. A matriz aumenta automaticamente se necessário (isto é, o limite superior é ajustado para acomodar o novo elemento).
A tabela a seguir mostra Outro funções de membro que são semelhantes às CObArray::SetAtGrow.
| Classe | Função de membro |
| CByteArray | void SetAtGrow (i&nt nIndex, BYTE newElement ); nbsp;lançar ( CMemoryException ); |
| CDWordArray | void SetAtGrow (i&nt nIndex, DWORD newElement ); nbsp;lançar ( CMemoryException ); |
| CPtrArray | void SetAtGrow (i&nt nIndex, void * newElement ); nbsp;lançar ( CMemoryException ); |
| CStringArray | void SetAtGrow (i&nt nIndex, LPCTSTR newElement ); nbsp;lançar ( CMemoryException ); |
| CUIntArray | void SetAtGrow (int nIndex, UI&NT newElement ); nbsp;lançar ( CMemoryException ); |
| CWordArray | void SetAtGrow (i&nt nIndex, WORD newElement ); nbsp;lançar ( CMemoryException ); |
Exemplo
Consulte CObList:: CObList para obter uma listagem do CAge classe usada em tudo exemplos coleção.
/ / exemplo de CObArray::SetAtGrow
nbsp; CObArray matriz;
matriz.Adicionar (nova gaiola (21)); / / Elemento 0
matriz.Adicionar (nova gaiola (40)); / / Elemento 1
matriz.SetAtGrow (gaiola nova 3, (65)); / / Elemento 2 deliberadamente
/ / ignorados.
# ifdef Debug
afxDump.SetDepth (1);
afxDump << "SetAtGrow exemplo:" << & matriz << "\n";
# endif
Os resultados deste programa são os seguintes:
SetAtGrow exemplo: um CObArray com 4 elementos
nbsp; [0] = uma gaiola a 47 ° C 21 0
[1] = uma gaiola em US $4800 40
[2] = &NULL
[3] = uma gaiola em $4840 65
Visão geral de CObArray | Membros de classe | Gráfico de hierarquia
Co&nsulte tambémnbsp;CObArray::GetAt, CObArray:: SetAt, CObArray::ElementAt, CObArray::operator]