home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c221 / 6.ddi / MWHC.006 / X0 < prev    next >
Encoding:
Text File  |  1992-06-07  |  1.6 KB  |  66 lines

  1. #ifndef __RWTPVECTOR_H__
  2. #define __RWTPVECTOR_H__
  3. pragma push_align_members(64);
  4.  
  5. /*
  6.  * RWTPtrVector: Parameterized vector of pointers to T
  7.  *
  8.  * $Header:   E:/vcs/rw/tpvector.h_v   1.0   19 Mar 1992 10:33:10   KEFFER  $
  9.  *
  10.  ****************************************************************************
  11.  *
  12.  * Rogue Wave Software, Inc.
  13.  * P.O. Box 2328
  14.  * Corvallis, OR 97339
  15.  *
  16.  * Copyright (C) 1992. This software is subject to copyright 
  17.  * protection under the laws of the United States and other countries.
  18.  *
  19.  ***************************************************************************
  20.  *
  21.  * Stores a *pointer* to the item in the vector.
  22.  *
  23.  ***************************************************************************
  24.  *
  25.  * $Log:   E:/vcs/rw/tpvector.h_v  $
  26.  * 
  27.  *    Rev 1.0   19 Mar 1992 10:33:10   KEFFER
  28.  * Initial revision.
  29.  */
  30.  
  31. //$DECLARE_TEMPLATE
  32.  
  33. #include "rw/tvvector.h"
  34.  
  35. template<class T> class RWTPtrVector : private RWTValVector<T*> {
  36.  
  37.   typedef RWTValVector<T*>    BASE;
  38.  
  39. public:
  40.  
  41.   RWTPtrVector() { }
  42.   RWTPtrVector(unsigned n) : RWTValVector<T*>(n)    { }
  43.   RWTPtrVector(unsigned n, T* ival) : RWTValVector<T*>(n, ival) { }
  44.  
  45.   RWTPtrVector&        operator=(const RWTPtrVector& v) { BASE::operator=(v); return *this; }
  46.  
  47.   BASE::data;
  48.   BASE::length;
  49.   BASE::reshape;
  50.   void            resize(unsigned N);
  51.   BASE::operator();
  52.   BASE::operator[];
  53. };
  54.  
  55. template <class T> void
  56. RWTPtrVector<T>::resize(unsigned N)
  57. {
  58.   unsigned oldN=length();
  59.   reshape(N);
  60.   for (int i=oldN; i<N; i++)
  61.     (*this)(i) = rwnil;
  62. }
  63.       
  64. pragma pop_align_members();
  65. #endif /* __RWTPVECTOR_H__ */
  66.