gpt4 book ai didi

NatVis 显示枚举的子串

转载 作者:行者123 更新时间:2023-12-04 01:37:07 24 4
gpt4 key购买 nike

我们经常为枚举使用前缀。

在 NatVis 中显示全名非常冗长。

是否可以删除枚举名称的前缀(又名返回枚举名称的子字符串)?

enum FooFormat {
FooFormat_Foo,
FooFormat_Bar,
FooFormat_Baz,
FooFormat_COUNT
};

struct Bar {
FooFormat format;
};
<AutoVisualizer>
<Type Name="Bar">
<DisplayString>fmt={format,How-to-get-substring-of-enum-name-?}</DisplayString>
</Type>
</AutoVisualizer>

最佳答案

使用 format specifier en 为了这:

<AutoVisualizer>
<Type Name="Bar">
<DisplayString>fmt={format,en}</DisplayString>
</Type>
</AutoVisualizer>

例如:
Bar f;
f.format = FooFormat_Bar;
... // breakpoint here

enter image description here

关于NatVis 显示枚举的子串,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59141655/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com