Monday, 15 August 2011

C++ : use of class and constructor -



C++ : use of class and constructor -

i having rough using quantlib::timeseries class quantlib library. problem doesn't relate quantlib , intricacies, in more general c++ class utilize think.

the quantlib::timeseries described here. in code (that returns absolutely nil now), provide series of dates in std::vector , series of prices contained in std::vector. quantlib::timeseries object supposed tie dates , prices.

#include<ql\quantlib.hpp> int main() { std::vector<quantlib::date> dates; std::vector<std::double> quotes; dates.push_back(date(12,nov, 2012)); dates.push_back(date(13,nov, 2012)); dates.push_back(date(14,nov, 2012)); quotes.push_back(40.05); quotes.push_back(40.84); quotes.push_back(41.03); // below line stuck @ quantlib::timeseries<std::vector<quantlib::date>, std::vector<double>> series(dates.begin(), dates.end(), quotes.begin()); // stuff above // ... ... homecoming 0; }

i appreciate provided guidance, helping me create work.

thank you.

i think hard line should like:

quantlib::timeseries<double> series(dates.begin(), dates.end(), quotes.begin());

from documentation linked:

template<class t, class container = std::map<date, t>> class quantlib::timeseries< t, container >;

the first parameter type store, in case double , sec 1 container used utilize implementation, , has default implementation, nil needed.

c++ class

No comments:

Post a Comment