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);
|
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);
|
return location((left + right) / 2, (top + bottom) / 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
location rectangle::topLeft() const {
|
const location rectangle::topLeft() const {
|
||||||
return location(left, top);
|
return location(left, top);
|
||||||
}
|
}
|
||||||
|
|
||||||
location rectangle::topRight() const {
|
const location rectangle::topRight() const {
|
||||||
return location(right, top);
|
return location(right, top);
|
||||||
}
|
}
|
||||||
|
|
||||||
location rectangle::bottomLeft() const {
|
const location rectangle::bottomLeft() const {
|
||||||
return location(left, bottom);
|
return location(left, bottom);
|
||||||
}
|
}
|
||||||
|
|
||||||
location rectangle::bottomRight() const {
|
const location rectangle::bottomRight() const {
|
||||||
return location(right, bottom);
|
return location(right, bottom);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -81,11 +81,11 @@ struct rectangle {
|
|||||||
rectangle_size_delegate height();
|
rectangle_size_delegate height();
|
||||||
const rectangle_size_delegate width() const;
|
const rectangle_size_delegate width() const;
|
||||||
const rectangle_size_delegate height() const;
|
const rectangle_size_delegate height() const;
|
||||||
location centre() const;
|
const location centre() const;
|
||||||
location topLeft() const;
|
const location topLeft() const;
|
||||||
location topRight() const;
|
const location topRight() const;
|
||||||
location bottomLeft() const;
|
const location bottomLeft() const;
|
||||||
location bottomRight() const;
|
const location bottomRight() const;
|
||||||
bool contains(location p) const;
|
bool contains(location p) const;
|
||||||
bool contains(int x, int y) const;
|
bool contains(int x, int y) const;
|
||||||
bool empty() const;
|
bool empty() const;
|
||||||
|
|||||||
Reference in New Issue
Block a user