I write debugger visualizers using the .natvis file in Microsoft Visual Studio 2015. In my class there is one information that I would like to get, if possible. I am wondering what syntax will be for this variable.
Here is a simplified version of C ++ code:
class MyClass { public: MyClass() {} int getAValue(size_t index) { static std::vector<int> numberVector; if (numberVector.size() <= index) { addSomeNumbersToTheEnd(numberVector); } return numberVector[i]; } }
In the debugger, I would like to see the size of the vector when I hover over an instance of MyClass, but I do not know how to reference it (or if possible). Here is the Type visualizer, with <what goes here?> In the place where I am having problems:
<Type Name="MyClass"> <DisplayString>[$(Type)] staticVectorSize={<what goes here?>}</DisplayString> </Type>
The actual problem is much more complicated, involving a curiously repeating template of the template for creating the best enumeration objects, so do not comment on the futility of this somewhat contrived scenario.
source share