1// Build don't link: 2// GROUPS passed old-abort 3// Should have been fixed by: 4// 5// Sun Jun 13 12:55:22 1993 Brendan Kehoe (brendan@lisa.cygnus.com) 6// 7// * cp-cvt.c (build_default_binary_type_conversion): Look deeper into 8// what ARG1 and ARG2 are if they're POINTER_TYPEs. 9 10class CountableSet 11{ 12 public: 13 virtual ~CountableSet() { } 14}; 15 16template<class T> 17class FixedSet : virtual public CountableSet 18{ 19 public: 20 virtual int Get(int, T&) = 0; 21 virtual ~FixedSet() { } 22}; 23 24class ShrinkableSet 25{ 26 public: 27 virtual int Remove(int) = 0; 28}; 29 30template<class T> 31class PVSet : virtual public FixedSet<T>, virtual public ShrinkableSet 32{ 33 public: 34 virtual void Append(const T&) = 0; 35 virtual void operator+=(const T& a) { Append(a); } 36 virtual ~PVSet() { } 37}; 38 39template<class T> 40class MutSet : virtual public FixedSet<T>, virtual public FixedSet<T *> 41{ 42 protected: 43 typedef T *Tp; 44 45 public: 46 void Append(const Tp& tp) { Append(*tp); } 47 48 T& Access(int p) 49 { 50 Tp tp; 51 Get(p, tp); 52 return *tp; 53 } 54 virtual ~MutSet() { } 55}; 56 57template <class T> 58class SimpleSet : virtual public MutSet<T> 59{ 60 protected: 61 T *array; 62 int size; 63 64 virtual void Allocate(int s) 65 { 66 array = new T[s]; 67 } 68 public: 69 SimpleSet() 70 { 71 size = 0; 72 array = 0; 73 } 74 int Get(int p, T& t) 75 { 76 t = array[p-1]; 77 return 1; 78 } 79 int Get(int p, T *& t) 80 { 81 t = &array[p-1]; 82 return 1; 83 } 84 inline void Append(const T& a) 85 { 86 array[size-1] = a; 87 } 88 inline int Remove(int n) { return 0; } 89}; 90 91class Dummy 92{ 93 public: 94 Dummy() {} 95}; 96 97int 98main() 99{ 100 SimpleSet<Dummy *> bs1; 101 int i, j; 102 Dummy foo; 103 104 bs1+=&foo;// ERROR - no .* 105} 106