1 // PR tree-optimization/27548
3 // { dg-options "-O1" }
7 template < class T > class Array
9 protected:int mindex, maxdex;
11 int InsertAt (const T & t, int n)
13 T *new_data = new T[++this->maxdex - this->mindex + 1] - this->mindex;
15 for (i = this->mindex; i <= n - 1; i++)
16 new_data[i] = this->data[i];
19 public: Array (unsigned int len = 0):mindex (1), maxdex (len),
20 data ((len) ? new T[len] -
27 delete[](data + mindex);
29 const T & operator[] (int index) const
32 int Append (const T & t)
34 return InsertAt (t, this->maxdex + 1);
41 private:Gambit::Array < int >MinIndices;
42 Gambit::Array < int >CurIndices;
43 gIndexOdometer (const Gambit::Array < int >, const Gambit::Array < int >);
44 void SetIndex (const int &, const int &);
45 int NoIndices () const;
46 gIndexOdometer AfterExcisionOf (int &) const;
49 gIndexOdometer::AfterExcisionOf (int &to_be_zapped) const
51 Gambit::Array < int >NewMins, NewMaxs;
53 for (i = 1; i <= NoIndices (); i++)
55 NewMins.Append (MinIndices[i]);
57 gIndexOdometer NewOdo (NewMins, NewMaxs);
58 for (i = 1; i < to_be_zapped; i++)
59 NewOdo.SetIndex (i, CurIndices[i]);