Return MultiPoint::first_point() by reference.

This commit is contained in:
bubnikv 2019-09-27 19:47:30 +02:00
parent 6d11bfe96a
commit 0abde9a2a8
2 changed files with 12 additions and 32 deletions

View file

@ -17,7 +17,8 @@ class MultiPoint
public:
Points points;
operator Points() const;
operator Points() const { return this->points; }
MultiPoint() {}
MultiPoint(const MultiPoint &other) : points(other.points) {}
MultiPoint(MultiPoint &&other) : points(std::move(other.points)) {}
@ -32,8 +33,9 @@ public:
void rotate(double angle) { this->rotate(cos(angle), sin(angle)); }
void rotate(double cos_angle, double sin_angle);
void rotate(double angle, const Point &center);
void reverse();
Point first_point() const;
void reverse() { std::reverse(this->points.begin(), this->points.end()); }
const Point& first_point() const { return this->points.front(); }
virtual const Point& last_point() const = 0;
virtual Lines lines() const = 0;
size_t size() const { return points.size(); }