For some reason, the compiler was allowing assignment to these returned locations. That has no effect and is broken, so add const to prevent it.
This commit is contained in:
@@ -178,23 +178,23 @@ const rectangle_size_delegate rectangle::height() const {
|
||||
return rectangle_size_delegate(*const_cast<rectangle*>(this), &rectangle::top, &rectangle::bottom);
|
||||
}
|
||||
|
||||
location rectangle::centre() const {
|
||||
const location rectangle::centre() const {
|
||||
return location((left + right) / 2, (top + bottom) / 2);
|
||||
}
|
||||
|
||||
location rectangle::topLeft() const {
|
||||
const location rectangle::topLeft() const {
|
||||
return location(left, top);
|
||||
}
|
||||
|
||||
location rectangle::topRight() const {
|
||||
const location rectangle::topRight() const {
|
||||
return location(right, top);
|
||||
}
|
||||
|
||||
location rectangle::bottomLeft() const {
|
||||
const location rectangle::bottomLeft() const {
|
||||
return location(left, bottom);
|
||||
}
|
||||
|
||||
location rectangle::bottomRight() const {
|
||||
const location rectangle::bottomRight() const {
|
||||
return location(right, bottom);
|
||||
}
|
||||
|
||||
@@ -433,4 +433,4 @@ int closest_point_idx(std::vector<location> points, location anchor) {
|
||||
|
||||
location closest_point(std::vector<location> points, location anchor) {
|
||||
return points[closest_point_idx(points, anchor)];
|
||||
}
|
||||
}
|
||||
|
@@ -81,11 +81,11 @@ struct rectangle {
|
||||
rectangle_size_delegate height();
|
||||
const rectangle_size_delegate width() const;
|
||||
const rectangle_size_delegate height() const;
|
||||
location centre() const;
|
||||
location topLeft() const;
|
||||
location topRight() const;
|
||||
location bottomLeft() const;
|
||||
location bottomRight() const;
|
||||
const location centre() const;
|
||||
const location topLeft() const;
|
||||
const location topRight() const;
|
||||
const location bottomLeft() const;
|
||||
const location bottomRight() const;
|
||||
bool contains(location p) const;
|
||||
bool contains(int x, int y) const;
|
||||
bool empty() const;
|
||||
|
Reference in New Issue
Block a user