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

  1. #ifndef __RWTSTACK_H__
  2. #define __RWTSTACK_H__
  3. pragma push_align_members(64);
  4.  
  5. /*
  6.  * Parameterized stack of T's, implemented using class C.
  7.  *
  8.  * $Header:   E:/vcs/rw/tstack.h_v   1.2   15 Mar 1992 12:47:32   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.  * WARNING: This class is very slow when used with singly-linked lists
  22.  *          because they use an inefficient implementation for removeLast().
  23.  *
  24.  ***************************************************************************
  25.  *
  26.  * $Log:   E:/vcs/rw/tstack.h_v  $
  27.  * 
  28.  *    Rev 1.2   15 Mar 1992 12:47:32   KEFFER
  29.  * 
  30.  *    Rev 1.0   02 Mar 1992 16:10:52   KEFFER
  31.  * Initial revision.
  32.  */
  33.  
  34. //$DECLARE_TEMPLATE
  35.  
  36. #ifndef __RWDEFS_H__
  37. #  include "rw/defs.h"
  38. #endif
  39.  
  40. template <class T, class C> class RWExport RWTStack : private C {
  41.  
  42. public:
  43.  
  44.   RWTStack() { }
  45.  
  46.   C::clear;
  47.   C::entries;
  48.   C::isEmpty;
  49.   void        push(T a)    {C::append(a);}
  50.   T        pop()        {return C::removeLast();}
  51.   T        top() const    {return C::last();}
  52. };
  53.  
  54. pragma pop_align_members();
  55. #endif    /* __RWTSTACK_H__ */
  56.