|
From: jian Xu <jia...@gm...> - 2021-09-04 02:09:20
|
Hi,
This short function returns the business days from "from" to "to",
both are inclusive. Therefore, it should be allowed to call it with
from == to, or the condition in QL_REQUIRE should be to >= from,
instead of to > from. Am I correct? Thanks.
Jian
std::vector<Date> Calendar::businessDayList(
const Date& from, const Date& to) const {
QL_REQUIRE(to>from, "'from' date ("
<< from << ") must be earlier than 'to' date ("
<< to << ")");
std::vector<Date> result;
for (Date d = from; d <= to; ++d) {
if (isBusinessDay(d))
result.push_back(d);
}
return result;
|