Dear all,
I am trying to understand a C++ code.
In one part of the code a one dimensional vector is copied into a two dimensional vector.
I do not understand at all how such thing can work. But compiler is quite ok with that.
#define TOTAL_STEPS 120
#define NUMBER_DECISION_VARIABLES 5
int main(){
vector<vector<double> > DV;
vector<double> grid ( TOTAL_STEPS,0.0);
vector<double>temp ( NUMBER_DECISION_VARIABLES,0.0);
temp[0] = 0.0;
temp[1] = 0.65;
temp[2] = 0.2;
temp[3] = 0.6;
temp[4] = 0.3;
DV.resize( grid.size(), temp); // <<<<<<------------------ here ??
return 0;
}
DV[][] is 120*120 and temp[] is 5, How does it work?