How to convert among timeunits in Period object

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

How to convert among timeunits in Period object

amar singh

I have a vector of Period objects of different time units - months/years.

 How can I easily convert this to another vector of timelength in year?

eg. consider the following vector available:

 std::vector<Period> swaptionMaturities;
        swaptionMaturities.push_back(Period(1, Months));
        swaptionMaturities.push_back(Period(3, Months));
        swaptionMaturities.push_back(Period(6, Months));
        swaptionMaturities.push_back(Period(1, Years));
        swaptionMaturities.push_back(Period(2, Years));
        swaptionMaturities.push_back(Period(3, Years));
        swaptionMaturities.push_back(Period(4, Years));
        swaptionMaturities.push_back(Period(5, Years));
        swaptionMaturities.push_back(Period(7, Years));
        swaptionMaturities.push_back(Period(10, Years));

 
I want to have a vector
std::vector<Time> times;
 which has timeunits in year.
 
I looked at Period / Date Classes, but there does not seem to be any method for conversion.
 
 
Can someone please help?
 
Thanks ,
Amar


Do you Yahoo!?
Protect your identity with Yahoo! Mail AddressGuard