mozilla::Variant should permit hashing on the variant tag
Categories
(Core :: MFBT, enhancement)
Tracking
()
Tracking | Status | |
---|---|---|
firefox68 | --- | fixed |
People
(Reporter: jimb, Assigned: jimb)
References
Details
Attachments
(1 file)
The discriminant of a mozilla::Variant
value is not available via Variant
's public interface, but since it is considered in the operator==
implementation, it would be nice if it hashing a Variant
could conveniently take the tag into account.
Hashing a Variant
will probably involve a match
to hash the individual alternatives' contents, and those match branches could of course each perturb the hash in a different way, but this essentially requires the match branches to create their own tag, when Variant has a usable value right there. This approach also doesn't work well with when match branches are templated member functions.
Assignee | ||
Comment 1•5 years ago
|
||
Define the Variant::addToHash method, which perturbs a hash value according to
the variant's current alternative's tag. This makes it easier to avoid
collisions in variants in which different alternatives might hash similarly.
Tests included.
Updated•5 years ago
|
Pushed by jblandy@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/6dea6fe4571e Implement mozilla::Variant::addTagToHash. r=froydnj
Comment 3•5 years ago
|
||
bugherder |
Updated•5 years ago
|
Description
•