CObArray::InsertAt

โมฆะ InsertAt ( int nIndex, CObject * newElement, int nCount = 1 );
โยน ( CMemoryException );

โมฆะ InsertAt ( int nStartIndex, CObArray * pNewArray );
โยน ( CMemoryException );

พารามิเตอร์

nIndex

ดัชนีจำนวนเต็มที่อาจมากกว่าค่าส่งกลับโดยGetUpperBound?

newElement

ตัวชี้CObjectวางไว้ในแถวลำดับนี้ NewElementของค่าNULLได้รับอนุญาต?

nCount

จำนวนครั้งที่องค์ประกอบนี้ควรจะแทรก (ค่าเริ่มต้น 1)?

nStartIndex

ดัชนีจำนวนเต็มที่อาจมากกว่าค่าส่งกลับโดยGetUpperBound?

pNewArray

อาร์เรย์ที่อื่นที่ประกอบด้วยองค์ประกอบที่จะเพิ่มลงในอาร์เรย์นี้?

หมายเหตุ

รุ่นแรกของInsertAtแทรกองค์ประกอบหนึ่ง (หรือหลายสำเนาขององค์ประกอบ) ที่เป็นดัชนีที่ระบุในอาร์เรย์ ในกระบวนการ มันกะขึ้น (โดยการเพิ่มจำนวนตัวนับดัชนี) องค์ประกอบที่มีอยู่ในดัชนีนี้ และกะค่าองค์ประกอบทั้งหมดข้างต้นนั้น?

รุ่นที่สองแทรกองค์ประกอบทั้งหมดจากCObArrayอีกชุด เริ่มต้นที่ตำแหน่งnStartIndex?

ฟังก์ชันSetAtแทนที่องค์ประกอบหนึ่งของอาร์เรย์ที่ระบุ และเลื่อนองค์ประกอบใด ๆ ในทางตรงข้าม?

ตารางต่อไปนี้แสดงฟังก์ชันสมาชิกอื่น ๆ ที่คล้ายกับCObArray::InsertAt?

คลาส ฟังก์ชันของสมาชิก
CByteArray โมฆะ InsertAt (int nIndexไบต์newElement, int nCount=1);
nbspโยน ( CMemoryException );(&N)

โมฆะ InsertAt (int nStartIndex, CByteArray * pNewArray );
nbspโยน ( CMemoryException );(&N)

CDWordArray โมฆะ InsertAt (int nIndex, DWORD newElement, int nCount=1);
nbspโยน ( CMemoryException );(&N)

โมฆะ InsertAt (int nStartIndex, CDWordArray * pNewArray );
nbspโยน ( CMemoryException );(&N)

CPtrArray โมฆะ InsertAt (int nIndexโมฆะ * newElement, int nCount=1);
nbspโยน ( CMemoryException );(&N)

โมฆะ InsertAt (int nStartIndex, CPtrArray * pNewArray );
nbspโยน ( CMemoryException );(&N)

CStringArray โมฆะ InsertAt (int nIndex, LPCTSTR newElement, int nCount=1);
nbspโยน ( CMemoryException );(&N)

โมฆะ InsertAt (int nStartIndex, CStringArray * pNewArray );
nbspโยน ( CMemoryException );(&N)

CUIntArray โมฆะ InsertAt (int nIndex, UINT newElement, int nCount=1);
nbspโยน ( CMemoryException );(&N)

โมฆะ InsertAt (int nStartIndex, CUIntArray * pNewArray );
nbspโยน ( CMemoryException );(&N)

CWordArray โมฆะ InsertAt (int nIndex, WORD newElement, int nCount=1);
nbspโยน ( CMemoryException );(&N)

โมฆะ InsertAt (int nStartIndex, CWordArray * pNewArray );
nbspโยน ( CMemoryException );(&N)


ตัวอย่าง

ดูรายชื่อของCObList::CObList CAge ชั้นที่ใช้ในตัวอย่างของคอลเลกชันทั้งหมด?

/ / ตัวอย่าง CObArray::InsertAt

nbsp  อาร์เรย์ CObArray
    
    อาร์เรย์เพิ่ม (กรงใหม่ (21)); / / องค์ประกอบที่ 0
    อาร์เรย์เพิ่ม (กรงใหม่ (40)); / / องค์ประกอบที่ 1 (จะกลายเป็น 2)
    อาร์เรย์InsertAt (1 ใหม่กรง (30));  / / New องค์ประกอบที่ 1
#ifdef _DEBUG
    afxDump.SetDepth (1);
    afxDump << " InsertAt ตัวอย่าง: " << & อาร์เรย์ << "\n"
#endif

ผลลัพธ์ได้จากโปรแกรมนี้มีดังนี้:

ตัวอย่าง InsertAt: CObArray ที่ มีองค์ประกอบ 3
 nbsp  [0] =ในกรงที่ $ 45 C 8 21
    [1] ในกรงที่ $ 4646 = 30
    [2] =ในกรงที่ 4606 $ 40(&N)

ภาพรวม CObArray |nbsp สมาชิกของคลาส| แผนภูมิของลำดับชั้น(&N)

ดูเพิ่มเติมnbspCObArray::SetAt, CObArray::RemoveAt(&N)

Index