title: Returning a pointer to array of fixed sized arrays C++
body: <p>I tried searching everywhere, but because it is such a perplexing question, I wasn't able to find what I was looking for. I am trying to create function/method but I don't know how to specify its return type, which should be:</p>
  
  <pre><code>double(*)[3]
  </code></pre>
  
  <p>I want to be able to use a query like this one:</p>
  
  <pre><code>double R[3][3];
  query ( &amp;output, R );
  </code></pre>
  
  <p>but instead of <code>R[3][3]</code>, I have a vector <code>std::vector&lt;double&gt; R_vect (9);</code> and I do this:</p>
  
  <pre><code>query ( &amp;output, reinterpret_cast&lt;double(*)[3]&gt; (R_vect.data()) );
  </code></pre>
  
  <p>which is a mess, so I wanted to implement a function to make it readable, say:</p>
  
  <pre><code>ReturnType Cast ( const std::vector&lt;double&gt;&amp; R_vect ) {
    return reinterpret_cast&lt;double(*)[3]&gt; (R_vect.data());
  }
  </code></pre>
  
  <p>but I can't specify the return type.
  I used typedef, and it works:</p>
  
  <pre><code>typedef double DesiredCast[3];
  DesiredCast* Cast ( ... ) { ... }
  </code></pre>
  
  <p>but I am still curious how to do it without typedefs.</p>