我有以下 .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 为 typevbl::Hash_Table<Handle, Entity*, null>
而不是为 type加载vbl::Hash_Table<Physics_Body*, long, function (Physics_Body* b) @system => hash32((*b)::entity::handle::raw_handle::bitfield)>
。输出窗口显示 natvis 完全编译第一个,但甚至不考虑第二个。
第二种类型的签名完全疯狂,我知道,但不幸的是我必须使用它并且无法弄清楚为什么它不匹配。我认为名称匹配系统可能匹配得很好,因此>
将匹配大于=>
而不是在末尾,但由于嵌套模板没有问题,所以情况并非如此。
如何更正<Type Name="vbl::Hash_Table<*>">
以匹配两个类型签名?