title: Visual Studio .natvis file - matrices
body: <p>I'm trying to display a matrix class in the Visual Studio 2013 debugger.  The relevant part of the class is this:</p>
  
  <pre><code>class mat {
  private:
      size_t rowdim, coldim;
      double* _mem;
  };
  </code></pre>
  
  <p>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:</p>
  
  <pre><code>&lt;Type Name="mat"&gt;
      &lt;DisplayString&gt;{{ Matrix {rowdim}x{coldim} }}&lt;/DisplayString&gt;
      &lt;StringView&gt;_mem,[rowdim]&lt;/StringView&gt;
      &lt;Expand&gt;
          &lt;Item Name="[size]" ExcludeView="simple" &gt;rowdim&lt;/Item&gt;
          &lt;ArrayItems&gt;
              &lt;Direction&gt;Forward&lt;/Direction&gt;
              &lt;Rank&gt;2&lt;/Rank&gt;
              &lt;Size&gt;{rowdim, coldim}&lt;/Size&gt;
              &lt;ValuePointer&gt;_mem&lt;/ValuePointer&gt;
          &lt;/ArrayItems&gt;
      &lt;/Expand&gt;
  &lt;/Type&gt;
  </code></pre>
  
  <p>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?</p>