¿Por qué no es constante std :: array :: operator [] no constexpr?

Estoy tratando de llenar una matriz 2D en tiempo de compilación con una función determinada. Aquí está mi código:

template<int H, int W>
struct Table
{
  int data[H][W];
  //std::array<std::array<int, H>, W> data;  // This does not work

  constexpr Table() : data{}
  {
    for (int i = 0; i < H; ++i)
      for (int j = 0; j < W; ++j)
        data[i][j] = i * 10 + j;  // This does not work with std::array
  }
};

constexpr Table<3, 5> table;  // I have table.data properly populated at compile time

Funciona bientable.data se rellena correctamente en tiempo de compilación.

Sin embargo, si cambio la matriz 2D simpleint[H][W] constd::array<std::array<int, H>, W>, Tengo un error en el cuerpo del bucle:

error: call to non-constexpr function 'std::array<_Tp, _Nm>::value_type& std::array<_Tp, _Nm>::operator[](std::array<_Tp, _Nm>::size_type) [with _Tp = int; long unsigned int _Nm = 3ul; std::array<_Tp, _Nm>::reference = int&; std::array<_Tp, _Nm>::value_type = int; std::array<_Tp, _Nm>::size_type = long unsigned int]'
data[i][j] = i * 10 + j;
^
Compilation failed

Obviamente, estoy tratando de llamar a la sobrecarga no constante destd::array::operator[], lo cual no esconstexpr. La pregunta es, ¿por qué no es así?constexpr? Si C ++ 14 nos permite modificar las variables declaradas enconstexpr alcance, por qué esto no es compatible constd::array?

Solía pensar esostd::array es como una matriz simple, solo que mejor. Pero aquí hay un ejemplo, donde puedo usar una matriz simple, pero no puedo usarstd::array.

Respuestas a la pregunta(4)

Su respuesta a la pregunta