home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / IDIOMS.ZIP / 9-6.H < prev    next >
C/C++ Source or Header  |  1991-12-04  |  933b  |  33 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. #include "collection.h"
  8.  
  9. // Store items of class T, indexed by values of class S
  10.  
  11. template<class T, class S>
  12.     class CollectionRep: public Thing {
  13.     public:
  14.         virtual Collection<T, S> make();
  15.         virtual Thing* cutover(Thing *);
  16.         virtual T& operator[](int);
  17.         virtual T& operator[](S);
  18.         virtual void put(const T&);
  19.         CollectionRep() { }
  20.         ~CollectionRep() { }
  21.         Thing *type();
  22.     protected:
  23.         friend class Collection<T, S>;
  24.         static void *operator new(size_t l) {
  25.             return ::operator new(l);
  26.         }
  27.         static void operator delete(void *p) {
  28.             ::operator delete(p);
  29.         }
  30.     private:
  31.         CollectionRep<T, S> *exemplarPointer;
  32.     };
  33.