C++ Primer (5th edition) states that when an array is initialised with a size, the size provided has to be a constexpr
, like this:
int arr[10];
// or
constexpr size_t sz = 10;
int arr[sz];
However, this code compiles just fine for me:
size_t sz = 10;
int arr[sz];
So, is the constexpr
really needed?
Aucun commentaire:
Enregistrer un commentaire