I noticed that G++ compiler does permit initializing an array like this:
vector<vector<string> > partition(string s) {
const int len = s.size();
vector<vector<string> > subPalins[len+1] ;
subPalins[0] = vector<vector<string> >();
subPalins[0].push_back(vector<string>());
bool isPalin[len][len];
...
return subPalins[len];
}
The size of array subPalins is len, which is a constant variable. I remember that it is not allowed to initialize a variable-size array since the size of an array must be determined during compiling time. Though len here is a constant, it is still a variable and I don't understand why this is allowed.