Added isPartiallyOrdered in std.traits
In short, isPartiallyOrdered!(S, T) compiles, iff the ordering exists, and it returns false iff the comparison s <= t || s >= t between values s and t of type S and T cannot be false from a static type analysis point of view.
It is needed order to implement #6499 properly and can be useful in the future.
Thanks for your pull request and interest in making D better, @Bolpat! We are looking forward to reviewing it, and you should be hearing from a maintainer soon. Please verify that your PR follows this checklist:
- My PR is fully covered with tests (you can see the annotated coverage diff directly on GitHub with CodeCov's browser extension
- My PR is as minimal as possible (smaller, focused PRs are easier to review than big ones)
- I have provided a detailed rationale explaining my changes
- New or modified functions have Ddoc comments (with
Params:andReturns:)
Please see CONTRIBUTING.md for more information.
If you have addressed all reviews or aren't sure how to proceed, don't hesitate to ping us with a simple comment.
Bugzilla references
Your PR doesn't reference any Bugzilla issue.
If your PR contains non-trivial changes, please reference a Bugzilla issue or create a manual changelog.
Testing this PR locally
If you don't have a local development environment setup, you can use Digger to test this PR:
dub fetch digger
dub run digger -- build "master + phobos#6513"
I don't know why Jenkins fails. The error seems not to be related with this PR; it hardly is as this PR is addition-only. Can the error be ignored?
Yeah sadly the Ocean error seems to be appearing on a few other PRs too.
Disabled it temporarily -> https://github.com/dlang/ci/pull/208 (after the next push, Jenkins should be green again).
@ZombineDev maybe a quick review?
Is this assertion failure expected ?
unittest
{
struct F
{
float f;
alias f this;
}
static assert(isPartiallyOrdered!F == isPartiallyOrdered!float);
}
Thank you @BBasile, the answer is no. I missed that and it's fixed now.
@Bolpat Is this addition still required?
cc @atilaneves
@RazvanN7 What do you mean by required? Has something similar been added and I didn't notice?
I saw that PR #6499 was closed so I wanted to make sure that you are still pursuing this. Will merging this PR unblock #6499?
@RazvanN7, I cannot guarantee it, but it is likely to be unblocked by it. However, note that slice comparison is broken in the same way. I'll work on it soon (the next days).
Edit: This should probably go to core and std.traits should have a public import of it. That way, array comparison can use it.
@Bolpat Have you made any progress on this?