title: Why is non-const std::array::operator[] not constexpr?
body: <p>I'm trying to fill a 2D array on compile time with a given function. Here is my code:</p>
  
  <pre><code>template&lt;int H, int W&gt;
  struct Table
  {
    int data[H][W];
    //std::array&lt;std::array&lt;int, H&gt;, W&gt; data;  // This does not work
  
    constexpr Table() : data{}
    {
      for (int i = 0; i &lt; H; ++i)
        for (int j = 0; j &lt; W; ++j)
          data[i][j] = i * 10 + j;  // This does not work with std::array
    }
  };
  
  constexpr Table&lt;3, 5&gt; table;  // I have table.data properly populated at compile time
  </code></pre>
  
  <p>It works just fine, <code>table.data</code> is properly populated at compile time. </p>
  
  <p>However, if I change plain 2D array <code>int[H][W]</code> with <code>std::array&lt;std::array&lt;int, H&gt;, W&gt;</code>, I have an error in the loop body:</p>
  
  <pre><code>error: call to non-constexpr function 'std::array&lt;_Tp, _Nm&gt;::value_type&amp; std::array&lt;_Tp, _Nm&gt;::operator[](std::array&lt;_Tp, _Nm&gt;::size_type) [with _Tp = int; long unsigned int _Nm = 3ul; std::array&lt;_Tp, _Nm&gt;::reference = int&amp;; std::array&lt;_Tp, _Nm&gt;::value_type = int; std::array&lt;_Tp, _Nm&gt;::size_type = long unsigned int]'
  data[i][j] = i * 10 + j;
  ^
  Compilation failed
  </code></pre>
  
  <p>Obviously, I'm trying to call non-const overload of <code>std::array::operator[]</code>, which is not <code>constexpr</code>. The question is, why it is not <code>constexpr</code>? If C++14 allows us to modify variables declared in <code>constexpr</code> scope, why this is not supported by <code>std::array</code>?</p>
  
  <p>I used to think that <code>std::array</code> is just like plain array, only better. But here is an example, where I can use plain array, but cannot use <code>std::array</code>.</p>