I think he means:
QuantLib::TimeSeries<double> series(dates.begin(), dates.end(), quotes.begin());
发件人: Edouard Tallent [mailto:[hidden email]]
发送时间: 2013年2月10日 22:14
收件人: [hidden email]
主题: Re: [Quantlib-users] About QuantLib::TimeSeries again
Thank you for your quick reply Alexandre P.
As you suggest dates.end() makes much sense (I pasted the new code below)
But I now get the following warning message from the Microsoft Visual C++ runtime Library:
Debug Assertion Failed!
Program C:\Windows\system32\MSVCP110D.dll
File: c:\program files\microsoft visual studio 11.0\vc\include\vector
Line: 101
Expression: vector iterator not incrementable
For information on how your program can cause an assertion
failure, see the Visual C++ documentation on asserts.
(Press Retry to debug the application)
My use of the QuantLib::TimeSeries constructor still is not right.
I would appreciate any help. Thank you
#include<vector>
#include<iostream>
#include<ql\quantlib.hpp>
int main()
{
std::vector<QuantLib::Date> dates;
std::vector<double> quotes;
dates.push_back(QuantLib::Date(12, QuantLib::Nov, 2012));
dates.push_back(QuantLib::Date(13, QuantLib::Nov, 2012));
dates.push_back(QuantLib::Date(14, QuantLib::Nov, 2012));
quotes.push_back(40.05);
quotes.push_back(40.84);
quotes.push_back(41.03);
QuantLib::TimeSeries<double> series(dates.begin(), dates.end(), quotes.end());
// Is my time series empty?
std::cout << "Is series empty?\t" << series.empty() << std::endl;
std::cout << "Value on November 14th, 2012?\t" << series[QuantLib::Date(14, QuantLib::Nov, 2012)] << std::endl;
return 0;
} // Doesn't work!
| Free forum by Nabble | Edit this page |