我有以下 .natvis 文件用于可视化哈希表的元素。
<?xml version="1.0" encoding="utf-8"?>
<AutoVisualizer xmlns="http://schemas.microsoft.com/vstudio/debugger/natvis/2010">
<Type Name="vbl::Hash_Table<*>">
<DisplayString>{size} elements in {capacity} slots</DisplayString>
<Expand>
<CustomListItems MaxItemsPerView="5000" ExcludeView="Test">
<Variable Name="slot_index" InitialValue="0" />
<Size>size</Size>
<Loop>
<Break Condition="slot_index >= size"/>
<If Condition="slot_index < size">
<If Condition="slots[slot_index].key_hash == true">
<Item Name="key">slots[slot_index].key</Item>
<Item Name="value">slots[slot_index].value</Item>
</If>
<Exec>slot_index++</Exec>
</If>
</Loop>
</CustomListItems>
</Expand>
</Type>
</AutoVisualizer>
我(还)不关心复杂的可视化逻辑,而只关心名称匹配。此 natvis 为 vbl::Hash_Table<Handle, Entity*, null>
类型加载,但未为 vbl::Hash_Table<Physics_Body*, long, function (Physics_Body* b) @system => hash32((*b)::entity::handle::raw_handle::bitfield)>
类型加载。 Output 窗口显示 natvis 为第一个完全编译,但在第二个时甚至没有考虑。
第二种类型签名完全疯狂,我知道,但不幸的是我必须使用它并且无法弄清楚为什么它不匹配。我认为名称匹配系统可能会非常匹配,因此 >
将匹配 =>
中的大于号而不是末尾,但是由于嵌套模板没有问题,因此不可能是这样。
如何更正 <Type Name="vbl::Hash_Table<*>">
以匹配两个类型签名?