/
9-6.H
32 lines (29 loc) · 901 Bytes
/
9-6.H
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
/* Copyright (c) 1992 by AT&T Bell Laboratories. */
/* Advanced C++ Programming Styles and Idioms */
/* James O. Coplien */
/* All rights reserved. */
#include "k.h"
#include "collection.h"
// Store items of class T, indexed by values of class S
template<class T, class S>
class CollectionRep: public Thing {
public:
virtual Collection<T, S> make();
virtual Thing* cutover(Thing *);
virtual T& operator[](int);
virtual T& operator[](S);
virtual void put(const T&);
CollectionRep() { }
~CollectionRep() { }
Thing *type();
protected:
friend class Collection<T, S>;
static void *operator new(size_t l) {
return ::operator new(l);
}
static void operator delete(void *p) {
::operator delete(p);
}
private:
CollectionRep<T, S> *exemplarPointer;
};