简体   繁体   English

Visual Studio .natvis文件 - 矩阵

[英]Visual Studio .natvis file - matrices

I'm trying to display a matrix class in the Visual Studio 2013 debugger. 我正在尝试在Visual Studio 2013调试器中显示矩阵类。 The relevant part of the class is this: 该课程的相关部分是:

class mat {
private:
    size_t rowdim, coldim;
    double* _mem;
};

I'm trying to visualise this as a multi-dimensional array but I can't figure out how to specify the size of the dimensions when they're not stored as an array. 我试图将其可视化为一个多维数组但我无法弄清楚当它们没有存储为数组时如何指定尺寸的大小。 This is what I'm trying: 这就是我正在尝试的:

<Type Name="mat">
    <DisplayString>{{ Matrix {rowdim}x{coldim} }}</DisplayString>
    <StringView>_mem,[rowdim]</StringView>
    <Expand>
        <Item Name="[size]" ExcludeView="simple" >rowdim</Item>
        <ArrayItems>
            <Direction>Forward</Direction>
            <Rank>2</Rank>
            <Size>{rowdim, coldim}</Size>
            <ValuePointer>_mem</ValuePointer>
        </ArrayItems>
    </Expand>
</Type>

But there doesn't seem to be any way of giving the dimensions as literals, or as distinct variables, only as an array to be indexed. 但似乎没有任何方法可以将维度作为文字或不同的变量,仅作为要索引的数组。 Does anyone know if there's a way of doing this? 有谁知道有没有办法做到这一点?

You can specify basic expressions and the debugger will evaluate them, try using: 您可以指定基本表达式,调试器将对它们进行评估,请尝试使用:

<Size>$i == 0 ? rowdim : coldim</Size>

Visual studio 2015 accepts this, i don't have 2013 installed anymore. Visual Studio 2015接受了这个,我没有安装2013。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM