title: Getting the number of elements in std::array at compile time
body: <p>Is the following a valid C++ code, and why not?</p>
  
  <pre><code>std::array&lt;std::string, 42&gt; a1;
  std::array&lt;int, a1.size()&gt; a2;
  </code></pre>
  
  <p>It doesn't compile in GCC 4.8 (in C++11 mode). There is a simple but inelegant workaround:</p>
  
  <pre><code>std::array&lt;std::string, 42&gt; a1;
  std::array&lt;int, sizeof(a1)/sizeof(a1[0])&gt; a2;
  </code></pre>
  
  <p>So clearly the compiler can figure out the number of elements in std::array. Why std::array::size() is not a <code>constexpr static</code> function?</p>
  
  <p>EDIT:
  I have found another workaround:</p>
  
  <pre><code>std::array&lt;std::string, 42&gt; a1;
  std::array&lt;int, std::tuple_size&lt;decltype(a1)&gt;::value&gt; a2;
  </code></pre>