Пример #1
0
  explicit AllocatedArray(const AllocatedArray &other)
    :the_size(other.size()), data(new T[the_size]) {
    assert(size() == 0 || data != NULL);
    assert(other.size() == 0 || other.data != NULL);

    std::copy(other.data, other.data + the_size, data);
  }
Пример #2
0
  explicit AllocatedArray(const AllocatedArray &other)
    :buffer{new T[other.buffer.size], other.buffer.size} {
    assert(size() == 0 || buffer.data != nullptr);
    assert(other.size() == 0 || other.buffer.data != nullptr);

    std::copy_n(other.buffer.data, buffer.size, buffer.data);
  }
Пример #3
0
  /**
   * Adds the point only if it a few pixels distant from the previous
   * one.  Useful to reduce the complexity of small figures.
   */
   void AddPointIfDistant(RasterPoint pt) {
    assert(num_points < points.size());

    if (num_points == 0 || manhattan_distance(points[num_points - 1], pt) >= 8)
      AddPoint(pt);
  }
Пример #4
0
  void AddPoint(RasterPoint pt) {
    assert(num_points < points.size());

    points[num_points++] = pt;
  }