2 // GROUPS passed templates
10 Vector (int s) : sz (s) { v = new T[sz]; }
11 ~Vector () { delete[] v; }
12 T &operator[] (int i) { return v[i]; }
13 int size () { return sz; }
16 template<class T>// ERROR - previous definition of T
19 typedef T T;// ERROR - use of template type T in typedef to T
20 static int lessthan (T &a, T &b) { return a < b; }
26 static void sort (Vector<Comp::T> &);// ERROR - use of bad T
30 void Sort<Comp>::sort (Vector<Comp::T> &v)// ERROR - use of bad T
34 for (int i = 0; i < n - 1; i++)
35 for (int j = n - 1; i < j; j--)
36 if (Comp::lessthan (v[j], v[j - 1]))
38 typename Comp::T temp = v[j];
47 Sort<Comparator<int> >::sort (vi);