Closed poul250 closed 3 years ago
In the C++20 standard we can use
template<typename T> requires
requires(T maximum, T minimum) { maximum - minimum; }
public: static T Difference(Range<T> range) { return range.Maximum - range.Minimum; }
For all types with operator-
or builtin '-'
Yes, we can. Looks like this issue was solved by #61
https://github.com/linksplatform/Ranges/blob/d7b5ac881f7e8921520f5264ce04a1d97dfd31c3/cpp/Platform.Ranges/RangeExtensions.h#L5-L23
do that like this:
Return type is
T
, but we can also useauto
.