I have a data structure that looks roughly like this
struct Column
{
void* data;
};
template <class... T>
struct Table
{
size_t count;
std::vector<Column> columns; // columns.size() == sizeof...(T)
};
and I'm trying to visualize it in the following way
+ Table
+ Column 0
item 1
item 2
...
+ Column 1
item 1
item 2
...
This is what I have so far:
<Type Name="Table<*>">
<Expand>
<Synthetic Name="Column 0">
<Expand>
<ArrayItems>
<Size>count</Size>
<ValuePointer>($T1*) columns[0].data</ValuePointer>
</ArrayItems>
</Expand>
</Synthetic>
<Synthetic Name="Column 1" Condition="columns.size() > 1">
<Expand>
<ArrayItems>
<Size>count</Size>
<ValuePointer>($T2*) columns[1].data</ValuePointer>
</ArrayItems>
</Expand>
</Synthetic>
</Expand>
</Type>
Obviously, this scales really poorly. I'm relegated to copy-pasting the code for each column and adding a Condition
to enable or disable it. I'll end up with a maximum number of supported columns after which point the visualization just stops showing columns.
Is there some way to display this more intelligently? I can imagine a couple ways to do it if I could index the template parameter with an expression like $T$i
.
What I really want to do is something like this:
<Type Name="Table<*>">
<Expand>
<ArrayItems>
<Size>columns.size()</Size>
<Value>
<Synthetic Name="Column %i">
<Expand>
<ArrayItems>
<Size>count</Size>
<ValuePointer>($T$i2*) columns[$i2].data</ValuePointer>
</ArrayItems>
</Expand>
</Synthetic>
</Value>
</ArrayItems>
</Expand>
</Type>