I have code that multiplies 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 for date2, which is one year from the date. However, I cannot understand how this is achieved.
I thought this would not compile. Now I feel like I am flying to the "twelve months" object, which is then processed by overloading the QuantLib :: Date '+' operator, but I have never seen this before.
I came from C # background, so there might be something I don't know about here. Can anyone explain what is happening? Any background documentation would be appreciated.
source
share