-MathArray::~MathArray()
-{
- for (int pos = 0; pos < size(); next(pos))
- if (isInset(pos))
- delete nextInset(pos);
-}
-
-
-MathArray::MathArray(MathArray const & array)
- : bf_(array.bf_)
-{
- for (int pos = 0; pos < size(); next(pos))
- if (isInset(pos))
- replace(pos, nextInset(pos)->clone());
-}
-
-MathArray::MathArray(MathArray const & array, int from, int to)
- : bf_(array.bf_.begin() + from, array.bf_.begin() + to)
-{
- for (int pos = 0; pos < size(); next(pos))
- if (isInset(pos))
- replace(pos, nextInset(pos)->clone());
-}
-
-
-bool MathArray::next(int & pos) const
-{
- if (pos >= size() - 1)
- return false;
-
- pos += item_size(pos);
- return true;
-}
-
-
-bool MathArray::prev(int & pos) const
-{
- if (pos == 0)
- return false;
-
- pos -= item_size(pos - 1);
- return true;
-}
-
-
-bool MathArray::last(int & pos) const
-{
- pos = bf_.size();
- return prev(pos);
-}
-
-
-int MathArray::item_size(int pos) const
-{
- return 2 + (isInset(pos) ? sizeof(MathInset*) : 1);
-}
+MathArray::MathArray(MathArray const & array, size_type from, size_type to)
+ : bf_(array.begin() + from, array.begin() + to)
+{}