|
@@ -15,7 +15,10 @@ namespace simple::geom
|
|
|
using range = support::range<Type>;
|
|
|
|
|
|
[[nodiscard]]
|
|
|
- constexpr operator range() const
|
|
|
+ constexpr operator range() const { return to_range(); }
|
|
|
+
|
|
|
+ [[nodiscard]]
|
|
|
+ constexpr auto to_range() const
|
|
|
{
|
|
|
return range{position, position + size};
|
|
|
}
|
|
@@ -34,11 +37,15 @@ namespace simple::geom
|
|
|
AnchorType anchor;
|
|
|
|
|
|
[[nodiscard]]
|
|
|
- constexpr operator typename base::range() const
|
|
|
+ // NOTE: maybe return range<common type <Type, AnchorType>> if range<Type> doesn't work??
|
|
|
+ // gotta have an actual use case to make it worth it though
|
|
|
+ constexpr operator typename base::range() const { return to_range(); }
|
|
|
+
|
|
|
+ [[nodiscard]]
|
|
|
+ constexpr auto to_range() const
|
|
|
{
|
|
|
- auto lower = this->position -
|
|
|
- static_cast<Type>(anchor * static_cast<AnchorType>(this->size));
|
|
|
- return typename base::range{lower, lower + this->size};
|
|
|
+ auto lower = this->position - anchor * this->size;
|
|
|
+ return support::range{lower, lower + this->size};
|
|
|
}
|
|
|
|
|
|
[[nodiscard]]
|