I’m using boost::string_view. (www.boost.org/doc/libs/1_61_0/boost/utility/string_view.hpp)
Its got a const char* ptr_ and a unsigned int len_ data member. When debugging its cumbersome, as the default visualiser will show the char ptr_ with more charachters than length (as string_view is not null terminated).
I tried creating my own visualiser by looking at the std::string visualiser. I can get the string to be displayed if I hard code the length (to say 4), but I cant get it to use the actual length variable. Any help appreciated. Broken example:
<?xml version="1.0" encoding="utf-8"?>
<AutoVisualizer xmlns="http://schemas.microsoft.com/vstudio/debugger/natvis/2010">
<Type Name="boost::basic_string_view<char,*>" Priority="High">
<DisplayString>{ptr_,4}</DisplayString> //works...
<DisplayString>{ptr_,len_}</DisplayString> //doesnt work...
</Type>
</AutoVisualizer>
Aucun commentaire:
Enregistrer un commentaire