home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / IDIOMS.ZIP / 9-7.H < prev    next >
C/C++ Source or Header  |  1991-12-04  |  858b  |  28 lines

  1. /* Copyright (c) 1992 by AT&T Bell Laboratories. */
  2. /* Advanced C++ Programming Styles and Idioms */
  3. /* James O. Coplien */
  4. /* All rights reserved. */
  5.  
  6. #include "k.h"
  7.  
  8. template<class T, class S> class CollectionRep;
  9.  
  10. template<class T, class S>
  11.     class Collection: public Top {
  12.     public:
  13.         CollectionRep<T, S> *operator->() const { return rep; }
  14.         Collection();
  15.         Collection(CollectionRep<T, S>&);
  16.         ~Collection();
  17.         Collection(Collection<T, S>&);
  18.         Collection& operator=(Collection<T, S>&);
  19.         T& operator[](int i) { return (*rep)[i]; }
  20.         T& operator[](S s) { return (*rep)[s]; }
  21.     private:
  22.         static void *operator new(size_t) { return 0; }
  23.         static void operator delete(void *p) {
  24.            ::operator delete(p);
  25.         }
  26.         CollectionRep<T, S> *rep;
  27.     };
  28.