Skip to content

Instantly share code, notes, and snippets.

@srz-zumix
Created May 28, 2020 07:18
Show Gist options
  • Select an option

  • Save srz-zumix/9b6f2829c78cb441845d09c3483900d4 to your computer and use it in GitHub Desktop.

Select an option

Save srz-zumix/9b6f2829c78cb441845d09c3483900d4 to your computer and use it in GitHub Desktop.
<?xml version="1.0" encoding="utf-8"?>
<AutoVisualizer xmlns="http://schemas.microsoft.com/vstudio/debugger/natvis/2010">
<Type Name="std::basic_string&lt;char,*&gt;" Priority="High">
<Intrinsic Name="size" Expression="_Mypair._Myval2._Mysize" />
<Intrinsic Name="capacity" Expression="_Mypair._Myval2._Myres" />
<!-- _BUF_SIZE = 16 / sizeof(char) &lt; 1 ? 1 : 16 / sizeof(char) == 16 -->
<Intrinsic Name="bufSize" Expression="16" />
<Intrinsic Name="isShortString" Expression="capacity() &lt; bufSize()" />
<Intrinsic Name="isLongString" Expression="capacity() &gt;= bufSize()" />
<DisplayString Condition="isShortString()">{_Mypair._Myval2._Bx._Buf,nas8}</DisplayString>
<DisplayString Condition="isLongString()">{_Mypair._Myval2._Bx._Ptr,nas8}</DisplayString>
<StringView Condition="isShortString()">_Mypair._Myval2._Bx._Buf,nas8</StringView>
<StringView Condition="isLongString()">_Mypair._Myval2._Bx._Ptr,nas8</StringView>
<Expand>
<Item Name="[size]" ExcludeView="simple">size()</Item>
<Item Name="[capacity]" ExcludeView="simple">capacity()</Item>
<Item Name="[allocator]" ExcludeView="simple">_Mypair</Item>
<ArrayItems>
<Size>_Mypair._Myval2._Mysize</Size>
<ValuePointer Condition="isShortString()">_Mypair._Myval2._Bx._Buf</ValuePointer>
<ValuePointer Condition="isLongString()">_Mypair._Myval2._Bx._Ptr</ValuePointer>
</ArrayItems>
</Expand>
</Type>
</AutoVisualizer>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment