* flower/include/array.hh (reverse, swap): Detach from class.
Update users.
* flower/include/std-vector.hh
* flower/include/array.hh (concat): Globally change to insert ().
* flower/include/std-vector.hh
* flower/include/parray.hh
* flower/include/array.hh (elem, elem_ref): Globally replace by
at ().
2006-02-02 Jan Nieuwenhuizen <janneke@gnu.org>
2006-02-02 Jan Nieuwenhuizen <janneke@gnu.org>
- * flower/include/std-vector.hh
+ * flower/string-convert.cc (convert::unsigned_string): Bugfix:
+ remove superfluous `d'.
+
+ * flower/include/std-vector.hh (boundary, top): Detach from class.
+ Remove empty vector shell.
+
* flower/include/array.hh (reverse, swap): Detach from class.
Update users.
* flower/include/array.hh (reverse, swap): Detach from class.
Update users.
arrcpy (array_, src.array_, size_);
}
arrcpy (array_, src.array_, size_);
}
- /// access last entry
- T &top (vsize j)
+ void unordered_del (vsize i)
- return (*this)[size_ - j - 1];
+ at (i) = back ();
+ resize (size () -1);
- /// return last entry
- T top (vsize j) const
+};
+
+ template<typename T>
+ T const &
+ back (Array<T> const &v, vsize i)
- return (*this)[size_ - j - 1];
+ return v[v.size () - i - 1];
- T &boundary (int dir, vsize idx)
+ template<typename T>
+ T&
+ back (Array<T> &v, vsize i)
- assert (dir);
- if (dir == 1)
- return top (idx);
- else
- return at (idx);
+ return v[v.size () - i - 1];
- T boundary (int dir, vsize idx) const
+
+ template<typename T>
+ T const &
+ boundary (Array<T> const &v, int dir, vsize i)
- if (dir == 1)
- return top (idx);
- else
- return at (idx);
+ return v[dir == 1 ? i : v.size () - 1 - i];
- void unordered_del (vsize i)
+ template<typename T>
+ T &
+ boundary (Array<T> &v, int dir, vsize i)
- at (i) = back ();
- resize (size () -1);
+ assert (dir);
+ return v[dir == 1 ? i : v.size () - 1 - i];
-#if 0
- template<class T>
- void
- swap (T *a, T *b)
- {
- T t = *a;
- *a = *b;
- *b = t;
- }
-#endif
-
template<class T>
void
reverse (Array<T> &v)
template<class T>
void
reverse (Array<T> &v)
Array<void *>::push_back (t);
}
Array<void *>::push_back (t);
}
- /// return last entry
- T *top (int j) const
- return (T *) Array<void *>::top (j);
+ return (*this)[size_ - j - 1];
+ T *& top (vsize j) const
- return (T *&) Array<void *>::top (i);
+ return (*this)[size_ - j - 1];
}
void substitute (T *old, T *new_p)
}
void substitute (T *old, T *new_p)
#define VPOS UINT_MAX
#endif
#define VPOS UINT_MAX
#endif
- /* Interface without pointer arithmetic (iterator) semantics. */
- class vector : public __vector<T>
+ T const &
+ boundary (vector<T> const &v, int dir, vsize i)
- public:
- typedef typename __vector<T>::iterator iterator;
- typedef typename __vector<T>::const_iterator const_iterator;
-
- vector<T> () : __vector<T> ()
- {
- }
-
- vector<T> (const_iterator b, const_iterator e) : __vector<T> (b, e)
- {
- }
-
- /* Flower-Array compatibility. */
- T const &
- boundary (int dir, vsize i) const
- {
- assert (dir);
- if (dir == 1)
- return this->top (i);
- else
- return this->at (i);
- }
+ assert (dir);
+ return v[dir == 1 ? i : v.size () - 1 - i];
+ }
- T &
- boundary (int dir, vsize i)
- {
- assert (dir);
- if (dir == 1)
- return this->top (i);
- else
- return this->at (i);
- }
+ template<typename T>
+ T &
+ boundary (vector<T> &v, int dir, vsize i)
+ {
+ assert (dir);
+ return v[dir == 1 ? i : v.size () - 1 - i];
+ }
- T const &
- top (vsize i) const
- {
- return (*this)[this->size () - i - 1];
- }
+ template<typename T>
+ T const &
+ back (vector<T> const &v, vsize i)
+ {
+ return v[v.size () - i - 1];
+ }
- T&
- top (vsize i)
- {
- return (*this)[this->size () - i - 1];
- }
- };
+ template<typename T>
+ T&
+ back (vector<T> &v, vsize i)
+ {
+ return v[v.size () - i - 1];
+ }
#if 0
template<typename T>
#if 0
template<typename T>
We only do relative comparisons. Absolute comparisons break down in
degenerate cases. */
while (degree () > 0
We only do relative comparisons. Absolute comparisons break down in
degenerate cases. */
while (degree () > 0
- && (fabs (coefs_.back ()) < FUDGE * fabs (coefs_.top (1))
+ && (fabs (coefs_.back ()) < FUDGE * fabs (back (coefs_, 1))
|| !coefs_.back ()))
coefs_.pop_back ();
}
|| !coefs_.back ()))
coefs_.pop_back ();
}
String_convert::unsigned_string (unsigned u)
{
char s[STRING_BUFFER_LEN];
String_convert::unsigned_string (unsigned u)
{
char s[STRING_BUFFER_LEN];
if (infos_.size () == 1)
return infos_[0].beams_i_drul_[d];
if (infos_.size () == 1)
return infos_[0].beams_i_drul_[d];
- Beaming_info thisbeam = infos_.boundary (d, 0);
- Beaming_info next = infos_.boundary (d, 1);
+ Beaming_info thisbeam = boundary (infos_, d, 0);
+ Beaming_info next = boundary (infos_, d, 1);
return min (thisbeam.beams_i_drul_[-d], next.beams_i_drul_[d]);
}
return min (thisbeam.beams_i_drul_[-d], next.beams_i_drul_[d]);
}
do
{
if (splits[d].infos_.size () != 1)
do
{
if (splits[d].infos_.size () != 1)
- splits[d].infos_.boundary (-d, 0).beams_i_drul_[-d] = middle_beams;
+ boundary (splits[d].infos_, -d, 0).beams_i_drul_[-d] = middle_beams;
}
while (flip (&d) != LEFT);
}
while (flip (&d) != LEFT);
Interval y;
if (boxes.size())
{
Interval y;
if (boxes.size())
{
- Box b = boxes.boundary (updowndir, 0);
+ Box b = boundary (boxes, updowndir, 0);
x = b[X_AXIS];
x[-d] = b[X_AXIS].linear_combination (-d / 2);
y[-updowndir] = b[Y_AXIS][updowndir];
x = b[X_AXIS];
x[-d] = b[X_AXIS].linear_combination (-d / 2);
y[-updowndir] = b[Y_AXIS][updowndir];
- if (ties.boundary (d, 0).dir_ == d)
+ if (boundary (ties, d, 0).dir_ == d)
{
Tie_configuration_variation var;
var.index_ = (d == DOWN) ? 0 : ties.size () - 1;
{
Tie_configuration_variation var;
var.index_ = (d == DOWN) ? 0 : ties.size () - 1;
- var.suggestion_ = get_configuration (ties.boundary (d, 0).position_ + d,
- d);
+ var.suggestion_ = get_configuration (boundary (ties, d, 0).position_
+ + d, d);
vars.push_back (var);
}
}
vars.push_back (var);
}
}