microsoft / microsoft/STL

<variant>: variant should store its index as an unsigned type

Open
#296 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

performance vNext
Dominant language
C++
Stars
11.1k
Forks
1.7k
Avg merge
4d 15h
Merged PRs (30d)
22

Description

@CaseyCarter explained:

"variant should store its index as an unsigned type biased by +1, so the "valueless" index is 0. index() will become slightly more expensive, since we must decrement the stored value instead of the current sign-extension. All other operations will become cheaper, since they currently add 1 to bias the index anyway."

Also tracked by Microsoft-internal VSO-659268 / AB#659268.

vNext note: Resolving this issue will require breaking binary compatibility. We won't be able to accept pull requests for this issue until the vNext branch is available. See #169 for more information.

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.

Research direction

Start by reviewing the issue rationale and the information in #169 about the vNext branch and binary compatibility. The intended result is unsigned, +1-biased variant index storage with 0 representing valueless, while index() decrements the stored value; no files or tests are named here.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
compilers
Issue type
Refactor
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.