1 // PR tree-optimization/27548
3 // { dg-options "-O1" }
4 // { dg-additional-options "-Wno-return-type" }
8 template < class T > class Array
10 protected:int mindex, maxdex;
12 int InsertAt (const T & t, int n)
14 T *new_data = new T[++this->maxdex - this->mindex + 1] - this->mindex;
16 for (i = this->mindex; i <= n - 1; i++)
17 new_data[i] = this->data[i];
20 public: Array (unsigned int len = 0):mindex (1), maxdex (len),
21 data ((len) ? new T[len] -
28 delete[](data + mindex);
30 const T & operator[] (int index) const
33 int Append (const T & t)
35 return InsertAt (t, this->maxdex + 1);
42 private:Gambit::Array < int >MinIndices;
43 Gambit::Array < int >CurIndices;
44 gIndexOdometer (const Gambit::Array < int >, const Gambit::Array < int >);
45 void SetIndex (const int &, const int &);
46 int NoIndices () const;
47 gIndexOdometer AfterExcisionOf (int &) const;
50 gIndexOdometer::AfterExcisionOf (int &to_be_zapped) const
52 Gambit::Array < int >NewMins, NewMaxs;
54 for (i = 1; i <= NoIndices (); i++)
56 NewMins.Append (MinIndices[i]);
58 gIndexOdometer NewOdo (NewMins, NewMaxs);
59 for (i = 1; i < to_be_zapped; i++)
60 NewOdo.SetIndex (i, CurIndices[i]);