It'd work in C++ (overload
operator <=(FullRange, T) to return
<= can only return bool, via
Option<Ordering>, so I assume it can't work in Rust. (And PartialOrd requires PartialEq, so it'd also allow silliness like
4 == .. == 2.) I assume it'd be completely doable as a macro, though. Then you could even make
range!(0 <= r) turn
Let me also plug the comment I posted on the other thread about ranges. TL/DR: From an algorithmic perspective, I think all
std should provide is the Range [a,b) where b is 'reachable' from a by zero-or-more-but-finite applications of a successor function (aka, roughly, a ≤ b). Going beyond that feels like we're making an interval library, which is a totally different thing, and the current range is no better than a pair.