I have got an object which is of type vector< map < Date, Double >>
(object named simulatedPrices_
). I want to do a for
loop reading the map
inside the vector
. I tried to use below:
for (j=0; j<10000; j++) {
map <Date, Double> & pricePathJ = *simulatedPrices_[j];
price = pricePathJ->find(targetDate)->second; //targetDate is certain date
cout << j << " : " << price << endl;
}
But it seems error saying no operator "*"
match these operands.
Any idea on why it complain this error?
Is there anyway I can do better instead of the above.
The reason I used pointer was that simulatedPrices_
was quite an large object (vector containing 10000 maps, each map with 900 dates of prices)
Thanks.