@@ -61,7 +61,9 @@ namespace QuantLib {
6161 const ext::optional<Period>& tenor,
6262 const ext::optional<DateGeneration::Rule>& rule,
6363 const ext::optional<bool >& endOfMonth,
64- std::vector<bool > isRegular)
64+ std::vector<bool > isRegular,
65+ const bool removeFirstDate,
66+ const bool removeLastDate)
6567 : tenor_(tenor), calendar_(std::move(calendar)), convention_(convention),
6668 terminationDateConvention_ (terminationDateConvention), rule_(rule), dates_(dates),
6769 isRegular_(std::move(isRegular)) {
@@ -70,6 +72,12 @@ namespace QuantLib {
7072 endOfMonth_ = false ;
7173 else
7274 endOfMonth_ = endOfMonth;
75+
76+ if (removeFirstDate)
77+ dates_.erase (dates_.begin ());
78+
79+ if (removeLastDate)
80+ dates_.pop_back ();
7381
7482 QL_REQUIRE (isRegular_.empty () || isRegular_.size () == dates.size () - 1 ,
7583 " isRegular size (" << isRegular_.size ()
@@ -84,9 +92,11 @@ namespace QuantLib {
8492 BusinessDayConvention convention,
8593 BusinessDayConvention terminationDateConvention,
8694 DateGeneration::Rule rule,
87- bool endOfMonth,
95+ const bool endOfMonth,
8896 const Date& first,
89- const Date& nextToLast)
97+ const Date& nextToLast,
98+ const bool removeFirstDate,
99+ const bool removeLastDate)
90100 : tenor_(tenor), calendar_(std::move(cal)), convention_(convention),
91101 terminationDateConvention_(terminationDateConvention), rule_(rule),
92102 endOfMonth_(allowsEndOfMonth(tenor) ? endOfMonth : false),
@@ -458,6 +468,12 @@ namespace QuantLib {
458468 isRegular_.erase (isRegular_.begin ());
459469 }
460470
471+ if (removeFirstDate)
472+ dates_.erase (dates_.begin ());
473+
474+ if (removeLastDate)
475+ dates_.pop_back ();
476+
461477 QL_ENSURE (dates_.size ()>1 ,
462478 " degenerate single date (" << dates_[0 ] << " ) schedule" <<
463479 " \n seed date: " << seed <<
0 commit comments