I have some code that is multiplying an enum by an integer:
QuantLib::Date date2 = date + 12 * QuantLib::Months;
Where QuantLib::Months is defined as:
enum TimeUnit { Days,
Weeks,
Months,
Years
};
This gives me the desired result of date2 being one year on from date. However, I'm not able to comprehend how this is being achieved.
I had thought that this would not compile. Now I feel that I'm arriving at a "twelve months" object, which the is then handled by the QuantLib::Date '+' operator overload, but I've never seen this style before.
I have come from a C# background, so there may be something I'm not aware of at work here. Can anyone explain what is going on? Any reference documentation would be appreciated.