title: #define function with variable name
body: <p>I am continually writing something akin to </p>
  
  <pre><code>std::vector&lt; std::vector&lt; double &gt; &gt; A(N, std::vector&lt; double &gt;(M));
  </code></pre>
  
  <p>and I would like to replace this with something like</p>
  
  <pre><code>matrix A(N,M);
  </code></pre>
  
  <p>by using a <code>#define</code> directive. I've looked at <a href="https://msdn.microsoft.com/en-us/library/teas0593.aspx" rel="nofollow noreferrer">#define directives</a> and think I can create a function like <code>matrix(A,N,M)</code> that would declare a <code>vector</code> of <code>vectors</code> as follows:</p>
  
  <pre><code>#define matrix(A, N, M) std::vector&lt; std::vector&lt; double &gt; &gt; A(N, std::vector&lt; double &gt;(M))
  </code></pre>
  
  <p>but I would rather not declare my matrices as <code>matrix(A,N,M)</code>, but rather <code>matrix A(N,M)</code>. My question is - how do I use the <code>#define</code> directives to account for changing a variable name?</p>