Microsoft Foundation Classes (mfc.hlp) (Table of Contents; Topic list)
Important Notice
The pages on this site contain documentation for very old MS-DOS software, purely for historical purposes. If you're looking for up-to-date documentation, particularly for programming, you should not rely on the information found here, as it will be woefully out of date.
CPtrArray
◄CObject►                                     ◄Up► ◄Contents► ◄Index► ◄Back►
──Microsoft Foundation Classes──────────────────────────────────────────────
 
  Description
 
  The CPtrArray class supports arrays of void pointers.
 
  The member functions of CPtrArray are similar to the member functions of
  class ◄CObArray► Because of this similarity, you can use the CObArray
  reference documentation for member function specifics. Wherever you see
  a CObject pointer as a function parameter or return value, substitute a
  pointer to void.
 
  CObject* CObArray::GetAt( int <nIndex> ) const;
 
  for example, translates to
 
  void* CPtrArray::GetAt( int <nIndex> ) const;
 
  CPtrArray incorporates the IMPLEMENT_DYNAMIC macro to support run-time
  type access and dumping to a CDumpContext object. If you need a dump of
  individual pointer array elements, you must set the depth of the dump
  context to 1 or greater.
 
  Pointer arrays may <not> be serialized.
 
  When a pointer array is deleted, or when its elements are removed, only
  the pointers are removed, not the entities they reference.
 
  #include <afxcoll.h>
 
  Public Members
 
  Construction/Destruction
 
  ◄CPtrArray►   Constructs an empty array for void pointers.
 
  ◄~CPtrArray►   Destroys a CPtrArray object.
 
  Bounds
 
  ◄GetSize►         Gets number of elements in this array.
 
  ◄GetUpperBound►   Returns the largest valid index.
 
  ◄SetSize►         Sets the number of elements to be contained in this
                    array.
 
  Operations
 
  ◄FreeExtra►   Frees all unused memory above the current upper bound.
 
  ◄RemoveAll►   Removes all the elements from this array.
 
  Element Access
 
  ◄GetAt►       Returns the value at a given index.
 
  ◄SetAt►       Sets the value for a given index; array not allowed to
                grow.
 
  ◄ElementAt►   Returns a temporary reference to the element pointer
                within the array.
 
  Growing the Array
 
  ◄SetAtGrow►   Sets the value for a given index, growing the array if
                necessary.
 
  ◄Add►         Adds an element to the end of the array; grows the array
                if necessary.
 
  Insertion/Removal
 
  ◄InsertAt►   Inserts an element (or all the elements in another array)
               at a specified index.
 
  ◄RemoveAt►   Removes an element at a specific index.
 
  Operators
 
  ◄operator []►   Sets or gets the element at the specified index.
 
 
                                     -♦-