Hashable should take type index into account

Open
#131 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
35/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Stale
Tech stack
cpp
Domain
backend

Research direction

Start in include/mapbox/variant.hpp at lines 1002-1011 and 536-544, where variant hashing and type-index access are referenced. Ensure the hash accounts for both the underlying value hash and .which() so variants with equal value hashes but different type indexes do not collide.

Written by the indexing model from the issue text.

Description

enhancement

Hashing a variant should take the type index / .which() into account in addition to the underlying hash

Why? Because of the edge case where the underlying hash is the same but the type index is not.

Dominant language
C++
Stars
384
Forks
96
PR merge metrics
No merged PRs in 30d

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from mapbox/variant

All issues in mapbox/variant

Similar issues

More C++ issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.