1 /* { dg-do compile } */
2 /* { dg-options "-O2 -Wno-return-type" } */
3 
4 namespace Gambit
5 {
6   template < class T > class Array
7   {
8   protected:int mindex, maxdex;
9     T *data;
InsertAt(const T & t,int n)10     int InsertAt (const T & t, int n)
11     {
12       T *new_data = new T[++this->maxdex - this->mindex + 1] - this->mindex;
13       int i;
14       for (i = this->mindex; i <= n - 1; i++)
15           new_data[i] = this->data[i];
16     }
17   public:   Array (unsigned int len = 0):mindex (1), maxdex (len),
18       data ((len) ? new T[len] -
19             1 : 0)
20     {
21     }
~Array()22     virtual ~ Array ()
23     {
24       if (maxdex >= mindex)
25         delete[](data + mindex);
26     }
27     const T & operator[] (int index) const
28     {
29     }
Append(const T & t)30     int Append (const T & t)
31     {
32       return InsertAt (t, this->maxdex + 1);
33     }
34   };
35 }
36 class gIndexOdometer
37 {
38 private:Gambit::Array < int >MinIndices;
39     Gambit::Array < int >CurIndices;
40     gIndexOdometer (const Gambit::Array < int >, const Gambit::Array < int >);
41   void SetIndex (const int &, const int &);
42   int NoIndices () const;
43   gIndexOdometer AfterExcisionOf (int &) const;
44 };
45 gIndexOdometer
AfterExcisionOf(int & to_be_zapped)46 gIndexOdometer::AfterExcisionOf (int &to_be_zapped) const
47 {
48   Gambit::Array < int >NewMins, NewMaxs;
49   int i;
50   for (i = 1; i <= NoIndices (); i++)
51     {
52       NewMins.Append (MinIndices[i]);
53     }
54   gIndexOdometer NewOdo (NewMins, NewMaxs);
55     NewOdo.SetIndex (i, CurIndices[i]);
56 }
57 
58