我试图使用地图向量调试编码(C++ / Quantlib)。基本上我想在地图内找到一个项目,该项目又在一个向量内。但发现错误。
输入:
vector<map <Date, Real> > simulatedPrices_; // a vector containing 1000 maps
vector<Date> cds_maturities_;
私有变量:
map <Date, Real> pricePathJ; // for reading each map in the vector
Real w_t_; //
编码:
for (int j = 0; j < no_of_paths; j++) {
pricePathJ = simulatedPrices_[j];
for (int i = 0; i <= iTenor_; i++) { //iTenor is the number of element inside vector cds_maturities_
startDate = ......;
endDate = ......;
w_t_ = pricePathJ.find(cds_maturities_[i]); // error in pricePathJ saying there is no conversion function from iterator ... the pair<Date, Real> to Real.
......
我是否犯了任何错误,或者是否在上述编码中忽略了任何指针类型?谢谢。
备注:变量类型 Real 类似于 Double 类型