`<variant>`: Add `type()` and `value()` intrinsics to `STL.natvis`?
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 11.2k
- Forks
- 1.7k
- Avg merge
- 4d 15h
- Merged PRs (30d)
- 22
Description
In trying to make nice debugger natvis for an abstract syntax tree, I have found myself wishing that std::variant supported a .value() and .type() debugger intrinsic (like std::any and many other STL types do). It clearly has this information - it's able to visualize an index and [value] field. But there doesn't seem to be any way to get the type name (i.e. extract just the current index's type name from the template parameters that * matched) or display only the value (without "index=... ") in my own type's <DisplayString>.
So it would be nice if the STL.natvis could offer these too.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in STL.natvis and compare the existing std::any intrinsic definitions with the std::variant visualization, especially its index and [value] fields. Determine how the natvis can expose the active alternative's type and value, then verify that custom AST DisplayString entries can use both without showing the index.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- devtools
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 70/100