我的类基本上类似于下面的类,我想在Visual Debugger中使其更具可读性:
template <typename T, precision P = defaultp>
struct tvec4
{
T x, y, z, w;
};
template <typename T, precision P = defaultp>
struct tmat4x4
{
typedef tvec4<T, P> col_type;
private:
col_type value[4];
};向量的natvis文件如下所示:
<Type Name="glm::tvec4<*>">
<DisplayString>{x}, {y}, {z}, {w}</DisplayString>
<Expand>
<Item Name="x">x</Item>
<Item Name="y">y</Item>
<Item Name="z">z</Item>
<Item Name="w">w</Item>
</Expand>
</Type>它们工作得很好。然而,对于矩阵类,我无法让任何东西工作。
Try1:
<Type Name="glm::tmat4<*>">
<DisplayString>{{value[0]}, {value[1]}, {value[2]}, {value[3]}}</DisplayString>
<Expand>
<Item Name="[0]">value[0]</Item>
<Item Name="[1]">value[1]</Item>
<Item Name="[2]">value[2]</Item>
<Item Name="[3]">value[3]</Item>
</Expand>
</Type>Try2:
<Type Name="glm::tmat4<*>">
<DisplayString>{size = {4 x 4}}</DisplayString>
<Expand>
<Item Name="[size]">4</Item>
<Item Name="[capacity]">4</Item>
<ArrayItems>
<Size>4</Size>
<ValuePointer>value</ValuePointer>
</ArrayItems>
</Expand>
</Type>你知道我做错了什么吗?
谢谢!克里斯托弗
发布于 2015-04-12 06:17:41
您应该尝试打开诊断程序。这里有解释:https://code.msdn.microsoft.com/Writing-type-visualizers-2eae77a2
在下面创建注册表项:
[HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\11.0_Config\Debugger]
"EnableNatvisDiagnostics"=dword:00000001发布于 2016-12-15 19:35:52
这是一个老问题,所以我假设你现在已经有了解决方案,但以防其他人也有类似的问题,这是因为你在描述中使用了花括号:
<DisplayString>{{value[0]}, {value[1]}, {value[2]}, {value[3]}}</DisplayString>单花括号{}表示内容应由调试器解释,但如果您实际上希望将大括号作为描述的一部分,则需要使用双花括号:
{{Text here {variable_name_here}}}因此,在您的示例中,将生成正确的显示字符串:
<DisplayString>{{{value[0]}, {value[1]}, {value[2]}, {value[3]}}}</DisplayString>https://stackoverflow.com/questions/27852505
复制相似问题