How come I can do like this:
Code:
#include <iostream>
#include <vector>
using namespace std;
int main()
{
// Some constants
const int nRows = 5;
const int nCols = 11;
//Typedefs to save our fingers and improve readability
typedef vector<char> cArrayRow;
typedef vector<cArrayRow> cArray;
// Make an array:
cArray myArray(nRows,cArrayRow(nCols));
}
but not like this:
Code:
#include <iostream>
#include <vector>
using namespace std;
int main()
{
const int nRows = 5;
const int nCols = 11;
vector<vector<char>> test(nRows, vector<char>(nCols));
}
I dont know much about STL but why can I do the former but not the later since they seem to be quite the same to me, only one uses typedefs and the other doesnt.
Even this wont work:
Code:
vector<vector<char>> test;