-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Description
Describe the bug
The visualizer for std::any ain't that useful. Except knowing how something is stored into it, and the type info for the stored class, it is almost impossible to inspect what's into it.
I've already managed to extend the natvis with the following
<Item Name="[castable_ptr]" Condition="_Is_trivial()">(void*)(&_Storage._TrivialData)</Item>
<Item Name="[castable_ptr]" Condition="_Is_small()">(void*)(&_Storage._SmallStorage._Data)</Item>
<Item Name="[castable_ptr]" Condition="_Is_big()">(void*)(_Storage._BigStorage._Ptr)</Item>
This improved the usability a lot and has a lot of sense to add to the upstream project. Ideally, one would cast this to the actual type, however, I'm not sure that's even possible.
All details can be found in my stackoverflow post, see https://stackoverflow.com/questions/59285956/using-stdtype-info-for-casting-in-natvis
Command-line test case
C:\Temp>type repro.cpp
#include <any>
int main() {
std::any a = 0;
}
C:\Temp>cl /EHsc /W4 /WX .\repro.cpp
Expected behavior
Be able to inspect the content of std::any in an easy way
STL version
Microsoft Visual Studio 2019, exact version not relevant
Additional context
https://stackoverflow.com/questions/59285956/using-stdtype-info-for-casting-in-natvis