Re: Testing for object property supporting "<" comparison
On Wednesday, 12 May 2021 at 00:06:52 UTC, Paul Backus wrote: On Tuesday, 11 May 2021 at 19:42:34 UTC, Chris Piker wrote: std.traits.isOrderingComparable https://phobos.dpldocs.info/std.traits.isOrderingComparable.html Well I feel sheepish, don't know how I missed that one. Hey thanks for pointing it out.
Re: Testing for object property supporting "<" comparison
On Tuesday, 11 May 2021 at 19:42:34 UTC, Chris Piker wrote: My problem is that I don't know how to specify that properties must be comparable via "<". I took a look at the Traits module, but there are more things that are comparable then Arithmetic or Floating point types. Also, since the compiler will catch objects that don't have these properties, maybe an enum check is not worth implementing. std.traits.isOrderingComparable https://phobos.dpldocs.info/std.traits.isOrderingComparable.html