Bug 18675 – std.experimental.checkedint.Checked has opEquals but no toHash

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P1
Component
phobos
Product
D
Version
D2
Platform
All
OS
All
Creation time
2018-03-28T13:13:21Z
Last change time
2018-09-08T14:41:24Z
Assigned to
vladvitan
Creator
Jack Stouffer
Blocks
17206

Comments

Comment #0 by jack — 2018-03-28T13:13:21Z
Comment #1 by vladvitan — 2018-04-04T09:23:10Z
I want to work on this. Could you please give me a starting point for this? Should I use the toHash() functionality from druntime?
Comment #2 by jack — 2018-04-04T14:34:14Z
(In reply to vladvitan from comment #1) > I want to work on this. Could you please give me a starting point for this? > Should I use the toHash() functionality from druntime? Yes, or you can use typeid(var).getHash(&var). You'll have to put this inside of a trusted lambda in order for it to be @safe. The main thing you need to make sure is that it follows the logic of opEquals, i.e. two things have the same hash according to opEquals' logic.
Comment #3 by greensunny12 — 2018-06-08T09:59:08Z
Just referencing the PR https://github.com/dlang/phobos/pull/6467 for people who look t this in the future while the PR is still open.
Comment #4 by github-bugzilla — 2018-09-08T14:41:23Z
Commits pushed to master at https://github.com/dlang/phobos https://github.com/dlang/phobos/commit/f21833ff154cfd1a405115f2bf79dca55151721c Fix Issue 18675 - Missing toHash in std/experimental/checkedint.d https://github.com/dlang/phobos/commit/a681e986a3295aa59211ed8194e4e4af3a1a4b34 Merge pull request #6467 from vlasebian/checked_toHash Fix Issue 18675 - Missing toHash in std/experimental/checkedint.d merged-on-behalf-of: Nathan Sashihara <[email protected]>