title: Natvis visualizer to view member pointer type as array
body: <p>In the Visual Studio 2015 watch window, pointers can be watched as array by adding a comma and the array length, e.g. d,10 will display 10 elements for a double * d.</p>
  
  <p>Is it possible to create a Natvis Type Entry which does this based on the number of indirections, ie. for d, d* and d** in a different way?
  Usually those are even members of a type, e.g. struct s { double* d }, but i want to avoid having to write custom visualizers for all those types.</p>
  
  <p>The question is tagged for VS2015 but solutions for vs2017 or vs2019 are welcome if there are any.</p>
  
  <p><strong>Edit1:</strong>
  Here's a simple example of what i'm looking for:</p>
  
  <pre><code>struct S
  {
      double* v3;  
      double** m3;
  };
  int main()
  {
      double* pv3 = new double[3]{ -1,-2,-3 };
      double** ppm3 = new double*[3]{ new double[3]{ 1,2,3 }, new double[3]{ 4,5,6 }, new double[3]{ 7,8,9 } };
  
      S s;
      s.v3 = pv3;
      s.m3 = ppm3;
  
      double v3[3] = { -1,-2,-3 };
      double m33[3][3] = { { 1,2,3 }, { 4,5,6 }, { 7,8,9 } };
  }
  </code></pre>
  
  <ul>
  <li>pv3 and s.v3 should be visualized like v3 and </li>
  <li>ppm3 and s.m3 should be visualized like m33</li>
  </ul>
  
  <p>I know that treating <strong>every</strong> double pointer as a double[3] might not be what everyone would want but in certain codebases like the one i'm working on this is the 99% usecase.</p>
  
  <p><a href="https://i.stack.imgur.com/Xftid.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Xftid.png" alt="ugly annotated vc watch window snapshot"></a></p>