title: Is there a way to have a stdarray the same size as MPI_Comm_size?
body: <p>I have a program where I am trying to gather up a set of data into an std::array however I cannot get this to work when the size of my array is set to the value of the world size. I get the following error:</p>
  <pre><code>MPITests.cpp:16:21: error: the value of ‘size’ is not usable in a constant expression
     16 |     std::array&lt;int, size&gt; gatheredRanks2;
        |                     ^~~~
  </code></pre>
  <p>here is a section of the relevant code:</p>
  <pre><code>int rank, size;
  
  MPI_Init(NULL, NULL);
  MPI_Comm_size(MPI_COMM_WORLD, &amp;size);
  MPI_Comm_rank(MPI_COMM_WORLD, &amp;rank);
  
  std::array&lt;int, size&gt; gatheredRanks2;
  </code></pre>
  <p>If I simply set the value of this size to a number the program works.
  Is there a workaround for this?</p>