From fdf79ccd9983ada65093a9aa8899949061914338 Mon Sep 17 00:00:00 2001 From: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Date: Fri, 5 Jun 2026 13:17:45 +0000 Subject: [PATCH 1/9] refactor(core): migrate ext::optional -> std::optional in settings/event/cashflow Co-Authored-By: Toby Drinkall --- ql/cashflow.cpp | 4 ++-- ql/cashflow.hpp | 2 +- ql/event.cpp | 2 +- ql/event.hpp | 2 +- ql/settings.hpp | 12 ++++++------ 5 files changed, 11 insertions(+), 11 deletions(-) diff --git a/ql/cashflow.cpp b/ql/cashflow.cpp index 80c9c767034..2da64b349dd 100644 --- a/ql/cashflow.cpp +++ b/ql/cashflow.cpp @@ -25,7 +25,7 @@ namespace QuantLib { bool CashFlow::hasOccurred(const Date& refDate, - ext::optional includeRefDate) const { + std::optional includeRefDate) const { // easy and quick handling of most cases if (refDate != Date()) { @@ -40,7 +40,7 @@ namespace QuantLib { refDate == Settings::instance().evaluationDate()) { // today's date; we override the bool with the one // specified in the settings (if any) - ext::optional includeToday = + std::optional includeToday = Settings::instance().includeTodaysCashFlows(); if (includeToday.has_value()) includeRefDate = includeToday; diff --git a/ql/cashflow.hpp b/ql/cashflow.hpp index 955bd0ad865..5fa349cac8b 100644 --- a/ql/cashflow.hpp +++ b/ql/cashflow.hpp @@ -49,7 +49,7 @@ namespace QuantLib { Settings::includeTodaysCashflows in account */ bool hasOccurred(const Date& refDate = Date(), - ext::optional includeRefDate = ext::nullopt) const override; + std::optional includeRefDate = std::nullopt) const override; //@} //! \name LazyObject interface //@{ diff --git a/ql/event.cpp b/ql/event.cpp index d4145a1eeb8..7836ed61c98 100644 --- a/ql/event.cpp +++ b/ql/event.cpp @@ -26,7 +26,7 @@ namespace QuantLib { bool Event::hasOccurred(const Date& d, // refDate - ext::optional includeRefDate) const { + std::optional includeRefDate) const { Date refDate = d != Date() ? d : Settings::instance().evaluationDate(); bool includeRefDateEvent = includeRefDate ? // NOLINT(readability-implicit-bool-conversion) diff --git a/ql/event.hpp b/ql/event.hpp index ad6001b616d..e360d49c4a0 100644 --- a/ql/event.hpp +++ b/ql/event.hpp @@ -52,7 +52,7 @@ namespace QuantLib { */ virtual bool hasOccurred( const Date& refDate = Date(), - ext::optional includeRefDate = ext::nullopt) const; + std::optional includeRefDate = std::nullopt) const; //@} //! \name Visitability diff --git a/ql/settings.hpp b/ql/settings.hpp index 8a730209142..41cb71d3144 100644 --- a/ql/settings.hpp +++ b/ql/settings.hpp @@ -102,8 +102,8 @@ namespace QuantLib { behavior chosen for includeReferenceDate. It cannot be overridden locally when calling the CashFlow::hasOccurred method. */ - ext::optional& includeTodaysCashFlows(); - ext::optional includeTodaysCashFlows() const; + std::optional& includeTodaysCashFlows(); + std::optional includeTodaysCashFlows() const; bool& enforcesTodaysHistoricFixings(); bool enforcesTodaysHistoricFixings() const; @@ -111,7 +111,7 @@ namespace QuantLib { private: DateProxy evaluationDate_; bool includeReferenceDateEvents_ = false; - ext::optional includeTodaysCashFlows_; + std::optional includeTodaysCashFlows_; bool enforcesTodaysHistoricFixings_ = false; }; @@ -124,7 +124,7 @@ namespace QuantLib { private: Date evaluationDate_; bool includeReferenceDateEvents_; - ext::optional includeTodaysCashFlows_; + std::optional includeTodaysCashFlows_; bool enforcesTodaysHistoricFixings_; }; @@ -160,11 +160,11 @@ namespace QuantLib { return includeReferenceDateEvents_; } - inline ext::optional& Settings::includeTodaysCashFlows() { + inline std::optional& Settings::includeTodaysCashFlows() { return includeTodaysCashFlows_; } - inline ext::optional Settings::includeTodaysCashFlows() const { + inline std::optional Settings::includeTodaysCashFlows() const { return includeTodaysCashFlows_; } From 9f86b555e8d976a6b8cf3d6af055a3b5dc918ebd Mon Sep 17 00:00:00 2001 From: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Date: Fri, 5 Jun 2026 13:17:45 +0000 Subject: [PATCH 2/9] refactor(cashflows): migrate ext::optional -> std::optional Co-Authored-By: Toby Drinkall --- ql/cashflows/cashflows.cpp | 88 ++++++++++++------------- ql/cashflows/cashflows.hpp | 86 ++++++++++++------------ ql/cashflows/couponpricer.cpp | 2 +- ql/cashflows/couponpricer.hpp | 4 +- ql/cashflows/iborcoupon.cpp | 2 +- ql/cashflows/iborcoupon.hpp | 4 +- ql/cashflows/overnightindexedcoupon.cpp | 2 +- ql/cashflows/overnightindexedcoupon.hpp | 4 +- 8 files changed, 96 insertions(+), 96 deletions(-) diff --git a/ql/cashflows/cashflows.cpp b/ql/cashflows/cashflows.cpp index 3e4da21601c..6686a8cbd0f 100644 --- a/ql/cashflows/cashflows.cpp +++ b/ql/cashflows/cashflows.cpp @@ -64,7 +64,7 @@ namespace QuantLib { } bool CashFlows::isExpired(const Leg& leg, - const ext::optional& includeSettlementDateFlows, + const std::optional& includeSettlementDateFlows, Date settlementDate) { if (leg.empty()) @@ -82,7 +82,7 @@ namespace QuantLib { Leg::const_reverse_iterator CashFlows::previousCashFlow(const Leg& leg, - const ext::optional& includeSettlementDateFlows, + const std::optional& includeSettlementDateFlows, Date settlementDate) { if (leg.empty()) return leg.rend(); @@ -100,7 +100,7 @@ namespace QuantLib { Leg::const_iterator CashFlows::nextCashFlow(const Leg& leg, - const ext::optional& includeSettlementDateFlows, + const std::optional& includeSettlementDateFlows, Date settlementDate) { if (leg.empty()) return leg.end(); @@ -117,7 +117,7 @@ namespace QuantLib { } Date CashFlows::previousCashFlowDate(const Leg& leg, - const ext::optional& includeSettlementDateFlows, + const std::optional& includeSettlementDateFlows, Date settlementDate) { Leg::const_reverse_iterator cf; cf = previousCashFlow(leg, includeSettlementDateFlows, settlementDate); @@ -129,7 +129,7 @@ namespace QuantLib { } Date CashFlows::nextCashFlowDate(const Leg& leg, - const ext::optional& includeSettlementDateFlows, + const std::optional& includeSettlementDateFlows, Date settlementDate) { Leg::const_iterator cf; cf = nextCashFlow(leg, includeSettlementDateFlows, settlementDate); @@ -141,7 +141,7 @@ namespace QuantLib { } Real CashFlows::previousCashFlowAmount(const Leg& leg, - const ext::optional& includeSettlementDateFlows, + const std::optional& includeSettlementDateFlows, Date settlementDate) { Leg::const_reverse_iterator cf; cf = previousCashFlow(leg, includeSettlementDateFlows, settlementDate); @@ -157,7 +157,7 @@ namespace QuantLib { } Real CashFlows::nextCashFlowAmount(const Leg& leg, - const ext::optional& includeSettlementDateFlows, + const std::optional& includeSettlementDateFlows, Date settlementDate) { Leg::const_iterator cf; cf = nextCashFlow(leg, includeSettlementDateFlows, settlementDate); @@ -212,7 +212,7 @@ namespace QuantLib { } // anonymous namespace ends here Rate CashFlows::previousCouponRate(const Leg& leg, - const ext::optional& includeSettlementDateFlows, + const std::optional& includeSettlementDateFlows, Date settlementDate) { Leg::const_reverse_iterator cf; cf = previousCashFlow(leg, includeSettlementDateFlows, settlementDate); @@ -221,7 +221,7 @@ namespace QuantLib { } Rate CashFlows::nextCouponRate(const Leg& leg, - const ext::optional& includeSettlementDateFlows, + const std::optional& includeSettlementDateFlows, Date settlementDate) { Leg::const_iterator cf; cf = nextCashFlow(leg, includeSettlementDateFlows, settlementDate); @@ -229,7 +229,7 @@ namespace QuantLib { } Real CashFlows::nominal(const Leg& leg, - const ext::optional& includeSettlementDateFlows, + const std::optional& includeSettlementDateFlows, Date settlementDate) { auto cf = nextCashFlow(leg, includeSettlementDateFlows, settlementDate); if (cf==leg.end()) return 0.0; @@ -244,7 +244,7 @@ namespace QuantLib { } Date CashFlows::accrualStartDate(const Leg& leg, - const ext::optional& includeSettlementDateFlows, + const std::optional& includeSettlementDateFlows, Date settlementDate) { auto cf = nextCashFlow(leg, includeSettlementDateFlows, settlementDate); if (cf==leg.end()) @@ -260,7 +260,7 @@ namespace QuantLib { } Date CashFlows::accrualEndDate(const Leg& leg, - const ext::optional& includeSettlementDateFlows, + const std::optional& includeSettlementDateFlows, Date settlementDate) { auto cf = nextCashFlow(leg, includeSettlementDateFlows, settlementDate); if (cf==leg.end()) @@ -276,7 +276,7 @@ namespace QuantLib { } Date CashFlows::referencePeriodStart(const Leg& leg, - const ext::optional& includeSettlementDateFlows, + const std::optional& includeSettlementDateFlows, Date settlementDate) { auto cf = nextCashFlow(leg, includeSettlementDateFlows, settlementDate); if (cf==leg.end()) @@ -292,7 +292,7 @@ namespace QuantLib { } Date CashFlows::referencePeriodEnd(const Leg& leg, - const ext::optional& includeSettlementDateFlows, + const std::optional& includeSettlementDateFlows, Date settlementDate) { auto cf = nextCashFlow(leg, includeSettlementDateFlows, settlementDate); if (cf==leg.end()) @@ -308,7 +308,7 @@ namespace QuantLib { } Time CashFlows::accrualPeriod(const Leg& leg, - const ext::optional& includeSettlementDateFlows, + const std::optional& includeSettlementDateFlows, Date settlementDate) { auto cf = nextCashFlow(leg, includeSettlementDateFlows, settlementDate); if (cf==leg.end()) return 0; @@ -323,7 +323,7 @@ namespace QuantLib { } Date::serial_type CashFlows::accrualDays(const Leg& leg, - const ext::optional& includeSettlementDateFlows, + const std::optional& includeSettlementDateFlows, Date settlementDate) { auto cf = nextCashFlow(leg, includeSettlementDateFlows, settlementDate); if (cf==leg.end()) return 0; @@ -338,7 +338,7 @@ namespace QuantLib { } Time CashFlows::accruedPeriod(const Leg& leg, - const ext::optional& includeSettlementDateFlows, + const std::optional& includeSettlementDateFlows, Date settlementDate) { if (settlementDate == Date()) settlementDate = Settings::instance().evaluationDate(); @@ -356,7 +356,7 @@ namespace QuantLib { } Date::serial_type CashFlows::accruedDays(const Leg& leg, - const ext::optional& includeSettlementDateFlows, + const std::optional& includeSettlementDateFlows, Date settlementDate) { if (settlementDate == Date()) settlementDate = Settings::instance().evaluationDate(); @@ -374,7 +374,7 @@ namespace QuantLib { } Real CashFlows::accruedAmount(const Leg& leg, - const ext::optional& includeSettlementDateFlows, + const std::optional& includeSettlementDateFlows, Date settlementDate) { if (settlementDate == Date()) settlementDate = Settings::instance().evaluationDate(); @@ -423,7 +423,7 @@ namespace QuantLib { Real CashFlows::npv(const Leg& leg, const YieldTermStructure& discountCurve, - const ext::optional& includeSettlementDateFlows, + const std::optional& includeSettlementDateFlows, Date settlementDate, Date npvDate) { @@ -448,7 +448,7 @@ namespace QuantLib { Real CashFlows::bps(const Leg& leg, const YieldTermStructure& discountCurve, - const ext::optional& includeSettlementDateFlows, + const std::optional& includeSettlementDateFlows, Date settlementDate, Date npvDate) { if (leg.empty()) @@ -471,7 +471,7 @@ namespace QuantLib { std::pair CashFlows::npvbps(const Leg& leg, const YieldTermStructure& discountCurve, - const ext::optional& includeSettlementDateFlows, + const std::optional& includeSettlementDateFlows, Date settlementDate, Date npvDate) { Real npv = 0.0; @@ -508,7 +508,7 @@ namespace QuantLib { Rate CashFlows::atmRate(const Leg& leg, const YieldTermStructure& discountCurve, - const ext::optional& includeSettlementDateFlows, + const std::optional& includeSettlementDateFlows, Date settlementDate, Date npvDate, Real targetNpv) { @@ -601,7 +601,7 @@ namespace QuantLib { Real simpleDuration(const Leg& leg, const InterestRate& y, - const ext::optional& includeSettlementDateFlows, + const std::optional& includeSettlementDateFlows, Date settlementDate, Date npvDate) { if (leg.empty()) @@ -641,7 +641,7 @@ namespace QuantLib { Real modifiedDuration(const Leg& leg, const InterestRate& y, - const ext::optional& includeSettlementDateFlows, + const std::optional& includeSettlementDateFlows, Date settlementDate, Date npvDate) { if (leg.empty()) @@ -708,7 +708,7 @@ namespace QuantLib { Real macaulayDuration(const Leg& leg, const InterestRate& y, - const ext::optional& includeSettlementDateFlows, + const std::optional& includeSettlementDateFlows, Date settlementDate, Date npvDate) { @@ -735,7 +735,7 @@ namespace QuantLib { DayCounter dayCounter, Compounding comp, Frequency freq, - const ext::optional& includeSettlementDateFlows, + const std::optional& includeSettlementDateFlows, Date settlementDate, Date npvDate) : leg_(leg), npv_(npv), dayCounter_(std::move(dayCounter)), compounding_(comp), @@ -812,7 +812,7 @@ namespace QuantLib { Real CashFlows::npv(const Leg& leg, const InterestRate& y, - const ext::optional& includeSettlementDateFlows, + const std::optional& includeSettlementDateFlows, Date settlementDate, Date npvDate) { @@ -859,7 +859,7 @@ namespace QuantLib { const DayCounter& dc, Compounding comp, Frequency freq, - const ext::optional& includeSettlementDateFlows, + const std::optional& includeSettlementDateFlows, Date settlementDate, Date npvDate) { return npv(leg, InterestRate(yield, dc, comp, freq), @@ -869,7 +869,7 @@ namespace QuantLib { Real CashFlows::bps(const Leg& leg, const InterestRate& yield, - const ext::optional& includeSettlementDateFlows, + const std::optional& includeSettlementDateFlows, Date settlementDate, Date npvDate) { @@ -894,7 +894,7 @@ namespace QuantLib { const DayCounter& dc, Compounding comp, Frequency freq, - const ext::optional& includeSettlementDateFlows, + const std::optional& includeSettlementDateFlows, Date settlementDate, Date npvDate) { return bps(leg, InterestRate(yield, dc, comp, freq), @@ -907,7 +907,7 @@ namespace QuantLib { const DayCounter& dayCounter, Compounding compounding, Frequency frequency, - const ext::optional& includeSettlementDateFlows, + const std::optional& includeSettlementDateFlows, Date settlementDate, Date npvDate, Real accuracy, @@ -926,7 +926,7 @@ namespace QuantLib { Time CashFlows::duration(const Leg& leg, const InterestRate& rate, Duration::Type type, - const ext::optional& includeSettlementDateFlows, + const std::optional& includeSettlementDateFlows, Date settlementDate, Date npvDate) { @@ -963,7 +963,7 @@ namespace QuantLib { Compounding comp, Frequency freq, Duration::Type type, - const ext::optional& includeSettlementDateFlows, + const std::optional& includeSettlementDateFlows, Date settlementDate, Date npvDate) { return duration(leg, InterestRate(yield, dc, comp, freq), @@ -974,7 +974,7 @@ namespace QuantLib { Real CashFlows::convexity(const Leg& leg, const InterestRate& y, - const ext::optional& includeSettlementDateFlows, + const std::optional& includeSettlementDateFlows, Date settlementDate, Date npvDate) { if (leg.empty()) @@ -1048,7 +1048,7 @@ namespace QuantLib { const DayCounter& dc, Compounding comp, Frequency freq, - const ext::optional& includeSettlementDateFlows, + const std::optional& includeSettlementDateFlows, Date settlementDate, Date npvDate) { return convexity(leg, InterestRate(yield, dc, comp, freq), @@ -1058,7 +1058,7 @@ namespace QuantLib { Real CashFlows::basisPointValue(const Leg& leg, const InterestRate& y, - const ext::optional& includeSettlementDateFlows, + const std::optional& includeSettlementDateFlows, Date settlementDate, Date npvDate) { if (leg.empty()) @@ -1095,7 +1095,7 @@ namespace QuantLib { const DayCounter& dc, Compounding comp, Frequency freq, - const ext::optional& includeSettlementDateFlows, + const std::optional& includeSettlementDateFlows, Date settlementDate, Date npvDate) { return basisPointValue(leg, InterestRate(yield, dc, comp, freq), @@ -1105,7 +1105,7 @@ namespace QuantLib { Real CashFlows::yieldValueBasisPoint(const Leg& leg, const InterestRate& y, - const ext::optional& includeSettlementDateFlows, + const std::optional& includeSettlementDateFlows, Date settlementDate, Date npvDate) { if (leg.empty()) @@ -1134,7 +1134,7 @@ namespace QuantLib { const DayCounter& dc, Compounding comp, Frequency freq, - const ext::optional& includeSettlementDateFlows, + const std::optional& includeSettlementDateFlows, Date settlementDate, Date npvDate) { return yieldValueBasisPoint(leg, InterestRate(yield, dc, comp, freq), @@ -1148,7 +1148,7 @@ namespace QuantLib { Spread zSpread, Compounding comp, Frequency freq, - const ext::optional& includeSettlementDateFlows, + const std::optional& includeSettlementDateFlows, Date settlementDate, Date npvDate) { @@ -1180,7 +1180,7 @@ namespace QuantLib { const DayCounter&, Compounding comp, Frequency freq, - const ext::optional& includeSettlementDateFlows, + const std::optional& includeSettlementDateFlows, Date settlementDate, Date npvDate) { return CashFlows::npv(leg, discountCurve, zSpread, comp, freq, @@ -1192,7 +1192,7 @@ namespace QuantLib { const ext::shared_ptr& discount, Compounding compounding, Frequency frequency, - const ext::optional& includeSettlementDateFlows, + const std::optional& includeSettlementDateFlows, Date settlementDate, Date npvDate, Real accuracy, @@ -1230,7 +1230,7 @@ namespace QuantLib { const DayCounter&, Compounding compounding, Frequency frequency, - const ext::optional& includeSettlementDateFlows, + const std::optional& includeSettlementDateFlows, Date settlementDate, Date npvDate, Real accuracy, diff --git a/ql/cashflows/cashflows.hpp b/ql/cashflows/cashflows.hpp index 43b661f9cb7..5a094004c1e 100644 --- a/ql/cashflows/cashflows.hpp +++ b/ql/cashflows/cashflows.hpp @@ -47,7 +47,7 @@ namespace QuantLib { DayCounter dayCounter, Compounding comp, Frequency freq, - const ext::optional& includeSettlementDateFlows, + const std::optional& includeSettlementDateFlows, Date settlementDate, Date npvDate); @@ -61,7 +61,7 @@ namespace QuantLib { DayCounter dayCounter_; Compounding compounding_; Frequency frequency_; - ext::optional includeSettlementDateFlows_; + std::optional includeSettlementDateFlows_; Date settlementDate_, npvDate_; }; public: @@ -77,7 +77,7 @@ namespace QuantLib { static Date startDate(const Leg& leg); static Date maturityDate(const Leg& leg); static bool isExpired(const Leg& leg, - const ext::optional& includeSettlementDateFlows = ext::nullopt, + const std::optional& includeSettlementDateFlows = std::nullopt, Date settlementDate = Date()); //@} @@ -86,28 +86,28 @@ namespace QuantLib { //! the last cashflow paying before or at the given date static Leg::const_reverse_iterator previousCashFlow(const Leg& leg, - const ext::optional& includeSettlementDateFlows = ext::nullopt, + const std::optional& includeSettlementDateFlows = std::nullopt, Date settlementDate = Date()); //! the first cashflow paying after the given date static Leg::const_iterator nextCashFlow(const Leg& leg, - const ext::optional& includeSettlementDateFlows = ext::nullopt, + const std::optional& includeSettlementDateFlows = std::nullopt, Date settlementDate = Date()); static Date previousCashFlowDate(const Leg& leg, - const ext::optional& includeSettlementDateFlows = ext::nullopt, + const std::optional& includeSettlementDateFlows = std::nullopt, Date settlementDate = Date()); static Date nextCashFlowDate(const Leg& leg, - const ext::optional& includeSettlementDateFlows = ext::nullopt, + const std::optional& includeSettlementDateFlows = std::nullopt, Date settlementDate = Date()); static Real previousCashFlowAmount(const Leg& leg, - const ext::optional& includeSettlementDateFlows = ext::nullopt, + const std::optional& includeSettlementDateFlows = std::nullopt, Date settlementDate = Date()); static Real nextCashFlowAmount(const Leg& leg, - const ext::optional& includeSettlementDateFlows = ext::nullopt, + const std::optional& includeSettlementDateFlows = std::nullopt, Date settlementDate = Date()); //@} @@ -115,52 +115,52 @@ namespace QuantLib { //@{ static Rate previousCouponRate(const Leg& leg, - const ext::optional& includeSettlementDateFlows = ext::nullopt, + const std::optional& includeSettlementDateFlows = std::nullopt, Date settlementDate = Date()); static Rate nextCouponRate(const Leg& leg, - const ext::optional& includeSettlementDateFlows = ext::nullopt, + const std::optional& includeSettlementDateFlows = std::nullopt, Date settlementDate = Date()); static Real nominal(const Leg& leg, - const ext::optional& includeSettlementDateFlows = ext::nullopt, + const std::optional& includeSettlementDateFlows = std::nullopt, Date settlementDate = Date()); static Date accrualStartDate(const Leg& leg, - const ext::optional& includeSettlementDateFlows = ext::nullopt, + const std::optional& includeSettlementDateFlows = std::nullopt, Date settlementDate = Date()); static Date accrualEndDate(const Leg& leg, - const ext::optional& includeSettlementDateFlows = ext::nullopt, + const std::optional& includeSettlementDateFlows = std::nullopt, Date settlementDate = Date()); static Date referencePeriodStart(const Leg& leg, - const ext::optional& includeSettlementDateFlows = ext::nullopt, + const std::optional& includeSettlementDateFlows = std::nullopt, Date settlementDate = Date()); static Date referencePeriodEnd(const Leg& leg, - const ext::optional& includeSettlementDateFlows = ext::nullopt, + const std::optional& includeSettlementDateFlows = std::nullopt, Date settlementDate = Date()); static Time accrualPeriod(const Leg& leg, - const ext::optional& includeSettlementDateFlows = ext::nullopt, + const std::optional& includeSettlementDateFlows = std::nullopt, Date settlementDate = Date()); static Date::serial_type accrualDays(const Leg& leg, - const ext::optional& includeSettlementDateFlows = ext::nullopt, + const std::optional& includeSettlementDateFlows = std::nullopt, Date settlementDate = Date()); static Time accruedPeriod(const Leg& leg, - const ext::optional& includeSettlementDateFlows = ext::nullopt, + const std::optional& includeSettlementDateFlows = std::nullopt, Date settlementDate = Date()); static Date::serial_type accruedDays(const Leg& leg, - const ext::optional& includeSettlementDateFlows = ext::nullopt, + const std::optional& includeSettlementDateFlows = std::nullopt, Date settlementDate = Date()); static Real accruedAmount(const Leg& leg, - const ext::optional& includeSettlementDateFlows = ext::nullopt, + const std::optional& includeSettlementDateFlows = std::nullopt, Date settlementDate = Date()); //@} @@ -172,7 +172,7 @@ namespace QuantLib { */ static Real npv(const Leg& leg, const YieldTermStructure& discountCurve, - const ext::optional& includeSettlementDateFlows = ext::nullopt, + const std::optional& includeSettlementDateFlows = std::nullopt, Date settlementDate = Date(), Date npvDate = Date()); //! Basis-point sensitivity of the cash flows. @@ -183,7 +183,7 @@ namespace QuantLib { */ static Real bps(const Leg& leg, const YieldTermStructure& discountCurve, - const ext::optional& includeSettlementDateFlows = ext::nullopt, + const std::optional& includeSettlementDateFlows = std::nullopt, Date settlementDate = Date(), Date npvDate = Date()); @@ -193,7 +193,7 @@ namespace QuantLib { */ static std::pair npvbps(const Leg& leg, const YieldTermStructure& discountCurve, - const ext::optional& includeSettlementDateFlows = ext::nullopt, + const std::optional& includeSettlementDateFlows = std::nullopt, Date settlementDate = Date(), Date npvDate = Date()); @@ -205,7 +205,7 @@ namespace QuantLib { */ static Rate atmRate(const Leg& leg, const YieldTermStructure& discountCurve, - const ext::optional& includeSettlementDateFlows = ext::nullopt, + const std::optional& includeSettlementDateFlows = std::nullopt, Date settlementDate = Date(), Date npvDate = Date(), Real npv = Null()); @@ -224,7 +224,7 @@ namespace QuantLib { */ static Real npv(const Leg& leg, const InterestRate& yield, - const ext::optional& includeSettlementDateFlows = ext::nullopt, + const std::optional& includeSettlementDateFlows = std::nullopt, Date settlementDate = Date(), Date npvDate = Date()); static Real npv(const Leg& leg, @@ -232,7 +232,7 @@ namespace QuantLib { const DayCounter& dayCounter, Compounding compounding, Frequency frequency, - const ext::optional& includeSettlementDateFlows = ext::nullopt, + const std::optional& includeSettlementDateFlows = std::nullopt, Date settlementDate = Date(), Date npvDate = Date()); //! Basis-point sensitivity of the cash flows. @@ -245,7 +245,7 @@ namespace QuantLib { */ static Real bps(const Leg& leg, const InterestRate& yield, - const ext::optional& includeSettlementDateFlows = ext::nullopt, + const std::optional& includeSettlementDateFlows = std::nullopt, Date settlementDate = Date(), Date npvDate = Date()); static Real bps(const Leg& leg, @@ -253,7 +253,7 @@ namespace QuantLib { const DayCounter& dayCounter, Compounding compounding, Frequency frequency, - const ext::optional& includeSettlementDateFlows = ext::nullopt, + const std::optional& includeSettlementDateFlows = std::nullopt, Date settlementDate = Date(), Date npvDate = Date()); //! Implied internal rate of return. @@ -266,7 +266,7 @@ namespace QuantLib { const DayCounter& dayCounter, Compounding compounding, Frequency frequency, - const ext::optional& includeSettlementDateFlows = ext::nullopt, + const std::optional& includeSettlementDateFlows = std::nullopt, Date settlementDate = Date(), Date npvDate = Date(), Real accuracy = 1.0e-10, @@ -280,7 +280,7 @@ namespace QuantLib { const DayCounter& dayCounter, Compounding compounding, Frequency frequency, - const ext::optional& includeSettlementDateFlows = ext::nullopt, + const std::optional& includeSettlementDateFlows = std::nullopt, Date settlementDate = Date(), Date npvDate = Date(), Real accuracy = 1.0e-10, @@ -318,7 +318,7 @@ namespace QuantLib { static Time duration(const Leg& leg, const InterestRate& yield, Duration::Type type, - const ext::optional& includeSettlementDateFlows = ext::nullopt, + const std::optional& includeSettlementDateFlows = std::nullopt, Date settlementDate = Date(), Date npvDate = Date()); static Time duration(const Leg& leg, @@ -327,7 +327,7 @@ namespace QuantLib { Compounding compounding, Frequency frequency, Duration::Type type, - const ext::optional& includeSettlementDateFlows = ext::nullopt, + const std::optional& includeSettlementDateFlows = std::nullopt, Date settlementDate = Date(), Date npvDate = Date()); @@ -341,7 +341,7 @@ namespace QuantLib { */ static Real convexity(const Leg& leg, const InterestRate& yield, - const ext::optional& includeSettlementDateFlows = ext::nullopt, + const std::optional& includeSettlementDateFlows = std::nullopt, Date settlementDate = Date(), Date npvDate = Date()); static Real convexity(const Leg& leg, @@ -349,7 +349,7 @@ namespace QuantLib { const DayCounter& dayCounter, Compounding compounding, Frequency frequency, - const ext::optional& includeSettlementDateFlows = ext::nullopt, + const std::optional& includeSettlementDateFlows = std::nullopt, Date settlementDate = Date(), Date npvDate = Date()); @@ -359,7 +359,7 @@ namespace QuantLib { */ static Real basisPointValue(const Leg& leg, const InterestRate& yield, - const ext::optional& includeSettlementDateFlows = ext::nullopt, + const std::optional& includeSettlementDateFlows = std::nullopt, Date settlementDate = Date(), Date npvDate = Date()); static Real basisPointValue(const Leg& leg, @@ -367,7 +367,7 @@ namespace QuantLib { const DayCounter& dayCounter, Compounding compounding, Frequency frequency, - const ext::optional& includeSettlementDateFlows = ext::nullopt, + const std::optional& includeSettlementDateFlows = std::nullopt, Date settlementDate = Date(), Date npvDate = Date()); @@ -378,7 +378,7 @@ namespace QuantLib { */ static Real yieldValueBasisPoint(const Leg& leg, const InterestRate& yield, - const ext::optional& includeSettlementDateFlows = ext::nullopt, + const std::optional& includeSettlementDateFlows = std::nullopt, Date settlementDate = Date(), Date npvDate = Date()); static Real yieldValueBasisPoint(const Leg& leg, @@ -386,7 +386,7 @@ namespace QuantLib { const DayCounter& dayCounter, Compounding compounding, Frequency frequency, - const ext::optional& includeSettlementDateFlows = ext::nullopt, + const std::optional& includeSettlementDateFlows = std::nullopt, Date settlementDate = Date(), Date npvDate = Date()); //@} @@ -407,7 +407,7 @@ namespace QuantLib { Spread zSpread, Compounding compounding, Frequency frequency, - const ext::optional& includeSettlementDateFlows = ext::nullopt, + const std::optional& includeSettlementDateFlows = std::nullopt, Date settlementDate = Date(), Date npvDate = Date()); /*! \deprecated Use the overload without a day counter. @@ -420,7 +420,7 @@ namespace QuantLib { const DayCounter& dayCounter, Compounding compounding, Frequency frequency, - const ext::optional& includeSettlementDateFlows = ext::nullopt, + const std::optional& includeSettlementDateFlows = std::nullopt, Date settlementDate = Date(), Date npvDate = Date()); //! implied Z-spread. @@ -429,7 +429,7 @@ namespace QuantLib { const ext::shared_ptr&, Compounding compounding, Frequency frequency, - const ext::optional& includeSettlementDateFlows = ext::nullopt, + const std::optional& includeSettlementDateFlows = std::nullopt, Date settlementDate = Date(), Date npvDate = Date(), Real accuracy = 1.0e-10, @@ -445,7 +445,7 @@ namespace QuantLib { const DayCounter& dayCounter, Compounding compounding, Frequency frequency, - const ext::optional& includeSettlementDateFlows = ext::nullopt, + const std::optional& includeSettlementDateFlows = std::nullopt, Date settlementDate = Date(), Date npvDate = Date(), Real accuracy = 1.0e-10, diff --git a/ql/cashflows/couponpricer.cpp b/ql/cashflows/couponpricer.cpp index dcd1288d383..ca13de85c81 100644 --- a/ql/cashflows/couponpricer.cpp +++ b/ql/cashflows/couponpricer.cpp @@ -45,7 +45,7 @@ namespace QuantLib { IborCouponPricer::IborCouponPricer( Handle v, - ext::optional useIndexedCoupon) + std::optional useIndexedCoupon) : capletVol_(std::move(v)), useIndexedCoupon_(useIndexedCoupon ? *useIndexedCoupon : diff --git a/ql/cashflows/couponpricer.hpp b/ql/cashflows/couponpricer.hpp index 15b54de0056..b06e4bed72f 100644 --- a/ql/cashflows/couponpricer.hpp +++ b/ql/cashflows/couponpricer.hpp @@ -67,7 +67,7 @@ namespace QuantLib { public: explicit IborCouponPricer( Handle v = Handle(), - ext::optional useIndexedCoupon = ext::nullopt); + std::optional useIndexedCoupon = std::nullopt); bool useIndexedCoupon() const { return useIndexedCoupon_; } @@ -115,7 +115,7 @@ namespace QuantLib { const Handle& v = Handle(), const TimingAdjustment timingAdjustment = Black76, Handle correlation = Handle(ext::shared_ptr(new SimpleQuote(1.0))), - const ext::optional useIndexedCoupon = ext::nullopt) + const std::optional useIndexedCoupon = std::nullopt) : IborCouponPricer(v, useIndexedCoupon), timingAdjustment_(timingAdjustment), correlation_(std::move(correlation)) { { // this additional scope seems required to avoid a misleading-indentation warning diff --git a/ql/cashflows/iborcoupon.cpp b/ql/cashflows/iborcoupon.cpp index 2fb79e2ec1b..c5989ad63e2 100644 --- a/ql/cashflows/iborcoupon.cpp +++ b/ql/cashflows/iborcoupon.cpp @@ -264,7 +264,7 @@ namespace QuantLib { return *this; } - IborLeg& IborLeg::withIndexedCoupons(ext::optional b) { + IborLeg& IborLeg::withIndexedCoupons(std::optional b) { useIndexedCoupons_ = b; return *this; } diff --git a/ql/cashflows/iborcoupon.hpp b/ql/cashflows/iborcoupon.hpp index 7b376d23a30..420ae78f4fe 100644 --- a/ql/cashflows/iborcoupon.hpp +++ b/ql/cashflows/iborcoupon.hpp @@ -159,7 +159,7 @@ namespace QuantLib { BusinessDayConvention, bool endOfMonth = false); IborLeg& withFixingConvention(BusinessDayConvention); - IborLeg& withIndexedCoupons(ext::optional b = true); + IborLeg& withIndexedCoupons(std::optional b = true); IborLeg& withAtParCoupons(bool b = true); operator Leg() const; @@ -181,7 +181,7 @@ namespace QuantLib { Calendar exCouponCalendar_; BusinessDayConvention exCouponAdjustment_ = Unadjusted; bool exCouponEndOfMonth_ = false; - ext::optional useIndexedCoupons_; + std::optional useIndexedCoupons_; }; } diff --git a/ql/cashflows/overnightindexedcoupon.cpp b/ql/cashflows/overnightindexedcoupon.cpp index 38695951195..68c16ba32cb 100644 --- a/ql/cashflows/overnightindexedcoupon.cpp +++ b/ql/cashflows/overnightindexedcoupon.cpp @@ -523,7 +523,7 @@ namespace QuantLib { return *this; } - OvernightLeg& OvernightLeg::withLastRecentPeriod(const ext::optional& lastRecentPeriod) { + OvernightLeg& OvernightLeg::withLastRecentPeriod(const std::optional& lastRecentPeriod) { lastRecentPeriod_ = lastRecentPeriod; return *this; } diff --git a/ql/cashflows/overnightindexedcoupon.hpp b/ql/cashflows/overnightindexedcoupon.hpp index cf365e10748..a43fb2a21eb 100644 --- a/ql/cashflows/overnightindexedcoupon.hpp +++ b/ql/cashflows/overnightindexedcoupon.hpp @@ -235,7 +235,7 @@ namespace QuantLib { OvernightLeg& withNakedOption(bool nakedOption); OvernightLeg& withDailyCapFloor(bool dailyCapFloor = true); OvernightLeg& inArrears(bool inArrears); - OvernightLeg& withLastRecentPeriod(const ext::optional& lastRecentPeriod); + OvernightLeg& withLastRecentPeriod(const std::optional& lastRecentPeriod); OvernightLeg& withLastRecentPeriodCalendar(const Calendar& lastRecentPeriodCalendar); OvernightLeg& withPaymentDates(const std::vector& paymentDates); OvernightLeg& withCouponPricer(const ext::shared_ptr& couponPricer); @@ -261,7 +261,7 @@ namespace QuantLib { bool nakedOption_ = false; bool dailyCapFloor_ = false; bool inArrears_ = true; - ext::optional lastRecentPeriod_; + std::optional lastRecentPeriod_; Calendar lastRecentPeriodCalendar_; std::vector paymentDates_; ext::shared_ptr couponPricer_; From f7b15b01a212bbe22c71ec2e44725d732bcdc6cb Mon Sep 17 00:00:00 2001 From: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Date: Fri, 5 Jun 2026 13:17:46 +0000 Subject: [PATCH 3/9] refactor(instruments): migrate ext::optional -> std::optional Co-Authored-By: Toby Drinkall --- ql/instruments/bond.cpp | 2 +- ql/instruments/callabilityschedule.hpp | 2 +- ql/instruments/creditdefaultswap.cpp | 8 ++++---- ql/instruments/creditdefaultswap.hpp | 6 +++--- ql/instruments/fixedvsfloatingswap.cpp | 2 +- ql/instruments/fixedvsfloatingswap.hpp | 2 +- ql/instruments/floatfloatswap.cpp | 12 ++++++------ ql/instruments/floatfloatswap.hpp | 12 ++++++------ ql/instruments/makecds.hpp | 6 +++--- ql/instruments/makeois.hpp | 2 +- ql/instruments/makeswaption.cpp | 2 +- ql/instruments/makeswaption.hpp | 4 ++-- ql/instruments/makevanillaswap.cpp | 2 +- ql/instruments/makevanillaswap.hpp | 8 ++++---- ql/instruments/multipleresetsswap.cpp | 2 +- ql/instruments/multipleresetsswap.hpp | 2 +- ql/instruments/nonstandardswap.cpp | 4 ++-- ql/instruments/nonstandardswap.hpp | 4 ++-- ql/instruments/overnightindexedswap.cpp | 2 +- ql/instruments/vanillaswap.cpp | 4 ++-- ql/instruments/vanillaswap.hpp | 4 ++-- 21 files changed, 46 insertions(+), 46 deletions(-) diff --git a/ql/instruments/bond.cpp b/ql/instruments/bond.cpp index 48bfd4de9b1..5f27473efdf 100644 --- a/ql/instruments/bond.cpp +++ b/ql/instruments/bond.cpp @@ -106,7 +106,7 @@ namespace QuantLib { // BondFunctions. We pass nullopt as includeSettlementDateFlows // so that CashFlows::isExpired uses the default setting. return CashFlows::isExpired(cashflows_, - ext::nullopt, + std::nullopt, Settings::instance().evaluationDate()); } diff --git a/ql/instruments/callabilityschedule.hpp b/ql/instruments/callabilityschedule.hpp index 179fc619f6d..3f52566fb39 100644 --- a/ql/instruments/callabilityschedule.hpp +++ b/ql/instruments/callabilityschedule.hpp @@ -57,7 +57,7 @@ namespace QuantLib { void accept(AcyclicVisitor&) override; //@} private: - ext::optional price_; + std::optional price_; Type type_; Date date_; }; diff --git a/ql/instruments/creditdefaultswap.cpp b/ql/instruments/creditdefaultswap.cpp index eb226728336..f4f0b37c4ca 100644 --- a/ql/instruments/creditdefaultswap.cpp +++ b/ql/instruments/creditdefaultswap.cpp @@ -50,7 +50,7 @@ namespace QuantLib { const bool rebatesAccrual, const Date& tradeDate, Natural cashSettlementDays) - : side_(side), notional_(notional), upfront_(ext::nullopt), runningSpread_(spread), + : side_(side), notional_(notional), upfront_(std::nullopt), runningSpread_(spread), settlesAccrual_(settlesAccrual), paysAtDefaultTime_(paysAtDefaultTime), claim_(std::move(claim)), protectionStart_(protectionStart == Date() ? schedule[0] : protectionStart), @@ -187,7 +187,7 @@ namespace QuantLib { return runningSpread_; } - ext::optional CreditDefaultSwap::upfront() const { + std::optional CreditDefaultSwap::upfront() const { return upfront_; } @@ -361,7 +361,7 @@ namespace QuantLib { case ISDA: engine = ext::make_shared( probability, recoveryRate, discountCurve, - ext::nullopt, + std::nullopt, IsdaCdsEngine::Taylor, IsdaCdsEngine::HalfDayBias, IsdaCdsEngine::Piecewise); @@ -402,7 +402,7 @@ namespace QuantLib { case ISDA: engine = ext::make_shared( probability, conventionalRecovery, discountCurve, - ext::nullopt, + std::nullopt, IsdaCdsEngine::Taylor, IsdaCdsEngine::HalfDayBias, IsdaCdsEngine::Piecewise); diff --git a/ql/instruments/creditdefaultswap.hpp b/ql/instruments/creditdefaultswap.hpp index 1b57b826bb9..17eecbbe90c 100644 --- a/ql/instruments/creditdefaultswap.hpp +++ b/ql/instruments/creditdefaultswap.hpp @@ -176,7 +176,7 @@ namespace QuantLib { Protection::Side side() const; Real notional() const; Rate runningSpread() const; - ext::optional upfront() const; + std::optional upfront() const; bool settlesAccrual() const; bool paysAtDefaultTime() const; const Leg& coupons() const; @@ -282,7 +282,7 @@ namespace QuantLib { // data members Protection::Side side_; Real notional_; - ext::optional upfront_; + std::optional upfront_; Rate runningSpread_; bool settlesAccrual_, paysAtDefaultTime_; ext::shared_ptr claim_; @@ -314,7 +314,7 @@ namespace QuantLib { arguments(); Protection::Side side; Real notional; - ext::optional upfront; + std::optional upfront; Rate spread; Leg leg; // if not initialized by constructors means theres no flows. diff --git a/ql/instruments/fixedvsfloatingswap.cpp b/ql/instruments/fixedvsfloatingswap.cpp index e9042e5d378..0847b45039c 100644 --- a/ql/instruments/fixedvsfloatingswap.cpp +++ b/ql/instruments/fixedvsfloatingswap.cpp @@ -40,7 +40,7 @@ namespace QuantLib { ext::shared_ptr iborIndex, Spread spread, DayCounter floatingDayCount, - ext::optional paymentConvention, + std::optional paymentConvention, Integer paymentLag, const Calendar& paymentCalendar) : Swap(2), type_(type), fixedNominals_(std::move(fixedNominals)), fixedSchedule_(std::move(fixedSchedule)), diff --git a/ql/instruments/fixedvsfloatingswap.hpp b/ql/instruments/fixedvsfloatingswap.hpp index cc61734154c..e1b38a598e6 100644 --- a/ql/instruments/fixedvsfloatingswap.hpp +++ b/ql/instruments/fixedvsfloatingswap.hpp @@ -63,7 +63,7 @@ namespace QuantLib { ext::shared_ptr iborIndex, Spread spread, DayCounter floatingDayCount, - ext::optional paymentConvention = ext::nullopt, + std::optional paymentConvention = std::nullopt, Integer paymentLag = 0, const Calendar& paymentCalendar = Calendar()); //! \name Inspectors diff --git a/ql/instruments/floatfloatswap.cpp b/ql/instruments/floatfloatswap.cpp index 6fcfb2279c6..65bc64e7ced 100644 --- a/ql/instruments/floatfloatswap.cpp +++ b/ql/instruments/floatfloatswap.cpp @@ -53,8 +53,8 @@ namespace QuantLib { const Real spread2, const Real cappedRate2, const Real flooredRate2, - const ext::optional& paymentConvention1, - const ext::optional& paymentConvention2) + const std::optional& paymentConvention1, + const std::optional& paymentConvention2) : Swap(2), type_(type), nominal1_(std::vector(schedule1.size() - 1, nominal1)), nominal2_(std::vector(schedule2.size() - 1, nominal2)), schedule1_(std::move(schedule1)), schedule2_(std::move(schedule2)), @@ -93,8 +93,8 @@ namespace QuantLib { std::vector spread2, std::vector cappedRate2, std::vector flooredRate2, - const ext::optional& paymentConvention1, - const ext::optional& paymentConvention2) + const std::optional& paymentConvention1, + const std::optional& paymentConvention2) : Swap(2), type_(type), nominal1_(std::move(nominal1)), nominal2_(std::move(nominal2)), schedule1_(std::move(schedule1)), schedule2_(std::move(schedule2)), index1_(std::move(index1)), index2_(std::move(index2)), gearing1_(std::move(gearing1)), @@ -109,8 +109,8 @@ namespace QuantLib { } void FloatFloatSwap::init( - ext::optional paymentConvention1, - ext::optional paymentConvention2) { + std::optional paymentConvention1, + std::optional paymentConvention2) { QL_REQUIRE(nominal1_.size() == schedule1_.size() - 1, "nominal1 size (" << nominal1_.size() diff --git a/ql/instruments/floatfloatswap.hpp b/ql/instruments/floatfloatswap.hpp index ebdd8cd11bd..9a1b779f320 100644 --- a/ql/instruments/floatfloatswap.hpp +++ b/ql/instruments/floatfloatswap.hpp @@ -65,8 +65,8 @@ namespace QuantLib { Real spread2 = 0.0, Real cappedRate2 = Null(), Real flooredRate2 = Null(), - const ext::optional& paymentConvention1 = ext::nullopt, - const ext::optional& paymentConvention2 = ext::nullopt); + const std::optional& paymentConvention1 = std::nullopt, + const std::optional& paymentConvention2 = std::nullopt); FloatFloatSwap( Swap::Type type, @@ -88,8 +88,8 @@ namespace QuantLib { std::vector spread2 = std::vector(), std::vector cappedRate2 = std::vector(), std::vector flooredRate2 = std::vector(), - const ext::optional& paymentConvention1 = ext::nullopt, - const ext::optional& paymentConvention2 = ext::nullopt); + const std::optional& paymentConvention1 = std::nullopt, + const std::optional& paymentConvention2 = std::nullopt); //! \name Inspectors //@{ @@ -134,8 +134,8 @@ namespace QuantLib { void fetchResults(const PricingEngine::results*) const override; private: - void init(ext::optional paymentConvention1, - ext::optional paymentConvention2); + void init(std::optional paymentConvention1, + std::optional paymentConvention2); void setupExpired() const override; Swap::Type type_; std::vector nominal1_, nominal2_; diff --git a/ql/instruments/makecds.hpp b/ql/instruments/makecds.hpp index 84c55cf2b24..778ea98b01c 100644 --- a/ql/instruments/makecds.hpp +++ b/ql/instruments/makecds.hpp @@ -64,9 +64,9 @@ namespace QuantLib { MakeCreditDefaultSwap& withPricingEngine(const ext::shared_ptr&); private: - ext::optional tenor_; - ext::optional termDate_; - ext::optional schedule_; + std::optional tenor_; + std::optional termDate_; + std::optional schedule_; Real runningSpread_; Protection::Side side_ = Protection::Buyer; Real nominal_ = 1.0; diff --git a/ql/instruments/makeois.hpp b/ql/instruments/makeois.hpp index 05c4ba402bf..f527408e321 100644 --- a/ql/instruments/makeois.hpp +++ b/ql/instruments/makeois.hpp @@ -118,7 +118,7 @@ namespace QuantLib { DateGeneration::Rule fixedRule_ = DateGeneration::Backward; DateGeneration::Rule overnightRule_ = DateGeneration::Backward; bool fixedEndOfMonth_ = false, overnightEndOfMonth_ = false, isDefaultEOM_ = true; - ext::optional maturityEndOfMonth_; + std::optional maturityEndOfMonth_; Swap::Type type_ = Swap::Payer; Real nominal_ = 1.0; diff --git a/ql/instruments/makeswaption.cpp b/ql/instruments/makeswaption.cpp index 6a88f4441d1..3c9f7cacc08 100644 --- a/ql/instruments/makeswaption.cpp +++ b/ql/instruments/makeswaption.cpp @@ -188,7 +188,7 @@ namespace QuantLib { return *this; } - MakeSwaption& MakeSwaption::withIndexedCoupons(const ext::optional& b) { + MakeSwaption& MakeSwaption::withIndexedCoupons(const std::optional& b) { useIndexedCoupons_ = b; return *this; } diff --git a/ql/instruments/makeswaption.hpp b/ql/instruments/makeswaption.hpp index c02b1089096..8dd48c2c6ec 100644 --- a/ql/instruments/makeswaption.hpp +++ b/ql/instruments/makeswaption.hpp @@ -62,7 +62,7 @@ namespace QuantLib { MakeSwaption& withExerciseDate(const Date&); MakeSwaption& withExerciseCalendar(const Calendar&); MakeSwaption& withUnderlyingType(Swap::Type type); - MakeSwaption& withIndexedCoupons(const ext::optional& b = true); + MakeSwaption& withIndexedCoupons(const std::optional& b = true); MakeSwaption& withAtParCoupons(bool b = true); MakeSwaption& withPricingEngine( @@ -83,7 +83,7 @@ namespace QuantLib { Rate strike_; Swap::Type underlyingType_; Real nominal_; - ext::optional useIndexedCoupons_; + std::optional useIndexedCoupons_; ext::shared_ptr engine_; }; diff --git a/ql/instruments/makevanillaswap.cpp b/ql/instruments/makevanillaswap.cpp index 23a62e9397c..9cccb3e5266 100644 --- a/ql/instruments/makevanillaswap.cpp +++ b/ql/instruments/makevanillaswap.cpp @@ -371,7 +371,7 @@ namespace QuantLib { return *this; } - MakeVanillaSwap& MakeVanillaSwap::withIndexedCoupons(const ext::optional& b) { + MakeVanillaSwap& MakeVanillaSwap::withIndexedCoupons(const std::optional& b) { useIndexedCoupons_ = b; return *this; } diff --git a/ql/instruments/makevanillaswap.hpp b/ql/instruments/makevanillaswap.hpp index 4de6432b244..5ef15ee0787 100644 --- a/ql/instruments/makevanillaswap.hpp +++ b/ql/instruments/makevanillaswap.hpp @@ -84,7 +84,7 @@ namespace QuantLib { const Handle& discountCurve); MakeVanillaSwap& withPricingEngine( const ext::shared_ptr& engine); - MakeVanillaSwap& withIndexedCoupons(const ext::optional& b = true); + MakeVanillaSwap& withIndexedCoupons(const std::optional& b = true); MakeVanillaSwap& withAtParCoupons(bool b = true); private: Period swapTenor_; @@ -105,13 +105,13 @@ namespace QuantLib { DateGeneration::Rule fixedRule_ = DateGeneration::Backward, floatRule_ = DateGeneration::Backward; bool fixedEndOfMonth_ = false, floatEndOfMonth_ = false; - ext::optional maturityEndOfMonth_; + std::optional maturityEndOfMonth_; Date fixedFirstDate_, fixedNextToLastDate_; Date floatFirstDate_, floatNextToLastDate_; Spread floatSpread_ = 0.0; DayCounter fixedDayCount_, floatDayCount_; - ext::optional useIndexedCoupons_; - ext::optional paymentConvention_; + std::optional useIndexedCoupons_; + std::optional paymentConvention_; ext::shared_ptr engine_; }; diff --git a/ql/instruments/multipleresetsswap.cpp b/ql/instruments/multipleresetsswap.cpp index f2d08985f72..fc9cb39bf61 100644 --- a/ql/instruments/multipleresetsswap.cpp +++ b/ql/instruments/multipleresetsswap.cpp @@ -41,7 +41,7 @@ namespace QuantLib { Schedule fullResetSchedule, const ext::shared_ptr& iborIndex, Size resetsPerCoupon, Spread spread, RateAveraging::Type averagingMethod, - ext::optional paymentConvention, + std::optional paymentConvention, Integer paymentLag, const Calendar& paymentCalendar) : FixedVsFloatingSwap(type, std::vector(fixedSchedule.size() - 1, nominal), diff --git a/ql/instruments/multipleresetsswap.hpp b/ql/instruments/multipleresetsswap.hpp index 7d25b2d6c79..1a4fb6de5ae 100644 --- a/ql/instruments/multipleresetsswap.hpp +++ b/ql/instruments/multipleresetsswap.hpp @@ -49,7 +49,7 @@ namespace QuantLib { Size resetsPerCoupon, Spread spread = 0.0, RateAveraging::Type averagingMethod = RateAveraging::Compound, - ext::optional paymentConvention = ext::nullopt, + std::optional paymentConvention = std::nullopt, Integer paymentLag = 0, const Calendar& paymentCalendar = Calendar()); diff --git a/ql/instruments/nonstandardswap.cpp b/ql/instruments/nonstandardswap.cpp index 520dd1f08e6..7e70cb713ae 100644 --- a/ql/instruments/nonstandardswap.cpp +++ b/ql/instruments/nonstandardswap.cpp @@ -68,7 +68,7 @@ namespace QuantLib { DayCounter floatingDayCount, const bool intermediateCapitalExchange, const bool finalCapitalExchange, - ext::optional paymentConvention) + std::optional paymentConvention) : Swap(2), type_(type), fixedNominal_(std::move(fixedNominal)), floatingNominal_(floatingNominal), fixedSchedule_(std::move(fixedSchedule)), fixedRate_(std::move(fixedRate)), fixedDayCount_(std::move(fixedDayCount)), @@ -99,7 +99,7 @@ namespace QuantLib { DayCounter floatingDayCount, const bool intermediateCapitalExchange, const bool finalCapitalExchange, - ext::optional paymentConvention) + std::optional paymentConvention) : Swap(2), type_(type), fixedNominal_(std::move(fixedNominal)), floatingNominal_(std::move(floatingNominal)), fixedSchedule_(std::move(fixedSchedule)), fixedRate_(std::move(fixedRate)), fixedDayCount_(std::move(fixedDayCount)), diff --git a/ql/instruments/nonstandardswap.hpp b/ql/instruments/nonstandardswap.hpp index c7ed4a7350b..08c41820044 100644 --- a/ql/instruments/nonstandardswap.hpp +++ b/ql/instruments/nonstandardswap.hpp @@ -56,7 +56,7 @@ namespace QuantLib { DayCounter floatingDayCount, bool intermediateCapitalExchange = false, bool finalCapitalExchange = false, - ext::optional paymentConvention = ext::nullopt); + std::optional paymentConvention = std::nullopt); NonstandardSwap(Swap::Type type, std::vector fixedNominal, std::vector floatingNominal, @@ -70,7 +70,7 @@ namespace QuantLib { DayCounter floatingDayCount, bool intermediateCapitalExchange = false, bool finalCapitalExchange = false, - ext::optional paymentConvention = ext::nullopt); + std::optional paymentConvention = std::nullopt); //! \name Inspectors //@{ Swap::Type type() const; diff --git a/ql/instruments/overnightindexedswap.cpp b/ql/instruments/overnightindexedswap.cpp index e01d877d2d0..b75872deaf4 100644 --- a/ql/instruments/overnightindexedswap.cpp +++ b/ql/instruments/overnightindexedswap.cpp @@ -144,7 +144,7 @@ namespace QuantLib { bool applyObservationShift) : FixedVsFloatingSwap(type, std::move(fixedNominals), std::move(fixedSchedule), fixedRate, std::move(fixedDC), overnightNominals, std::move(overnightSchedule), overnightIndex, - spread, DayCounter(), ext::nullopt, paymentLag, paymentCalendar), + spread, DayCounter(), std::nullopt, paymentLag, paymentCalendar), overnightIndex_(overnightIndex), paymentLag_(paymentLag), paymentCalendar_(paymentCalendar), telescopicValueDates_(telescopicValueDates), diff --git a/ql/instruments/vanillaswap.cpp b/ql/instruments/vanillaswap.cpp index 0ba87a70785..15bd895c638 100644 --- a/ql/instruments/vanillaswap.cpp +++ b/ql/instruments/vanillaswap.cpp @@ -36,8 +36,8 @@ namespace QuantLib { ext::shared_ptr index, Spread spread, DayCounter floatingDayCount, - ext::optional paymentConvention, - ext::optional useIndexedCoupons) + std::optional paymentConvention, + std::optional useIndexedCoupons) : FixedVsFloatingSwap(type, {nominal}, std::move(fixedSchedule), fixedRate, std::move(fixedDayCount), {nominal}, std::move(floatSchedule), std::move(index), spread, std::move(floatingDayCount), paymentConvention) { diff --git a/ql/instruments/vanillaswap.hpp b/ql/instruments/vanillaswap.hpp index 7370a5f5aef..fd2e2802b02 100644 --- a/ql/instruments/vanillaswap.hpp +++ b/ql/instruments/vanillaswap.hpp @@ -73,8 +73,8 @@ namespace QuantLib { ext::shared_ptr iborIndex, Spread spread, DayCounter floatingDayCount, - ext::optional paymentConvention = ext::nullopt, - ext::optional useIndexedCoupons = ext::nullopt); + std::optional paymentConvention = std::nullopt, + std::optional useIndexedCoupons = std::nullopt); private: void setupFloatingArguments(arguments* args) const override; From eeaa8363ad034f9b8e8f0c9c73c82dd59c04d7cd Mon Sep 17 00:00:00 2001 From: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Date: Fri, 5 Jun 2026 13:17:46 +0000 Subject: [PATCH 4/9] refactor(pricingengines): migrate ext::optional -> std::optional Co-Authored-By: Toby Drinkall --- ql/pricingengines/bond/discountingbondengine.cpp | 2 +- ql/pricingengines/bond/discountingbondengine.hpp | 4 ++-- ql/pricingengines/capfloor/analyticcapfloorengine.cpp | 2 +- ql/pricingengines/credit/integralcdsengine.cpp | 2 +- ql/pricingengines/credit/integralcdsengine.hpp | 4 ++-- ql/pricingengines/credit/isdacdsengine.cpp | 2 +- ql/pricingengines/credit/isdacdsengine.hpp | 4 ++-- ql/pricingengines/credit/midpointcdsengine.cpp | 2 +- ql/pricingengines/credit/midpointcdsengine.hpp | 4 ++-- ql/pricingengines/mclongstaffschwartzengine.hpp | 8 ++++---- .../discountingconstnotionalcrosscurrencyswapengine.cpp | 2 +- .../discountingconstnotionalcrosscurrencyswapengine.hpp | 4 ++-- ql/pricingengines/swap/discountingswapengine.cpp | 2 +- ql/pricingengines/swap/discountingswapengine.hpp | 4 ++-- ql/pricingengines/vanilla/mcamericanengine.hpp | 8 ++++---- 15 files changed, 27 insertions(+), 27 deletions(-) diff --git a/ql/pricingengines/bond/discountingbondengine.cpp b/ql/pricingengines/bond/discountingbondengine.cpp index 9d36ecf72fc..4bd306cb6e5 100644 --- a/ql/pricingengines/bond/discountingbondengine.cpp +++ b/ql/pricingengines/bond/discountingbondengine.cpp @@ -27,7 +27,7 @@ namespace QuantLib { DiscountingBondEngine::DiscountingBondEngine( Handle discountCurve, - const ext::optional& includeSettlementDateFlows) + const std::optional& includeSettlementDateFlows) : discountCurve_(std::move(discountCurve)), includeSettlementDateFlows_(includeSettlementDateFlows) { registerWith(discountCurve_); diff --git a/ql/pricingengines/bond/discountingbondengine.hpp b/ql/pricingengines/bond/discountingbondengine.hpp index 3c221c661a0..65a44b7ed3d 100644 --- a/ql/pricingengines/bond/discountingbondengine.hpp +++ b/ql/pricingengines/bond/discountingbondengine.hpp @@ -40,14 +40,14 @@ namespace QuantLib { public: DiscountingBondEngine( Handle discountCurve = Handle(), - const ext::optional& includeSettlementDateFlows = ext::nullopt); + const std::optional& includeSettlementDateFlows = std::nullopt); void calculate() const override; Handle discountCurve() const { return discountCurve_; } private: Handle discountCurve_; - ext::optional includeSettlementDateFlows_; + std::optional includeSettlementDateFlows_; }; } diff --git a/ql/pricingengines/capfloor/analyticcapfloorengine.cpp b/ql/pricingengines/capfloor/analyticcapfloorengine.cpp index 697e5dfe345..6faa2da1629 100644 --- a/ql/pricingengines/capfloor/analyticcapfloorengine.cpp +++ b/ql/pricingengines/capfloor/analyticcapfloorengine.cpp @@ -54,7 +54,7 @@ namespace QuantLib { bool includeRefDatePayments = Settings::instance().includeReferenceDateEvents(); if (referenceDate == Settings::instance().evaluationDate()) { - ext::optional includeTodaysPayments = + std::optional includeTodaysPayments = Settings::instance().includeTodaysCashFlows(); if (includeTodaysPayments) // NOLINT(readability-implicit-bool-conversion) includeRefDatePayments = *includeTodaysPayments; diff --git a/ql/pricingengines/credit/integralcdsengine.cpp b/ql/pricingengines/credit/integralcdsengine.cpp index 0d307b1a1bc..a9a0f76249f 100644 --- a/ql/pricingengines/credit/integralcdsengine.cpp +++ b/ql/pricingengines/credit/integralcdsengine.cpp @@ -32,7 +32,7 @@ namespace QuantLib { Handle probability, Real recoveryRate, Handle discountCurve, - const ext::optional& includeSettlementDateFlows) + const std::optional& includeSettlementDateFlows) : integrationStep_(step), probability_(std::move(probability)), recoveryRate_(recoveryRate), discountCurve_(std::move(discountCurve)), includeSettlementDateFlows_(includeSettlementDateFlows) { diff --git a/ql/pricingengines/credit/integralcdsengine.hpp b/ql/pricingengines/credit/integralcdsengine.hpp index 24c885f1b79..844a95a1145 100644 --- a/ql/pricingengines/credit/integralcdsengine.hpp +++ b/ql/pricingengines/credit/integralcdsengine.hpp @@ -36,7 +36,7 @@ namespace QuantLib { Handle, Real recoveryRate, Handle discountCurve, - const ext::optional& includeSettlementDateFlows = ext::nullopt); + const std::optional& includeSettlementDateFlows = std::nullopt); void calculate() const override; private: @@ -44,7 +44,7 @@ namespace QuantLib { Handle probability_; Real recoveryRate_; Handle discountCurve_; - ext::optional includeSettlementDateFlows_; + std::optional includeSettlementDateFlows_; }; } diff --git a/ql/pricingengines/credit/isdacdsengine.cpp b/ql/pricingengines/credit/isdacdsengine.cpp index 5f807edd596..9298d7dcc68 100644 --- a/ql/pricingengines/credit/isdacdsengine.cpp +++ b/ql/pricingengines/credit/isdacdsengine.cpp @@ -36,7 +36,7 @@ namespace QuantLib { IsdaCdsEngine::IsdaCdsEngine(Handle probability, Real recoveryRate, Handle discountCurve, - const ext::optional& includeSettlementDateFlows, + const std::optional& includeSettlementDateFlows, const NumericalFix numericalFix, const AccrualBias accrualBias, const ForwardsInCouponPeriod forwardsInCouponPeriod) diff --git a/ql/pricingengines/credit/isdacdsengine.hpp b/ql/pricingengines/credit/isdacdsengine.hpp index ccd1369b7c5..791c8d86a95 100644 --- a/ql/pricingengines/credit/isdacdsengine.hpp +++ b/ql/pricingengines/credit/isdacdsengine.hpp @@ -98,7 +98,7 @@ namespace QuantLib { IsdaCdsEngine(Handle probability, Real recoveryRate, Handle discountCurve, - const ext::optional& includeSettlementDateFlows = ext::nullopt, + const std::optional& includeSettlementDateFlows = std::nullopt, NumericalFix numericalFix = Taylor, AccrualBias accrualBias = HalfDayBias, ForwardsInCouponPeriod forwardsInCouponPeriod = Piecewise); @@ -112,7 +112,7 @@ namespace QuantLib { Handle probability_; const Real recoveryRate_; Handle discountCurve_; - const ext::optional includeSettlementDateFlows_; + const std::optional includeSettlementDateFlows_; const NumericalFix numericalFix_; const AccrualBias accrualBias_; const ForwardsInCouponPeriod forwardsInCouponPeriod_; diff --git a/ql/pricingengines/credit/midpointcdsengine.cpp b/ql/pricingengines/credit/midpointcdsengine.cpp index 1facad68d25..b8dd34d368a 100644 --- a/ql/pricingengines/credit/midpointcdsengine.cpp +++ b/ql/pricingengines/credit/midpointcdsengine.cpp @@ -31,7 +31,7 @@ namespace QuantLib { MidPointCdsEngine::MidPointCdsEngine(Handle probability, Real recoveryRate, Handle discountCurve, - const ext::optional& includeSettlementDateFlows) + const std::optional& includeSettlementDateFlows) : probability_(std::move(probability)), recoveryRate_(recoveryRate), discountCurve_(std::move(discountCurve)), includeSettlementDateFlows_(includeSettlementDateFlows) { diff --git a/ql/pricingengines/credit/midpointcdsengine.hpp b/ql/pricingengines/credit/midpointcdsengine.hpp index a1a7e36b029..f7dfff2bfad 100644 --- a/ql/pricingengines/credit/midpointcdsengine.hpp +++ b/ql/pricingengines/credit/midpointcdsengine.hpp @@ -36,14 +36,14 @@ namespace QuantLib { MidPointCdsEngine(Handle, Real recoveryRate, Handle discountCurve, - const ext::optional& includeSettlementDateFlows = ext::nullopt); + const std::optional& includeSettlementDateFlows = std::nullopt); void calculate() const override; private: Handle probability_; Real recoveryRate_; Handle discountCurve_; - ext::optional includeSettlementDateFlows_; + std::optional includeSettlementDateFlows_; }; } diff --git a/ql/pricingengines/mclongstaffschwartzengine.hpp b/ql/pricingengines/mclongstaffschwartzengine.hpp index 5126044fde2..06fac871652 100644 --- a/ql/pricingengines/mclongstaffschwartzengine.hpp +++ b/ql/pricingengines/mclongstaffschwartzengine.hpp @@ -80,8 +80,8 @@ namespace QuantLib { Size maxSamples, BigNatural seed, Size nCalibrationSamples = Null(), - ext::optional brownianBridgeCalibration = ext::nullopt, - ext::optional antitheticVariateCalibration = ext::nullopt, + std::optional brownianBridgeCalibration = std::nullopt, + std::optional antitheticVariateCalibration = std::nullopt, BigNatural seedCalibration = Null()); void calculate() const override; @@ -131,8 +131,8 @@ namespace QuantLib { Size maxSamples, BigNatural seed, Size nCalibrationSamples, - ext::optional brownianBridgeCalibration, - ext::optional antitheticVariateCalibration, + std::optional brownianBridgeCalibration, + std::optional antitheticVariateCalibration, BigNatural seedCalibration) : McSimulation(antitheticVariate, controlVariate), process_(std::move(process)), timeSteps_(timeSteps), timeStepsPerYear_(timeStepsPerYear), brownianBridge_(brownianBridge), diff --git a/ql/pricingengines/swap/discountingconstnotionalcrosscurrencyswapengine.cpp b/ql/pricingengines/swap/discountingconstnotionalcrosscurrencyswapengine.cpp index b4bd77e3fef..e7b677962a9 100644 --- a/ql/pricingengines/swap/discountingconstnotionalcrosscurrencyswapengine.cpp +++ b/ql/pricingengines/swap/discountingconstnotionalcrosscurrencyswapengine.cpp @@ -27,7 +27,7 @@ namespace QuantLib { DiscountingConstNotionalCrossCurrencySwapEngine::DiscountingConstNotionalCrossCurrencySwapEngine(Currency domesticCcy, const Handle& domesticCcyDiscountcurve, Currency foreignCcy, const Handle& foreignCcyDiscountcurve, - const Handle& spotFX, ext::optional includeSettlementDateFlows, + const Handle& spotFX, std::optional includeSettlementDateFlows, const Date& settlementDate, const Date& npvDate, const Date& spotFXSettleDate) : domesticCcy_(std::move(domesticCcy)), domesticCcyDiscountcurve_(domesticCcyDiscountcurve), foreignCcy_(std::move(foreignCcy)), foreignCcyDiscountcurve_(foreignCcyDiscountcurve), spotFX_(spotFX), diff --git a/ql/pricingengines/swap/discountingconstnotionalcrosscurrencyswapengine.hpp b/ql/pricingengines/swap/discountingconstnotionalcrosscurrencyswapengine.hpp index ae21b518964..d3dfa570738 100644 --- a/ql/pricingengines/swap/discountingconstnotionalcrosscurrencyswapengine.hpp +++ b/ql/pricingengines/swap/discountingconstnotionalcrosscurrencyswapengine.hpp @@ -68,7 +68,7 @@ class DiscountingConstNotionalCrossCurrencySwapEngine : public ConstNotionalCros */ DiscountingConstNotionalCrossCurrencySwapEngine(Currency domesticCcy, const Handle& domesticCcyDiscountCurve, Currency foreignCcy, const Handle& foreignCcyDiscountCurve, - const Handle& spotFX, ext::optional includeSettlementDateFlows = ext::nullopt, + const Handle& spotFX, std::optional includeSettlementDateFlows = std::nullopt, const Date& settlementDate = Date(), const Date& npvDate = Date(), const Date& spotFXSettleDate = Date()); //@} @@ -94,7 +94,7 @@ class DiscountingConstNotionalCrossCurrencySwapEngine : public ConstNotionalCros Currency foreignCcy_; Handle foreignCcyDiscountcurve_; Handle spotFX_; - ext::optional includeSettlementDateFlows_; + std::optional includeSettlementDateFlows_; Date settlementDate_; Date npvDate_; Date spotFXSettleDate_; diff --git a/ql/pricingengines/swap/discountingswapengine.cpp b/ql/pricingengines/swap/discountingswapengine.cpp index d74cf5843df..d7ab289c7db 100644 --- a/ql/pricingengines/swap/discountingswapengine.cpp +++ b/ql/pricingengines/swap/discountingswapengine.cpp @@ -28,7 +28,7 @@ namespace QuantLib { DiscountingSwapEngine::DiscountingSwapEngine( Handle discountCurve, - const ext::optional& includeSettlementDateFlows, + const std::optional& includeSettlementDateFlows, Date settlementDate, Date npvDate) : discountCurve_(std::move(discountCurve)), diff --git a/ql/pricingengines/swap/discountingswapengine.hpp b/ql/pricingengines/swap/discountingswapengine.hpp index 3943fda632c..1dbc63be834 100644 --- a/ql/pricingengines/swap/discountingswapengine.hpp +++ b/ql/pricingengines/swap/discountingswapengine.hpp @@ -40,7 +40,7 @@ namespace QuantLib { public: DiscountingSwapEngine( Handle discountCurve = Handle(), - const ext::optional& includeSettlementDateFlows = ext::nullopt, + const std::optional& includeSettlementDateFlows = std::nullopt, Date settlementDate = Date(), Date npvDate = Date()); void calculate() const override; @@ -49,7 +49,7 @@ namespace QuantLib { } private: Handle discountCurve_; - ext::optional includeSettlementDateFlows_; + std::optional includeSettlementDateFlows_; Date settlementDate_, npvDate_; }; diff --git a/ql/pricingengines/vanilla/mcamericanengine.hpp b/ql/pricingengines/vanilla/mcamericanengine.hpp index fc06574b1f2..811a832f8a4 100644 --- a/ql/pricingengines/vanilla/mcamericanengine.hpp +++ b/ql/pricingengines/vanilla/mcamericanengine.hpp @@ -65,7 +65,7 @@ namespace QuantLib { Size polynomialOrder, LsmBasisSystem::PolynomialType polynomialType, Size nCalibrationSamples = Null(), - const ext::optional& antitheticVariateCalibration = ext::nullopt, + const std::optional& antitheticVariateCalibration = std::nullopt, BigNatural seedCalibration = Null()); void calculate() const override; @@ -134,7 +134,7 @@ namespace QuantLib { BigNatural seed_ = 0; Size polynomialOrder_ = 2; LsmBasisSystem::PolynomialType polynomialType_ = LsmBasisSystem::Monomial; - ext::optional antitheticCalibration_; + std::optional antitheticCalibration_; BigNatural seedCalibration_; }; @@ -152,7 +152,7 @@ namespace QuantLib { Size polynomialOrder, LsmBasisSystem::PolynomialType polynomialType, Size nCalibrationSamples, - const ext::optional& antitheticVariateCalibration, + const std::optional& antitheticVariateCalibration, BigNatural seedCalibration) : MCLongstaffSchwartzEngine( process, @@ -269,7 +269,7 @@ namespace QuantLib { ext::shared_ptr process) : process_(std::move(process)), steps_(Null()), stepsPerYear_(Null()), samples_(Null()), maxSamples_(Null()), tolerance_(Null()), - antitheticCalibration_(ext::nullopt), seedCalibration_(Null()) {} + antitheticCalibration_(std::nullopt), seedCalibration_(Null()) {} template inline MakeMCAmericanEngine & From 2aa71fe50e66403753faec672b737becb63692af Mon Sep 17 00:00:00 2001 From: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Date: Fri, 5 Jun 2026 13:17:53 +0000 Subject: [PATCH 5/9] refactor(termstructures): migrate ext::optional -> std::optional Co-Authored-By: Toby Drinkall --- .../equityfx/blackvolsurfacedelta.cpp | 4 ++-- .../equityfx/blackvolsurfacedelta.hpp | 4 ++-- .../volatility/optionlet/optionletstripper.cpp | 4 ++-- .../volatility/optionlet/optionletstripper.hpp | 6 +++--- .../optionlet/optionletstripper1.cpp | 2 +- .../optionlet/optionletstripper1.hpp | 2 +- ql/termstructures/yield/oisratehelper.cpp | 8 ++++---- ql/termstructures/yield/oisratehelper.hpp | 12 ++++++------ ql/termstructures/yield/ratehelpers.cpp | 10 +++++----- ql/termstructures/yield/ratehelpers.hpp | 18 +++++++++--------- .../yield/ultimateforwardtermstructure.hpp | 6 +++--- 11 files changed, 38 insertions(+), 38 deletions(-) diff --git a/ql/termstructures/volatility/equityfx/blackvolsurfacedelta.cpp b/ql/termstructures/volatility/equityfx/blackvolsurfacedelta.cpp index ea96bfe250c..64a02aaaf03 100644 --- a/ql/termstructures/volatility/equityfx/blackvolsurfacedelta.cpp +++ b/ql/termstructures/volatility/equityfx/blackvolsurfacedelta.cpp @@ -36,10 +36,10 @@ namespace QuantLib { const std::vector& callDeltas, bool hasAtm, const Matrix& blackVolMatrix, const DayCounter& dayCounter, const Calendar& cal, const Handle& spot, const Handle& domesticTS, const Handle& foreignTS, DeltaVolQuote::DeltaType deltaType, DeltaVolQuote::AtmType atmType, - ext::optional atmDeltaType, SmileInterpolationMethod im, + std::optional atmDeltaType, SmileInterpolationMethod im, bool flatStrikeExtrapolation, BlackVolTimeExtrapolation::Type timeExtrapolationType, const Period& switchTenor, DeltaVolQuote::DeltaType longTermDeltaType, DeltaVolQuote::AtmType longTermAtmType, - ext::optional longTermAtmDeltaType) + std::optional longTermAtmDeltaType) : BlackVolatilityTermStructure(referenceDate, cal, Following, dayCounter), dates_(dates), times_(dates.size(), 0), putDeltas_(putDeltas), callDeltas_(callDeltas), hasAtm_(hasAtm), spot_(spot), domesticTS_(domesticTS), foreignTS_(foreignTS), deltaType_(deltaType), atmType_(atmType), atmDeltaType_(atmDeltaType ? *atmDeltaType : deltaType), diff --git a/ql/termstructures/volatility/equityfx/blackvolsurfacedelta.hpp b/ql/termstructures/volatility/equityfx/blackvolsurfacedelta.hpp index aa84afbfcc8..1e19cacf485 100644 --- a/ql/termstructures/volatility/equityfx/blackvolsurfacedelta.hpp +++ b/ql/termstructures/volatility/equityfx/blackvolsurfacedelta.hpp @@ -91,7 +91,7 @@ namespace QuantLib { const Handle& foreignTS, DeltaVolQuote::DeltaType deltaType = DeltaVolQuote::DeltaType::Spot, DeltaVolQuote::AtmType atmType = DeltaVolQuote::AtmType::AtmDeltaNeutral, - ext::optional atmDeltaType = ext::nullopt, + std::optional atmDeltaType = std::nullopt, SmileInterpolationMethod interpolationMethod = SmileInterpolationMethod::Linear, bool flatStrikeExtrapolation = false, @@ -100,7 +100,7 @@ namespace QuantLib { const Period& switchTenor = 0 * Days, DeltaVolQuote::DeltaType longTermDeltaType = DeltaVolQuote::DeltaType::Fwd, DeltaVolQuote::AtmType longTermAtmType = DeltaVolQuote::AtmType::AtmDeltaNeutral, - ext::optional longTermAtmDeltaType = ext::nullopt); + std::optional longTermAtmDeltaType = std::nullopt); //@} //! \name TermStructure interface diff --git a/ql/termstructures/volatility/optionlet/optionletstripper.cpp b/ql/termstructures/volatility/optionlet/optionletstripper.cpp index c404faa11a4..611a672e39a 100644 --- a/ql/termstructures/volatility/optionlet/optionletstripper.cpp +++ b/ql/termstructures/volatility/optionlet/optionletstripper.cpp @@ -33,7 +33,7 @@ namespace QuantLib { Handle discount, const VolatilityType type, const Real displacement, - ext::optional optionletFrequency + std::optional optionletFrequency ) : termVolSurface_(termVolSurface), iborIndex_(std::move(iborIndex)), discount_(std::move(discount)), nStrikes_(termVolSurface->strikes().size()), @@ -170,7 +170,7 @@ namespace QuantLib { return volatilityType_; } - ext::optional OptionletStripper::optionletFrequency() const { + std::optional OptionletStripper::optionletFrequency() const { return optionletFrequency_; } diff --git a/ql/termstructures/volatility/optionlet/optionletstripper.hpp b/ql/termstructures/volatility/optionlet/optionletstripper.hpp index 5b013cf9931..8490f2543e3 100644 --- a/ql/termstructures/volatility/optionlet/optionletstripper.hpp +++ b/ql/termstructures/volatility/optionlet/optionletstripper.hpp @@ -64,7 +64,7 @@ namespace QuantLib { ext::shared_ptr iborIndex() const; Real displacement() const override; VolatilityType volatilityType() const override; - ext::optional optionletFrequency() const; + std::optional optionletFrequency() const; protected: OptionletStripper(const ext::shared_ptr&, @@ -72,7 +72,7 @@ namespace QuantLib { Handle discount = {}, VolatilityType type = ShiftedLognormal, Real displacement = 0.0, - ext::optional optionletFrequency = ext::nullopt); + std::optional optionletFrequency = std::nullopt); ext::shared_ptr termVolSurface_; ext::shared_ptr iborIndex_; Handle discount_; @@ -92,7 +92,7 @@ namespace QuantLib { std::vector capFloorLengths_; const VolatilityType volatilityType_; const Real displacement_; - ext::optional optionletFrequency_; + std::optional optionletFrequency_; }; } diff --git a/ql/termstructures/volatility/optionlet/optionletstripper1.cpp b/ql/termstructures/volatility/optionlet/optionletstripper1.cpp index 58bb76b5004..5bb602b5e40 100644 --- a/ql/termstructures/volatility/optionlet/optionletstripper1.cpp +++ b/ql/termstructures/volatility/optionlet/optionletstripper1.cpp @@ -44,7 +44,7 @@ namespace QuantLib { const VolatilityType type, const Real displacement, bool dontThrow, - ext::optional optionletFrequency) + std::optional optionletFrequency) : OptionletStripper(termVolSurface, index, discount, type, displacement, optionletFrequency), floatingSwitchStrike_(switchStrike == Null()), switchStrike_(switchStrike), accuracy_(accuracy), maxIter_(maxIter), dontThrow_(dontThrow) { diff --git a/ql/termstructures/volatility/optionlet/optionletstripper1.hpp b/ql/termstructures/volatility/optionlet/optionletstripper1.hpp index a61c9ae07ff..7693f7c66cb 100644 --- a/ql/termstructures/volatility/optionlet/optionletstripper1.hpp +++ b/ql/termstructures/volatility/optionlet/optionletstripper1.hpp @@ -53,7 +53,7 @@ namespace QuantLib { VolatilityType type = ShiftedLognormal, Real displacement = 0.0, bool dontThrow = false, - ext::optional optionletFrequency = ext::nullopt); + std::optional optionletFrequency = std::nullopt); const Matrix& capFloorPrices() const; const Matrix &capletVols() const; diff --git a/ql/termstructures/yield/oisratehelper.cpp b/ql/termstructures/yield/oisratehelper.cpp index 9e92a8711fc..fa21c634703 100644 --- a/ql/termstructures/yield/oisratehelper.cpp +++ b/ql/termstructures/yield/oisratehelper.cpp @@ -45,8 +45,8 @@ namespace QuantLib { Pillar::Choice pillar, Date customPillarDate, RateAveraging::Type averagingMethod, - ext::optional endOfMonth, - ext::optional fixedPaymentFrequency, + std::optional endOfMonth, + std::optional fixedPaymentFrequency, Calendar fixedCalendar, Natural lookbackDays, Natural lockoutDays, @@ -83,8 +83,8 @@ namespace QuantLib { Pillar::Choice pillar, Date customPillarDate, RateAveraging::Type averagingMethod, - ext::optional endOfMonth, - ext::optional fixedPaymentFrequency, + std::optional endOfMonth, + std::optional fixedPaymentFrequency, Calendar fixedCalendar, Natural lookbackDays, Natural lockoutDays, diff --git a/ql/termstructures/yield/oisratehelper.hpp b/ql/termstructures/yield/oisratehelper.hpp index d880e65f524..c2dda544ac6 100644 --- a/ql/termstructures/yield/oisratehelper.hpp +++ b/ql/termstructures/yield/oisratehelper.hpp @@ -54,8 +54,8 @@ namespace QuantLib { Pillar::Choice pillar = Pillar::LastRelevantDate, Date customPillarDate = Date(), RateAveraging::Type averagingMethod = RateAveraging::Compound, - ext::optional endOfMonth = ext::nullopt, - ext::optional fixedPaymentFrequency = ext::nullopt, + std::optional endOfMonth = std::nullopt, + std::optional fixedPaymentFrequency = std::nullopt, Calendar fixedCalendar = Calendar(), Natural lookbackDays = Null(), Natural lockoutDays = 0, @@ -81,8 +81,8 @@ namespace QuantLib { Pillar::Choice pillar = Pillar::LastRelevantDate, Date customPillarDate = Date(), RateAveraging::Type averagingMethod = RateAveraging::Compound, - ext::optional endOfMonth = ext::nullopt, - ext::optional fixedPaymentFrequency = ext::nullopt, + std::optional endOfMonth = std::nullopt, + std::optional fixedPaymentFrequency = std::nullopt, Calendar fixedCalendar = Calendar(), Natural lookbackDays = Null(), Natural lockoutDays = 0, @@ -131,8 +131,8 @@ namespace QuantLib { Handle overnightSpread_; Pillar::Choice pillarChoice_; RateAveraging::Type averagingMethod_; - ext::optional endOfMonth_; - ext::optional fixedPaymentFrequency_; + std::optional endOfMonth_; + std::optional fixedPaymentFrequency_; Calendar fixedCalendar_; Calendar overnightCalendar_; BusinessDayConvention convention_; diff --git a/ql/termstructures/yield/ratehelpers.cpp b/ql/termstructures/yield/ratehelpers.cpp index 76637201361..188666ae755 100644 --- a/ql/termstructures/yield/ratehelpers.cpp +++ b/ql/termstructures/yield/ratehelpers.cpp @@ -466,7 +466,7 @@ namespace QuantLib { Pillar::Choice pillarChoice, Date customPillarDate, bool endOfMonth, - const ext::optional& useIndexedCoupons) + const std::optional& useIndexedCoupons) : SwapRateHelper(rate, swapIndex->tenor(), swapIndex->fixingCalendar(), swapIndex->fixedLegTenor().frequency(), swapIndex->fixedLegConvention(), swapIndex->dayCounter(), swapIndex->iborIndex(), std::move(spread), fwdStart, @@ -487,8 +487,8 @@ namespace QuantLib { Pillar::Choice pillarChoice, Date customPillarDate, bool endOfMonth, - const ext::optional& useIndexedCoupons, - const ext::optional& floatConvention) + const std::optional& useIndexedCoupons, + const std::optional& floatConvention) : RelativeDateRateHelper(rate), settlementDays_(settlementDays), tenor_(tenor), pillarChoice_(pillarChoice), calendar_(std::move(calendar)), fixedConvention_(fixedConvention), fixedFrequency_(fixedFrequency), @@ -511,8 +511,8 @@ namespace QuantLib { Pillar::Choice pillarChoice, Date customPillarDate, bool endOfMonth, - const ext::optional& useIndexedCoupons, - const ext::optional& floatConvention) + const std::optional& useIndexedCoupons, + const std::optional& floatConvention) : RelativeDateRateHelper(rate, false), startDate_(startDate), endDate_(endDate), pillarChoice_(pillarChoice), calendar_(std::move(calendar)), fixedConvention_(fixedConvention), fixedFrequency_(fixedFrequency), diff --git a/ql/termstructures/yield/ratehelpers.hpp b/ql/termstructures/yield/ratehelpers.hpp index 3a242cf3577..f00b25da847 100644 --- a/ql/termstructures/yield/ratehelpers.hpp +++ b/ql/termstructures/yield/ratehelpers.hpp @@ -183,8 +183,8 @@ namespace QuantLib { private: void initializeDates() override; Date fixingDate_; - ext::optional periodToStart_; - ext::optional immOffsetStart_, immOffsetEnd_; + std::optional periodToStart_; + std::optional immOffsetStart_, immOffsetEnd_; Pillar::Choice pillarChoice_; ext::shared_ptr iborIndex_; RelinkableHandle termStructureHandle_; @@ -206,7 +206,7 @@ namespace QuantLib { Pillar::Choice pillar = Pillar::LastRelevantDate, Date customPillarDate = Date(), bool endOfMonth = false, - const ext::optional& useIndexedCoupons = ext::nullopt); + const std::optional& useIndexedCoupons = std::nullopt); SwapRateHelper(const std::variant>& rate, const Period& tenor, Calendar calendar, @@ -224,8 +224,8 @@ namespace QuantLib { Pillar::Choice pillar = Pillar::LastRelevantDate, Date customPillarDate = Date(), bool endOfMonth = false, - const ext::optional& useIndexedCoupons = ext::nullopt, - const ext::optional& floatConvention = ext::nullopt); + const std::optional& useIndexedCoupons = std::nullopt, + const std::optional& floatConvention = std::nullopt); SwapRateHelper(const std::variant>& rate, const Date& startDate, const Date& endDate, @@ -242,8 +242,8 @@ namespace QuantLib { Pillar::Choice pillar = Pillar::LastRelevantDate, Date customPillarDate = Date(), bool endOfMonth = false, - const ext::optional& useIndexedCoupons = ext::nullopt, - const ext::optional& floatConvention = ext::nullopt); + const std::optional& useIndexedCoupons = std::nullopt, + const std::optional& floatConvention = std::nullopt); //! \name RateHelper interface //@{ Real impliedQuote() const override; @@ -280,8 +280,8 @@ namespace QuantLib { Period fwdStart_; Handle discountHandle_; RelinkableHandle discountRelinkableHandle_; - ext::optional useIndexedCoupons_; - ext::optional floatConvention_; + std::optional useIndexedCoupons_; + std::optional floatConvention_; }; diff --git a/ql/termstructures/yield/ultimateforwardtermstructure.hpp b/ql/termstructures/yield/ultimateforwardtermstructure.hpp index f283cb86744..1f6d015437e 100644 --- a/ql/termstructures/yield/ultimateforwardtermstructure.hpp +++ b/ql/termstructures/yield/ultimateforwardtermstructure.hpp @@ -82,7 +82,7 @@ namespace QuantLib { Handle ultimateForwardRate, const Period& firstSmoothingPoint, Real alpha, - const ext::optional& roundingDigits = ext::nullopt, + const std::optional& roundingDigits = std::nullopt, Compounding compounding = Compounded, Frequency frequency = Annual); //! \name YieldTermStructure interface @@ -111,7 +111,7 @@ namespace QuantLib { Handle ufr_; Period fsp_; Real alpha_; - ext::optional roundingDigits_; + std::optional roundingDigits_; Compounding compounding_; Frequency frequency_; }; @@ -124,7 +124,7 @@ namespace QuantLib { Handle ultimateForwardRate, const Period& firstSmoothingPoint, Real alpha, - const ext::optional& roundingDigits, + const std::optional& roundingDigits, Compounding compounding, Frequency frequency) : originalCurve_(std::move(h)), llfr_(std::move(lastLiquidForwardRate)), From 1891a0233299bc036231fff7973d2a4a77a55e5c Mon Sep 17 00:00:00 2001 From: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Date: Fri, 5 Jun 2026 13:17:53 +0000 Subject: [PATCH 6/9] refactor(experimental+time): migrate ext::optional -> std::optional Co-Authored-By: Toby Drinkall --- .../catbonds/montecarlocatbondengine.cpp | 2 +- .../catbonds/montecarlocatbondengine.hpp | 4 ++-- .../coupons/lognormalcmsspreadpricer.cpp | 2 +- .../coupons/lognormalcmsspreadpricer.hpp | 2 +- ql/experimental/credit/syntheticcdo.cpp | 2 +- ql/experimental/credit/syntheticcdo.hpp | 2 +- .../crosscurrencyratehelpers.cpp | 22 +++++++++---------- .../crosscurrencyratehelpers.hpp | 16 +++++++------- ql/time/schedule.cpp | 8 +++---- ql/time/schedule.hpp | 22 +++++++++---------- 10 files changed, 41 insertions(+), 41 deletions(-) diff --git a/ql/experimental/catbonds/montecarlocatbondengine.cpp b/ql/experimental/catbonds/montecarlocatbondengine.cpp index ab173ff28da..4a494050638 100644 --- a/ql/experimental/catbonds/montecarlocatbondengine.cpp +++ b/ql/experimental/catbonds/montecarlocatbondengine.cpp @@ -28,7 +28,7 @@ namespace QuantLib { MonteCarloCatBondEngine::MonteCarloCatBondEngine( ext::shared_ptr catRisk, Handle discountCurve, - const ext::optional& includeSettlementDateFlows) + const std::optional& includeSettlementDateFlows) : catRisk_(std::move(catRisk)), discountCurve_(std::move(discountCurve)), includeSettlementDateFlows_(includeSettlementDateFlows) { registerWith(discountCurve_); diff --git a/ql/experimental/catbonds/montecarlocatbondengine.hpp b/ql/experimental/catbonds/montecarlocatbondengine.hpp index b0843ccf47a..76ae6f8b90f 100644 --- a/ql/experimental/catbonds/montecarlocatbondengine.hpp +++ b/ql/experimental/catbonds/montecarlocatbondengine.hpp @@ -36,7 +36,7 @@ namespace QuantLib { explicit MonteCarloCatBondEngine( ext::shared_ptr catRisk, Handle discountCurve = Handle(), - const ext::optional& includeSettlementDateFlows = ext::nullopt); + const std::optional& includeSettlementDateFlows = std::nullopt); void calculate() const override; Handle discountCurve() const { return discountCurve_; } protected: @@ -57,7 +57,7 @@ namespace QuantLib { private: ext::shared_ptr catRisk_; Handle discountCurve_; - ext::optional includeSettlementDateFlows_; + std::optional includeSettlementDateFlows_; }; } diff --git a/ql/experimental/coupons/lognormalcmsspreadpricer.cpp b/ql/experimental/coupons/lognormalcmsspreadpricer.cpp index e0fc3ccd7f8..098759c2224 100644 --- a/ql/experimental/coupons/lognormalcmsspreadpricer.cpp +++ b/ql/experimental/coupons/lognormalcmsspreadpricer.cpp @@ -47,7 +47,7 @@ namespace QuantLib { const Handle& correlation, Handle couponDiscountCurve, const Size integrationPoints, - const ext::optional& volatilityType, + const std::optional& volatilityType, const Real shift1, const Real shift2) : CmsSpreadCouponPricer(correlation), cmsPricer_(cmsPricer), diff --git a/ql/experimental/coupons/lognormalcmsspreadpricer.hpp b/ql/experimental/coupons/lognormalcmsspreadpricer.hpp index 0e1ed52000c..9c933176891 100644 --- a/ql/experimental/coupons/lognormalcmsspreadpricer.hpp +++ b/ql/experimental/coupons/lognormalcmsspreadpricer.hpp @@ -65,7 +65,7 @@ namespace QuantLib { const Handle& correlation, Handle couponDiscountCurve = Handle(), Size IntegrationPoints = 16, - const ext::optional& volatilityType = ext::nullopt, + const std::optional& volatilityType = std::nullopt, Real shift1 = Null(), Real shift2 = Null()); diff --git a/ql/experimental/credit/syntheticcdo.cpp b/ql/experimental/credit/syntheticcdo.cpp index 2ad60bafb6a..fc653e2041d 100644 --- a/ql/experimental/credit/syntheticcdo.cpp +++ b/ql/experimental/credit/syntheticcdo.cpp @@ -40,7 +40,7 @@ namespace QuantLib { Rate runningRate, const DayCounter& dayCounter, BusinessDayConvention paymentConvention, - ext::optional notional) + std::optional notional) : basket_(basket), side_(side), upfrontRate_(upfrontRate), runningRate_(runningRate), leverageFactor_(notional ? *notional / basket->trancheNotional() : Real(1.)), // NOLINT(readability-implicit-bool-conversion) dayCounter_(dayCounter), paymentConvention_(paymentConvention) { diff --git a/ql/experimental/credit/syntheticcdo.hpp b/ql/experimental/credit/syntheticcdo.hpp index ca4e9d6abda..94b06656d23 100644 --- a/ql/experimental/credit/syntheticcdo.hpp +++ b/ql/experimental/credit/syntheticcdo.hpp @@ -122,7 +122,7 @@ namespace QuantLib { Rate runningRate, const DayCounter& dayCounter, BusinessDayConvention paymentConvention, - ext::optional notional = ext::nullopt); + std::optional notional = std::nullopt); const ext::shared_ptr& basket() const { return basket_; } diff --git a/ql/experimental/termstructures/crosscurrencyratehelpers.cpp b/ql/experimental/termstructures/crosscurrencyratehelpers.cpp index 04ee98869ca..c4b8740b994 100644 --- a/ql/experimental/termstructures/crosscurrencyratehelpers.cpp +++ b/ql/experimental/termstructures/crosscurrencyratehelpers.cpp @@ -36,14 +36,14 @@ namespace QuantLib { // Treat an explicitly-passed NoFrequency the same as an unset (nullopt) // payment frequency. Before these parameters were migrated to - // ext::optional, NoFrequency was the sentinel meaning "derive + // std::optional, NoFrequency was the sentinel meaning "derive // the schedule from the index tenor". Normalizing it here preserves that // behavior and keeps the stored optional either empty or holding an // actual frequency, so the rest of the code can treat the two cases // identically. - ext::optional normalizedPaymentFrequency(ext::optional frequency) { + std::optional normalizedPaymentFrequency(std::optional frequency) { if (frequency && *frequency == NoFrequency) - return ext::nullopt; + return std::nullopt; return frequency; } @@ -77,7 +77,7 @@ namespace QuantLib { BusinessDayConvention convention, bool endOfMonth, const ext::shared_ptr& idx, - ext::optional paymentFrequency, + std::optional paymentFrequency, Integer paymentLag) { auto overnightIndex = ext::dynamic_pointer_cast(idx); @@ -269,9 +269,9 @@ namespace QuantLib { Handle collateralCurve, bool isFxBaseCurrencyCollateralCurrency, bool isBasisOnFxBaseCurrencyLeg, - ext::optional paymentFrequency, + std::optional paymentFrequency, Integer paymentLag, - ext::optional quoteCurrencyPaymentFrequency) + std::optional quoteCurrencyPaymentFrequency) : CrossCurrencySwapRateHelperBase(basis, tenor, fixingDays, std::move(calendar), convention, endOfMonth, std::move(collateralCurve), paymentLag), baseCcyIdx_(std::move(baseCurrencyIndex)), quoteCcyIdx_(std::move(quoteCurrencyIndex)), @@ -292,7 +292,7 @@ namespace QuantLib { // If no quote-currency payment frequency was given, fall back to the // base-currency payment frequency (which may itself be unset, in which // case the quote-currency leg uses its own index tenor). - ext::optional effectiveQuoteCcyFreq = + std::optional effectiveQuoteCcyFreq = quoteCcyPaymentFrequency_ ? quoteCcyPaymentFrequency_ : paymentFrequency_; quoteCcyIborLeg_ = buildFloatingLeg(evaluationDate_, tenor_, fixingDays_, calendar_, convention_, endOfMonth_, quoteCcyIdx_, effectiveQuoteCcyFreq, paymentLag_); @@ -322,9 +322,9 @@ namespace QuantLib { const Handle& collateralCurve, bool isFxBaseCurrencyCollateralCurrency, bool isBasisOnFxBaseCurrencyLeg, - ext::optional paymentFrequency, + std::optional paymentFrequency, Integer paymentLag, - ext::optional quoteCurrencyPaymentFrequency) + std::optional quoteCurrencyPaymentFrequency) : CrossCurrencyBasisSwapRateHelperBase(basis, tenor, fixingDays, @@ -376,9 +376,9 @@ namespace QuantLib { bool isFxBaseCurrencyCollateralCurrency, bool isBasisOnFxBaseCurrencyLeg, bool isFxBaseCurrencyLegResettable, - ext::optional paymentFrequency, + std::optional paymentFrequency, Integer paymentLag, - ext::optional quoteCurrencyPaymentFrequency) + std::optional quoteCurrencyPaymentFrequency) : CrossCurrencyBasisSwapRateHelperBase(basis, tenor, fixingDays, diff --git a/ql/experimental/termstructures/crosscurrencyratehelpers.hpp b/ql/experimental/termstructures/crosscurrencyratehelpers.hpp index a2e55f51ce7..07a41e3816f 100644 --- a/ql/experimental/termstructures/crosscurrencyratehelpers.hpp +++ b/ql/experimental/termstructures/crosscurrencyratehelpers.hpp @@ -77,9 +77,9 @@ namespace QuantLib { Handle collateralCurve, bool isFxBaseCurrencyCollateralCurrency, bool isBasisOnFxBaseCurrencyLeg, - ext::optional paymentFrequency = ext::nullopt, + std::optional paymentFrequency = std::nullopt, Integer paymentLag = 0, - ext::optional quoteCurrencyPaymentFrequency = ext::nullopt); + std::optional quoteCurrencyPaymentFrequency = std::nullopt); void initializeDates() override; const Handle& baseCcyLegDiscountHandle() const; @@ -89,8 +89,8 @@ namespace QuantLib { ext::shared_ptr quoteCcyIdx_; bool isFxBaseCurrencyCollateralCurrency_; bool isBasisOnFxBaseCurrencyLeg_; - ext::optional paymentFrequency_; - ext::optional quoteCcyPaymentFrequency_; + std::optional paymentFrequency_; + std::optional quoteCcyPaymentFrequency_; Leg baseCcyIborLeg_; Leg quoteCcyIborLeg_; @@ -147,9 +147,9 @@ namespace QuantLib { const Handle& collateralCurve, bool isFxBaseCurrencyCollateralCurrency, bool isBasisOnFxBaseCurrencyLeg, - ext::optional paymentFrequency = ext::nullopt, + std::optional paymentFrequency = std::nullopt, Integer paymentLag = 0, - ext::optional quoteCurrencyPaymentFrequency = ext::nullopt); + std::optional quoteCurrencyPaymentFrequency = std::nullopt); //! \name RateHelper interface //@{ Real impliedQuote() const override; @@ -200,9 +200,9 @@ namespace QuantLib { bool isFxBaseCurrencyCollateralCurrency, bool isBasisOnFxBaseCurrencyLeg, bool isFxBaseCurrencyLegResettable, - ext::optional paymentFrequency = ext::nullopt, + std::optional paymentFrequency = std::nullopt, Integer paymentLag = 0, - ext::optional quoteCurrencyPaymentFrequency = ext::nullopt); + std::optional quoteCurrencyPaymentFrequency = std::nullopt); //! \name RateHelper interface //@{ Real impliedQuote() const override; diff --git a/ql/time/schedule.cpp b/ql/time/schedule.cpp index e2bf7fd6cd0..c491c1acbd1 100644 --- a/ql/time/schedule.cpp +++ b/ql/time/schedule.cpp @@ -53,10 +53,10 @@ namespace QuantLib { Schedule::Schedule(const std::vector& dates, Calendar calendar, BusinessDayConvention convention, - const ext::optional& terminationDateConvention, - const ext::optional& tenor, - const ext::optional& rule, - const ext::optional& endOfMonth, + const std::optional& terminationDateConvention, + const std::optional& tenor, + const std::optional& rule, + const std::optional& endOfMonth, std::vector isRegular) : tenor_(tenor), calendar_(std::move(calendar)), convention_(convention), terminationDateConvention_(terminationDateConvention), rule_(rule), dates_(dates), diff --git a/ql/time/schedule.hpp b/ql/time/schedule.hpp index 194f3c4bb8a..60c6ae5bd27 100644 --- a/ql/time/schedule.hpp +++ b/ql/time/schedule.hpp @@ -47,10 +47,10 @@ namespace QuantLib { const std::vector&, Calendar calendar = NullCalendar(), BusinessDayConvention convention = Unadjusted, - const ext::optional& terminationDateConvention = ext::nullopt, - const ext::optional& tenor = ext::nullopt, - const ext::optional& rule = ext::nullopt, - const ext::optional& endOfMonth = ext::nullopt, + const std::optional& terminationDateConvention = std::nullopt, + const std::optional& tenor = std::nullopt, + const std::optional& rule = std::nullopt, + const std::optional& endOfMonth = std::nullopt, std::vector isRegular = std::vector(0)); /*! rule based constructor */ Schedule(Date effectiveDate, @@ -109,12 +109,12 @@ namespace QuantLib { Schedule until(const Date& truncationDate) const; //@} private: - ext::optional tenor_; + std::optional tenor_; Calendar calendar_; BusinessDayConvention convention_; - ext::optional terminationDateConvention_; - ext::optional rule_; - ext::optional endOfMonth_; + std::optional terminationDateConvention_; + std::optional rule_; + std::optional endOfMonth_; Date firstDate_, nextToLastDate_; std::vector dates_; std::vector isRegular_; @@ -144,9 +144,9 @@ namespace QuantLib { private: Calendar calendar_; Date effectiveDate_, terminationDate_; - ext::optional tenor_; - ext::optional convention_; - ext::optional terminationDateConvention_; + std::optional tenor_; + std::optional convention_; + std::optional terminationDateConvention_; DateGeneration::Rule rule_ = DateGeneration::Backward; bool endOfMonth_ = false; Date firstDate_, nextToLastDate_; From d5746b7df9039fd5b04a91fb23c70fc677483a36 Mon Sep 17 00:00:00 2001 From: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Date: Fri, 5 Jun 2026 13:17:53 +0000 Subject: [PATCH 7/9] refactor(test-suite): migrate ext::optional -> std::optional Co-Authored-By: Toby Drinkall --- test-suite/blackvolsurfacedelta.cpp | 14 ++++++------- test-suite/cashflows.cpp | 8 ++++---- test-suite/creditdefaultswap.cpp | 6 +++--- test-suite/crosscurrencyratehelpers.cpp | 22 ++++++++++----------- test-suite/defaultprobabilitycurves.cpp | 2 +- test-suite/overnightindexedswap.cpp | 10 +++++----- test-suite/period.cpp | 2 +- test-suite/quantlibglobalfixture.cpp | 2 +- test-suite/ultimateforwardtermstructure.cpp | 2 +- 9 files changed, 34 insertions(+), 34 deletions(-) diff --git a/test-suite/blackvolsurfacedelta.cpp b/test-suite/blackvolsurfacedelta.cpp index 4e5dc27d496..0fe9f493374 100644 --- a/test-suite/blackvolsurfacedelta.cpp +++ b/test-suite/blackvolsurfacedelta.cpp @@ -165,7 +165,7 @@ BOOST_AUTO_TEST_CASE(testTimeExtrapolation) { BlackVolatilitySurfaceDelta surface1(refDate, dates, putDeltas, callDeltas, hasAtm, vols, ActualActual(ActualActual::ISDA), TARGET(), spot, dts, fts, DeltaVolQuote::DeltaType::Spot, DeltaVolQuote::AtmType::AtmSpot, - ext::nullopt, BlackVolatilitySurfaceDelta::SmileInterpolationMethod::Linear, false, + std::nullopt, BlackVolatilitySurfaceDelta::SmileInterpolationMethod::Linear, false, BlackVolTimeExtrapolation::FlatVolatility); QL_CHECK_CLOSE(surface1.blackVol(refDate + Period(2, Years), atmStrike), 0.095, 1e-8); @@ -179,7 +179,7 @@ BOOST_AUTO_TEST_CASE(testTimeExtrapolation) { BlackVolatilitySurfaceDelta surface2(refDate, dates, putDeltas, callDeltas, hasAtm, vols, ActualActual(ActualActual::ISDA), TARGET(), spot, dts, fts, DeltaVolQuote::DeltaType::Spot, DeltaVolQuote::AtmType::AtmSpot, - ext::nullopt, BlackVolatilitySurfaceDelta::SmileInterpolationMethod::Linear, false, + std::nullopt, BlackVolatilitySurfaceDelta::SmileInterpolationMethod::Linear, false, BlackVolTimeExtrapolation::LinearVariance); QL_CHECK_CLOSE(surface2.blackVol(refDate + Period(2, Years), atmStrike), 0.095, 1e-8); @@ -193,7 +193,7 @@ BOOST_AUTO_TEST_CASE(testTimeExtrapolation) { BlackVolatilitySurfaceDelta surface3(refDate, dates, putDeltas, callDeltas, hasAtm, vols, ActualActual(ActualActual::ISDA), TARGET(), spot, dts, fts, DeltaVolQuote::DeltaType::Spot, DeltaVolQuote::AtmType::AtmSpot, - ext::nullopt, BlackVolatilitySurfaceDelta::SmileInterpolationMethod::Linear, false, + std::nullopt, BlackVolatilitySurfaceDelta::SmileInterpolationMethod::Linear, false, BlackVolTimeExtrapolation::UseInterpolator); surface3.enableExtrapolation(); @@ -239,7 +239,7 @@ BOOST_AUTO_TEST_CASE(testSmileInterpolation) { BlackVolatilitySurfaceDelta surface1(refDate, dates, putDeltas, callDeltas, hasAtm, vols, ActualActual(ActualActual::ISDA), TARGET(), spot, dts, fts, DeltaVolQuote::DeltaType::Spot, DeltaVolQuote::AtmType::AtmSpot, - ext::nullopt, BlackVolatilitySurfaceDelta::SmileInterpolationMethod::Linear, false, + std::nullopt, BlackVolatilitySurfaceDelta::SmileInterpolationMethod::Linear, false, BlackVolTimeExtrapolation::FlatVolatility); auto smile = surface1.blackVolSmile(refDate + Period(6, Months)); @@ -253,7 +253,7 @@ BOOST_AUTO_TEST_CASE(testSmileInterpolation) { BlackVolatilitySurfaceDelta surface2(refDate, dates, putDeltas, callDeltas, hasAtm, vols, ActualActual(ActualActual::ISDA), TARGET(), spot, dts, fts, DeltaVolQuote::DeltaType::Spot, DeltaVolQuote::AtmType::AtmSpot, - ext::nullopt, BlackVolatilitySurfaceDelta::SmileInterpolationMethod::NaturalCubic, false, + std::nullopt, BlackVolatilitySurfaceDelta::SmileInterpolationMethod::NaturalCubic, false, BlackVolTimeExtrapolation::FlatVolatility); smile = surface2.blackVolSmile(refDate + Period(6, Months)); @@ -268,7 +268,7 @@ BOOST_AUTO_TEST_CASE(testSmileInterpolation) { BlackVolatilitySurfaceDelta surface3(refDate, dates, putDeltas, callDeltas, hasAtm, vols, ActualActual(ActualActual::ISDA), TARGET(), spot, dts, fts, DeltaVolQuote::DeltaType::Spot, DeltaVolQuote::AtmType::AtmSpot, - ext::nullopt, BlackVolatilitySurfaceDelta::SmileInterpolationMethod::FinancialCubic, false, + std::nullopt, BlackVolatilitySurfaceDelta::SmileInterpolationMethod::FinancialCubic, false, BlackVolTimeExtrapolation::FlatVolatility); smile = surface3.blackVolSmile(refDate + Period(6, Months)); @@ -282,7 +282,7 @@ BOOST_AUTO_TEST_CASE(testSmileInterpolation) { BlackVolatilitySurfaceDelta surface4(refDate, dates, putDeltas, callDeltas, hasAtm, vols, ActualActual(ActualActual::ISDA), TARGET(), spot, dts, fts, DeltaVolQuote::DeltaType::Spot, DeltaVolQuote::AtmType::AtmSpot, - ext::nullopt, BlackVolatilitySurfaceDelta::SmileInterpolationMethod::CubicSpline, false, + std::nullopt, BlackVolatilitySurfaceDelta::SmileInterpolationMethod::CubicSpline, false, BlackVolTimeExtrapolation::FlatVolatility); smile = surface4.blackVolSmile(refDate + Period(6, Months)); diff --git a/test-suite/cashflows.cpp b/test-suite/cashflows.cpp index ebd1d30d723..84ac77a0492 100644 --- a/test-suite/cashflows.cpp +++ b/test-suite/cashflows.cpp @@ -70,7 +70,7 @@ BOOST_AUTO_TEST_CASE(testSettings) { // today's date Settings::instance().includeReferenceDateEvents() = false; - Settings::instance().includeTodaysCashFlows() = ext::nullopt; + Settings::instance().includeTodaysCashFlows() = std::nullopt; CHECK_INCLUSION(0, 0, false); CHECK_INCLUSION(0, 1, false); @@ -103,7 +103,7 @@ BOOST_AUTO_TEST_CASE(testSettings) { // today's date Settings::instance().includeReferenceDateEvents() = true; - Settings::instance().includeTodaysCashFlows() = ext::nullopt; + Settings::instance().includeTodaysCashFlows() = std::nullopt; CHECK_INCLUSION(0, 0, true); CHECK_INCLUSION(0, 1, false); @@ -165,7 +165,7 @@ BOOST_AUTO_TEST_CASE(testSettings) { } while (false); // no override - Settings::instance().includeTodaysCashFlows() = ext::nullopt; + Settings::instance().includeTodaysCashFlows() = std::nullopt; CHECK_NPV(false, 2.0); CHECK_NPV(true, 3.0); @@ -436,7 +436,7 @@ BOOST_AUTO_TEST_CASE(testPartialScheduleLegConstruction) { .backwards(); // same schedule, date based, with metadata Schedule schedule2(schedule.dates(), NullCalendar(), Unadjusted, Unadjusted, - 6 * Months, ext::nullopt, schedule.endOfMonth(), + 6 * Months, std::nullopt, schedule.endOfMonth(), schedule.isRegular()); // same schedule, date based, without metadata Schedule schedule3(schedule.dates()); diff --git a/test-suite/creditdefaultswap.cpp b/test-suite/creditdefaultswap.cpp index ccc1f72fa2f..bb280bb5aa8 100644 --- a/test-suite/creditdefaultswap.cpp +++ b/test-suite/creditdefaultswap.cpp @@ -684,7 +684,7 @@ BOOST_AUTO_TEST_CASE(testIsdaEngine) { ext::make_shared(0, WeekendsOnly(), h, Actual365Fixed())); ext::shared_ptr engine = ext::make_shared( - probabilityCurve, recovery, discountCurve, ext::nullopt, IsdaCdsEngine::Taylor, + probabilityCurve, recovery, discountCurve, std::nullopt, IsdaCdsEngine::Taylor, IsdaCdsEngine::HalfDayBias, IsdaCdsEngine::Piecewise); ext::shared_ptr conventionalTrade = @@ -827,7 +827,7 @@ BOOST_AUTO_TEST_CASE(testIsdaCalculatorReconcileSingleQuote) { ext::make_shared(0, WeekendsOnly(), h, Actual365Fixed())); ext::shared_ptr engine = ext::make_shared( - probabilityCurve, recovery, discountCurve, ext::nullopt, IsdaCdsEngine::Taylor, + probabilityCurve, recovery, discountCurve, std::nullopt, IsdaCdsEngine::Taylor, IsdaCdsEngine::HalfDayBias, IsdaCdsEngine::Piecewise); ext::shared_ptr conventionalTrade = @@ -939,7 +939,7 @@ BOOST_AUTO_TEST_CASE(testIsdaCalculatorReconcileSingleWithIssueDateInThePast) { ext::make_shared(0, WeekendsOnly(), h, Actual365Fixed())); ext::shared_ptr engine = ext::make_shared( - probabilityCurve, recovery, discountCurve, ext::nullopt, IsdaCdsEngine::Taylor, + probabilityCurve, recovery, discountCurve, std::nullopt, IsdaCdsEngine::Taylor, IsdaCdsEngine::HalfDayBias, IsdaCdsEngine::Piecewise); ext::shared_ptr conventionalTrade = diff --git a/test-suite/crosscurrencyratehelpers.cpp b/test-suite/crosscurrencyratehelpers.cpp index d0b3bf740a0..95b7b0142ad 100644 --- a/test-suite/crosscurrencyratehelpers.cpp +++ b/test-suite/crosscurrencyratehelpers.cpp @@ -114,10 +114,10 @@ struct CommonVars { bool isFxBaseCurrencyCollateralCurrency, bool isBasisOnFxBaseCurrencyLeg, bool isFxBaseCurrencyLegResettable, - ext::optional paymentFrequency = ext::nullopt, + std::optional paymentFrequency = std::nullopt, Integer paymentLag = 0, bool useOvernightIndex = false, - ext::optional quoteCcyPaymentFrequency = ext::nullopt) const { + std::optional quoteCcyPaymentFrequency = std::nullopt) const { Handle quoteHandle(ext::make_shared(q.basis * basisPoint)); Period tenor(q.n, q.units); ext::shared_ptr baseIndex, quoteIndex; @@ -142,10 +142,10 @@ struct CommonVars { bool isFxBaseCurrencyCollateralCurrency, bool isBasisOnFxBaseCurrencyLeg, bool isFxBaseCurrencyLegResettable, - ext::optional paymentFrequency = ext::nullopt, + std::optional paymentFrequency = std::nullopt, Integer paymentLag = 0, bool useOvernightQuoteIndex = false, - ext::optional quoteCcyPaymentFrequency = ext::nullopt) const { + std::optional quoteCcyPaymentFrequency = std::nullopt) const { std::vector > instruments; instruments.reserve(xccyData.size()); for (const auto& i : xccyData) { @@ -314,10 +314,10 @@ void testConstantNotionalCrossCurrencySwapsNPV(bool isFxBaseCurrencyCollateralCu void testResettingCrossCurrencySwaps(bool isFxBaseCurrencyCollateralCurrency, bool isBasisOnFxBaseCurrencyLeg, bool isFxBaseCurrencyLegResettable, - ext::optional paymentFrequency = ext::nullopt, + std::optional paymentFrequency = std::nullopt, Integer paymentLag = 0, bool useOvernightIndex = false, - ext::optional quoteCcyPaymentFrequency = ext::nullopt) { + std::optional quoteCcyPaymentFrequency = std::nullopt) { CommonVars vars; @@ -499,8 +499,8 @@ BOOST_AUTO_TEST_CASE(testResettingBasisSwapsTreatNoFrequencyAsUnset) { std::vector > defaultInstruments = vars.buildResettingXccyRateHelpers( vars.basisData, collateralHandle, isFxBaseCurrencyCollateralCurrency, - isBasisOnFxBaseCurrencyLeg, isFxBaseCurrencyLegResettable, ext::nullopt, 0, false, - ext::nullopt); + isBasisOnFxBaseCurrencyLeg, isFxBaseCurrencyLegResettable, std::nullopt, 0, false, + std::nullopt); // An explicit NoFrequency on both legs must behave identically. Before // NoFrequency was normalized to nullopt it built a single-period schedule @@ -555,7 +555,7 @@ BOOST_AUTO_TEST_CASE(testResettingBasisSwapsQuoteFrequencyDefaultsToBase) { vars.buildResettingXccyRateHelpers( vars.basisData, collateralHandle, isFxBaseCurrencyCollateralCurrency, isBasisOnFxBaseCurrencyLeg, isFxBaseCurrencyLegResettable, baseFrequency, 0, false, - ext::nullopt); + std::nullopt); // Quote-currency frequency set explicitly to the base frequency: same result. std::vector > explicitInstruments = @@ -596,7 +596,7 @@ BOOST_AUTO_TEST_CASE(testResettingBasisSwapsWithPaymentLag) { bool isBasisOnFxBaseCurrencyLeg = true; testResettingCrossCurrencySwaps(isFxBaseCurrencyCollateralCurrency, isBasisOnFxBaseCurrencyLeg, - isFxBaseCurrencyLegResettable, ext::nullopt, 2); + isFxBaseCurrencyLegResettable, std::nullopt, 2); } BOOST_AUTO_TEST_CASE(testResettingBasisSwapsWithOvernightIndex) { @@ -621,7 +621,7 @@ BOOST_AUTO_TEST_CASE(testResettingBasisSwapsWithOvernightIndexException) { BOOST_CHECK_THROW(testResettingCrossCurrencySwaps( isFxBaseCurrencyCollateralCurrency, isBasisOnFxBaseCurrencyLeg, - isFxBaseCurrencyLegResettable, ext::nullopt, 0, true), + isFxBaseCurrencyLegResettable, std::nullopt, 0, true), Error); } diff --git a/test-suite/defaultprobabilitycurves.cpp b/test-suite/defaultprobabilitycurves.cpp index 8d44478409b..ba4b6a798e6 100644 --- a/test-suite/defaultprobabilitycurves.cpp +++ b/test-suite/defaultprobabilitycurves.cpp @@ -390,7 +390,7 @@ BOOST_AUTO_TEST_CASE(testUpfrontBootstrap) { // This checks that UpfrontCdsHelper::impliedQuote() didn't // override the flag permanently; after the bootstrap, it should // go back to its previous value. - ext::optional flag = Settings::instance().includeTodaysCashFlows(); + std::optional flag = Settings::instance().includeTodaysCashFlows(); if (flag != false) BOOST_ERROR("Cash-flow settings improperly modified"); } diff --git a/test-suite/overnightindexedswap.cpp b/test-suite/overnightindexedswap.cpp index a065295afe9..f3566b24042 100644 --- a/test-suite/overnightindexedswap.cpp +++ b/test-suite/overnightindexedswap.cpp @@ -456,8 +456,8 @@ BOOST_AUTO_TEST_CASE(testBootstrapWithCustomPricer) { Pillar::LastRelevantDate, Date(), averagingMethod, - ext::nullopt, - ext::nullopt, + std::nullopt, + std::nullopt, Calendar(), Null(), 0, @@ -527,8 +527,8 @@ void testBootstrapWithLookback(Natural lookbackDays, Pillar::LastRelevantDate, Date(), RateAveraging::Compound, - ext::nullopt, - ext::nullopt, + std::nullopt, + std::nullopt, Calendar(), lookbackDays, lockoutDays, @@ -763,7 +763,7 @@ for (auto & i : data) { false, 0, Following, Annual, calendar, 0*Days, 0.0, Pillar::LastRelevantDate, Date(), - RateAveraging::Compound, ext::nullopt, ext::nullopt, + RateAveraging::Compound, std::nullopt, std::nullopt, calendar, Null(), 0, false, ext::shared_ptr(), DateGeneration::Backward, calendar)); diff --git a/test-suite/period.cpp b/test-suite/period.cpp index 2b790e5a25b..6a7c24ac7e7 100644 --- a/test-suite/period.cpp +++ b/test-suite/period.cpp @@ -216,7 +216,7 @@ BOOST_AUTO_TEST_CASE(testNormalization) { for (Period p2 : test_values) { auto n2 = p2.normalized(); - ext::optional comparison; + std::optional comparison; try { comparison = (p1 == p2); } catch (Error&) { diff --git a/test-suite/quantlibglobalfixture.cpp b/test-suite/quantlibglobalfixture.cpp index d7a078998b6..0d25eab253b 100644 --- a/test-suite/quantlibglobalfixture.cpp +++ b/test-suite/quantlibglobalfixture.cpp @@ -39,7 +39,7 @@ namespace { */ // QuantLib::Settings::instance().includeReferenceDateCashFlows() = true; - // QuantLib::Settings::instance().includeTodaysCashFlows() = ext::nullopt; + // QuantLib::Settings::instance().includeTodaysCashFlows() = std::nullopt; QuantLib::Settings::instance().evaluationDate() = evaluationDate; } diff --git a/test-suite/ultimateforwardtermstructure.cpp b/test-suite/ultimateforwardtermstructure.cpp index 08e2cbb821f..8405401eb01 100644 --- a/test-suite/ultimateforwardtermstructure.cpp +++ b/test-suite/ultimateforwardtermstructure.cpp @@ -138,7 +138,7 @@ Rate calculateExtrapolatedForward(Time t, Time fsp, Rate llfr, Rate ufr, Real al } void checkDutchBankRates(const std::vector& expectedRates, - const ext::optional& rounding = ext::nullopt, + const std::optional& rounding = std::nullopt, Compounding compounding = Compounded, Frequency frequency = Annual, Real tolerance = 1.0e-4) { From 8b38a5d21ff152cf9dcacc36f34d72b8b56538e1 Mon Sep 17 00:00:00 2001 From: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Date: Fri, 5 Jun 2026 13:19:36 +0000 Subject: [PATCH 8/9] refactor: swap #include -> #include across all files Co-Authored-By: Toby Drinkall --- ql/cashflow.cpp | 1 + ql/cashflow.hpp | 2 +- ql/cashflows/cashflows.cpp | 1 + ql/cashflows/cashflows.hpp | 1 + ql/cashflows/couponpricer.cpp | 2 +- ql/cashflows/couponpricer.hpp | 2 +- ql/cashflows/iborcoupon.cpp | 2 +- ql/cashflows/iborcoupon.hpp | 2 +- ql/cashflows/overnightindexedcoupon.cpp | 1 + ql/cashflows/overnightindexedcoupon.hpp | 1 + ql/event.cpp | 2 +- ql/event.hpp | 2 +- ql/experimental/catbonds/montecarlocatbondengine.cpp | 2 +- ql/experimental/catbonds/montecarlocatbondengine.hpp | 2 +- ql/experimental/coupons/lognormalcmsspreadpricer.cpp | 2 +- ql/experimental/coupons/lognormalcmsspreadpricer.hpp | 2 +- ql/experimental/credit/syntheticcdo.cpp | 2 +- ql/experimental/credit/syntheticcdo.hpp | 2 +- ql/experimental/termstructures/crosscurrencyratehelpers.cpp | 1 + ql/experimental/termstructures/crosscurrencyratehelpers.hpp | 2 +- ql/instruments/bond.cpp | 1 + ql/instruments/callabilityschedule.hpp | 2 +- ql/instruments/creditdefaultswap.cpp | 2 +- ql/instruments/creditdefaultswap.hpp | 2 +- ql/instruments/fixedvsfloatingswap.cpp | 1 + ql/instruments/fixedvsfloatingswap.hpp | 2 +- ql/instruments/floatfloatswap.cpp | 2 +- ql/instruments/floatfloatswap.hpp | 2 +- ql/instruments/makecds.hpp | 2 +- ql/instruments/makeois.hpp | 1 + ql/instruments/makeswaption.cpp | 2 +- ql/instruments/makeswaption.hpp | 2 +- ql/instruments/makevanillaswap.cpp | 2 +- ql/instruments/makevanillaswap.hpp | 1 + ql/instruments/multipleresetsswap.cpp | 1 + ql/instruments/multipleresetsswap.hpp | 1 + ql/instruments/nonstandardswap.cpp | 2 +- ql/instruments/nonstandardswap.hpp | 2 +- ql/instruments/overnightindexedswap.cpp | 1 + ql/instruments/vanillaswap.cpp | 1 + ql/instruments/vanillaswap.hpp | 2 +- ql/pricingengines/bond/discountingbondengine.cpp | 2 +- ql/pricingengines/bond/discountingbondengine.hpp | 2 +- ql/pricingengines/capfloor/analyticcapfloorengine.cpp | 2 +- ql/pricingengines/credit/integralcdsengine.cpp | 2 +- ql/pricingengines/credit/integralcdsengine.hpp | 2 +- ql/pricingengines/credit/isdacdsengine.cpp | 2 +- ql/pricingengines/credit/isdacdsengine.hpp | 2 +- ql/pricingengines/credit/midpointcdsengine.cpp | 2 +- ql/pricingengines/credit/midpointcdsengine.hpp | 2 +- ql/pricingengines/futures/discountingperpetualfuturesengine.hpp | 2 +- ql/pricingengines/mclongstaffschwartzengine.hpp | 2 +- .../swap/discountingconstnotionalcrosscurrencyswapengine.cpp | 1 + .../swap/discountingconstnotionalcrosscurrencyswapengine.hpp | 2 +- ql/pricingengines/swap/discountingswapengine.cpp | 2 +- ql/pricingengines/swap/discountingswapengine.hpp | 2 +- ql/pricingengines/vanilla/mcamericanengine.hpp | 2 +- ql/settings.hpp | 2 +- ql/termstructures/volatility/equityfx/blackvolsurfacedelta.cpp | 1 + ql/termstructures/volatility/equityfx/blackvolsurfacedelta.hpp | 1 + ql/termstructures/volatility/optionlet/optionletstripper.cpp | 1 + ql/termstructures/volatility/optionlet/optionletstripper.hpp | 1 + ql/termstructures/volatility/optionlet/optionletstripper1.cpp | 1 + ql/termstructures/volatility/optionlet/optionletstripper1.hpp | 1 + ql/termstructures/yield/oisratehelper.cpp | 1 + ql/termstructures/yield/oisratehelper.hpp | 2 +- ql/termstructures/yield/ratehelpers.cpp | 2 +- ql/termstructures/yield/ratehelpers.hpp | 2 +- ql/termstructures/yield/ultimateforwardtermstructure.hpp | 2 +- ql/time/schedule.cpp | 2 +- ql/time/schedule.hpp | 2 +- test-suite/blackvolsurfacedelta.cpp | 1 + test-suite/cashflows.cpp | 2 +- test-suite/creditdefaultswap.cpp | 2 +- test-suite/crosscurrencyratehelpers.cpp | 2 +- test-suite/defaultprobabilitycurves.cpp | 1 + test-suite/overnightindexedswap.cpp | 1 + test-suite/period.cpp | 1 + test-suite/ultimateforwardtermstructure.cpp | 1 + 79 files changed, 79 insertions(+), 52 deletions(-) diff --git a/ql/cashflow.cpp b/ql/cashflow.cpp index 2da64b349dd..2e936bea9a9 100644 --- a/ql/cashflow.cpp +++ b/ql/cashflow.cpp @@ -21,6 +21,7 @@ #include #include #include +#include namespace QuantLib { diff --git a/ql/cashflow.hpp b/ql/cashflow.hpp index 5fa349cac8b..82d115190ec 100644 --- a/ql/cashflow.hpp +++ b/ql/cashflow.hpp @@ -27,7 +27,7 @@ #include #include -#include +#include #include #include diff --git a/ql/cashflows/cashflows.cpp b/ql/cashflows/cashflows.cpp index 6686a8cbd0f..73906ec00e9 100644 --- a/ql/cashflows/cashflows.cpp +++ b/ql/cashflows/cashflows.cpp @@ -29,6 +29,7 @@ #include #include #include +#include #include namespace QuantLib { diff --git a/ql/cashflows/cashflows.hpp b/ql/cashflows/cashflows.hpp index 5a094004c1e..4f42d16f45f 100644 --- a/ql/cashflows/cashflows.hpp +++ b/ql/cashflows/cashflows.hpp @@ -31,6 +31,7 @@ #include #include #include +#include namespace QuantLib { diff --git a/ql/cashflows/couponpricer.cpp b/ql/cashflows/couponpricer.cpp index ca13de85c81..bbfde442fd6 100644 --- a/ql/cashflows/couponpricer.cpp +++ b/ql/cashflows/couponpricer.cpp @@ -34,7 +34,7 @@ #include /* internal */ #include #include -#include +#include #include namespace QuantLib { diff --git a/ql/cashflows/couponpricer.hpp b/ql/cashflows/couponpricer.hpp index b06e4bed72f..6075adb2537 100644 --- a/ql/cashflows/couponpricer.hpp +++ b/ql/cashflows/couponpricer.hpp @@ -30,7 +30,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/ql/cashflows/iborcoupon.cpp b/ql/cashflows/iborcoupon.cpp index c5989ad63e2..89fd5819770 100644 --- a/ql/cashflows/iborcoupon.cpp +++ b/ql/cashflows/iborcoupon.cpp @@ -27,7 +27,7 @@ #include #include #include -#include +#include #include namespace QuantLib { diff --git a/ql/cashflows/iborcoupon.hpp b/ql/cashflows/iborcoupon.hpp index 420ae78f4fe..16922c21f8c 100644 --- a/ql/cashflows/iborcoupon.hpp +++ b/ql/cashflows/iborcoupon.hpp @@ -33,7 +33,7 @@ #include #include #include -#include +#include namespace QuantLib { diff --git a/ql/cashflows/overnightindexedcoupon.cpp b/ql/cashflows/overnightindexedcoupon.cpp index 68c16ba32cb..36409ea10ac 100644 --- a/ql/cashflows/overnightindexedcoupon.cpp +++ b/ql/cashflows/overnightindexedcoupon.cpp @@ -30,6 +30,7 @@ #include #include #include +#include #include #include #include diff --git a/ql/cashflows/overnightindexedcoupon.hpp b/ql/cashflows/overnightindexedcoupon.hpp index a43fb2a21eb..054c92f8c63 100644 --- a/ql/cashflows/overnightindexedcoupon.hpp +++ b/ql/cashflows/overnightindexedcoupon.hpp @@ -34,6 +34,7 @@ #include #include #include +#include namespace QuantLib { diff --git a/ql/event.cpp b/ql/event.cpp index 7836ed61c98..d8a15cc81df 100644 --- a/ql/event.cpp +++ b/ql/event.cpp @@ -20,7 +20,7 @@ #include #include -#include +#include #include namespace QuantLib { diff --git a/ql/event.hpp b/ql/event.hpp index e360d49c4a0..0466484b39d 100644 --- a/ql/event.hpp +++ b/ql/event.hpp @@ -27,7 +27,7 @@ #include #include -#include +#include namespace QuantLib { diff --git a/ql/experimental/catbonds/montecarlocatbondengine.cpp b/ql/experimental/catbonds/montecarlocatbondengine.cpp index 4a494050638..b86de1632c1 100644 --- a/ql/experimental/catbonds/montecarlocatbondengine.cpp +++ b/ql/experimental/catbonds/montecarlocatbondengine.cpp @@ -19,7 +19,7 @@ #include #include -#include +#include #include #include diff --git a/ql/experimental/catbonds/montecarlocatbondengine.hpp b/ql/experimental/catbonds/montecarlocatbondengine.hpp index 76ae6f8b90f..f4388e89ab5 100644 --- a/ql/experimental/catbonds/montecarlocatbondengine.hpp +++ b/ql/experimental/catbonds/montecarlocatbondengine.hpp @@ -24,7 +24,7 @@ #ifndef quantlib_montecarlo_catbond_engine_hpp #define quantlib_montecarlo_catbond_engine_hpp -#include +#include #include namespace QuantLib { diff --git a/ql/experimental/coupons/lognormalcmsspreadpricer.cpp b/ql/experimental/coupons/lognormalcmsspreadpricer.cpp index 098759c2224..f16cf18be04 100644 --- a/ql/experimental/coupons/lognormalcmsspreadpricer.cpp +++ b/ql/experimental/coupons/lognormalcmsspreadpricer.cpp @@ -25,7 +25,7 @@ #include #include #include -#include +#include #include using std::sqrt; diff --git a/ql/experimental/coupons/lognormalcmsspreadpricer.hpp b/ql/experimental/coupons/lognormalcmsspreadpricer.hpp index 9c933176891..ab29236efc9 100644 --- a/ql/experimental/coupons/lognormalcmsspreadpricer.hpp +++ b/ql/experimental/coupons/lognormalcmsspreadpricer.hpp @@ -31,7 +31,7 @@ #include #include #include -#include +#include namespace QuantLib { diff --git a/ql/experimental/credit/syntheticcdo.cpp b/ql/experimental/credit/syntheticcdo.cpp index fc653e2041d..923f4601ee7 100644 --- a/ql/experimental/credit/syntheticcdo.cpp +++ b/ql/experimental/credit/syntheticcdo.cpp @@ -27,7 +27,7 @@ #include #include #include -#include +#include using namespace std; diff --git a/ql/experimental/credit/syntheticcdo.hpp b/ql/experimental/credit/syntheticcdo.hpp index 94b06656d23..60fa96a0f52 100644 --- a/ql/experimental/credit/syntheticcdo.hpp +++ b/ql/experimental/credit/syntheticcdo.hpp @@ -30,7 +30,7 @@ #include #include -#include +#include #include #include diff --git a/ql/experimental/termstructures/crosscurrencyratehelpers.cpp b/ql/experimental/termstructures/crosscurrencyratehelpers.cpp index c4b8740b994..bc9c6781623 100644 --- a/ql/experimental/termstructures/crosscurrencyratehelpers.cpp +++ b/ql/experimental/termstructures/crosscurrencyratehelpers.cpp @@ -26,6 +26,7 @@ #include #include #include +#include #include namespace QuantLib { diff --git a/ql/experimental/termstructures/crosscurrencyratehelpers.hpp b/ql/experimental/termstructures/crosscurrencyratehelpers.hpp index 07a41e3816f..ad0e4a2a732 100644 --- a/ql/experimental/termstructures/crosscurrencyratehelpers.hpp +++ b/ql/experimental/termstructures/crosscurrencyratehelpers.hpp @@ -27,7 +27,7 @@ #include #include -#include +#include namespace QuantLib { diff --git a/ql/instruments/bond.cpp b/ql/instruments/bond.cpp index 5f27473efdf..82f85b7b18b 100644 --- a/ql/instruments/bond.cpp +++ b/ql/instruments/bond.cpp @@ -31,6 +31,7 @@ #include #include #include +#include #include namespace QuantLib { diff --git a/ql/instruments/callabilityschedule.hpp b/ql/instruments/callabilityschedule.hpp index 3f52566fb39..5a56e688be2 100644 --- a/ql/instruments/callabilityschedule.hpp +++ b/ql/instruments/callabilityschedule.hpp @@ -30,7 +30,7 @@ #include #include #include -#include +#include #include namespace QuantLib { diff --git a/ql/instruments/creditdefaultswap.cpp b/ql/instruments/creditdefaultswap.cpp index f4f0b37c4ca..def324b2136 100644 --- a/ql/instruments/creditdefaultswap.cpp +++ b/ql/instruments/creditdefaultswap.cpp @@ -31,7 +31,7 @@ #include #include #include -#include +#include #include namespace QuantLib { diff --git a/ql/instruments/creditdefaultswap.hpp b/ql/instruments/creditdefaultswap.hpp index 17eecbbe90c..d4b4433ed5e 100644 --- a/ql/instruments/creditdefaultswap.hpp +++ b/ql/instruments/creditdefaultswap.hpp @@ -31,7 +31,7 @@ #include #include #include -#include +#include namespace QuantLib { diff --git a/ql/instruments/fixedvsfloatingswap.cpp b/ql/instruments/fixedvsfloatingswap.cpp index 0847b45039c..c4fabb11d62 100644 --- a/ql/instruments/fixedvsfloatingswap.cpp +++ b/ql/instruments/fixedvsfloatingswap.cpp @@ -26,6 +26,7 @@ #include #include #include +#include #include namespace QuantLib { diff --git a/ql/instruments/fixedvsfloatingswap.hpp b/ql/instruments/fixedvsfloatingswap.hpp index e1b38a598e6..b1e4b08011e 100644 --- a/ql/instruments/fixedvsfloatingswap.hpp +++ b/ql/instruments/fixedvsfloatingswap.hpp @@ -29,7 +29,7 @@ #include #include #include -#include +#include namespace QuantLib { diff --git a/ql/instruments/floatfloatswap.cpp b/ql/instruments/floatfloatswap.cpp index 65bc64e7ced..34c9f5f3bec 100644 --- a/ql/instruments/floatfloatswap.cpp +++ b/ql/instruments/floatfloatswap.cpp @@ -29,7 +29,7 @@ #include #include #include -#include +#include #include namespace QuantLib { diff --git a/ql/instruments/floatfloatswap.hpp b/ql/instruments/floatfloatswap.hpp index 9a1b779f320..8e7110a4b90 100644 --- a/ql/instruments/floatfloatswap.hpp +++ b/ql/instruments/floatfloatswap.hpp @@ -32,7 +32,7 @@ #include #include #include -#include +#include namespace QuantLib { diff --git a/ql/instruments/makecds.hpp b/ql/instruments/makecds.hpp index 778ea98b01c..974f42640bd 100644 --- a/ql/instruments/makecds.hpp +++ b/ql/instruments/makecds.hpp @@ -27,7 +27,7 @@ #include #include -#include +#include namespace QuantLib { diff --git a/ql/instruments/makeois.hpp b/ql/instruments/makeois.hpp index f527408e321..aacaa301dfa 100644 --- a/ql/instruments/makeois.hpp +++ b/ql/instruments/makeois.hpp @@ -29,6 +29,7 @@ #include #include #include +#include namespace QuantLib { diff --git a/ql/instruments/makeswaption.cpp b/ql/instruments/makeswaption.cpp index 3c9f7cacc08..7b7d3bf80c5 100644 --- a/ql/instruments/makeswaption.cpp +++ b/ql/instruments/makeswaption.cpp @@ -25,7 +25,7 @@ #include #include #include -#include +#include #include #include diff --git a/ql/instruments/makeswaption.hpp b/ql/instruments/makeswaption.hpp index 8dd48c2c6ec..7a320ef3480 100644 --- a/ql/instruments/makeswaption.hpp +++ b/ql/instruments/makeswaption.hpp @@ -27,7 +27,7 @@ #include #include -#include +#include namespace QuantLib { diff --git a/ql/instruments/makevanillaswap.cpp b/ql/instruments/makevanillaswap.cpp index 9cccb3e5266..01f11abec51 100644 --- a/ql/instruments/makevanillaswap.cpp +++ b/ql/instruments/makevanillaswap.cpp @@ -33,7 +33,7 @@ #include #include #include -#include +#include namespace QuantLib { diff --git a/ql/instruments/makevanillaswap.hpp b/ql/instruments/makevanillaswap.hpp index 5ef15ee0787..6f1c390edf9 100644 --- a/ql/instruments/makevanillaswap.hpp +++ b/ql/instruments/makevanillaswap.hpp @@ -29,6 +29,7 @@ #include #include #include +#include namespace QuantLib { diff --git a/ql/instruments/multipleresetsswap.cpp b/ql/instruments/multipleresetsswap.cpp index fc9cb39bf61..d466b570811 100644 --- a/ql/instruments/multipleresetsswap.cpp +++ b/ql/instruments/multipleresetsswap.cpp @@ -19,6 +19,7 @@ #include #include +#include #include namespace QuantLib { diff --git a/ql/instruments/multipleresetsswap.hpp b/ql/instruments/multipleresetsswap.hpp index 1a4fb6de5ae..753e3474d88 100644 --- a/ql/instruments/multipleresetsswap.hpp +++ b/ql/instruments/multipleresetsswap.hpp @@ -27,6 +27,7 @@ #include #include #include +#include namespace QuantLib { diff --git a/ql/instruments/nonstandardswap.cpp b/ql/instruments/nonstandardswap.cpp index 7e70cb713ae..b474f9573f3 100644 --- a/ql/instruments/nonstandardswap.cpp +++ b/ql/instruments/nonstandardswap.cpp @@ -28,7 +28,7 @@ #include #include #include -#include +#include #include namespace QuantLib { diff --git a/ql/instruments/nonstandardswap.hpp b/ql/instruments/nonstandardswap.hpp index 08c41820044..c1895313184 100644 --- a/ql/instruments/nonstandardswap.hpp +++ b/ql/instruments/nonstandardswap.hpp @@ -28,7 +28,7 @@ #include #include #include -#include +#include namespace QuantLib { diff --git a/ql/instruments/overnightindexedswap.cpp b/ql/instruments/overnightindexedswap.cpp index b75872deaf4..83768771d46 100644 --- a/ql/instruments/overnightindexedswap.cpp +++ b/ql/instruments/overnightindexedswap.cpp @@ -23,6 +23,7 @@ #include #include #include +#include #include namespace QuantLib { diff --git a/ql/instruments/vanillaswap.cpp b/ql/instruments/vanillaswap.cpp index 15bd895c638..7c996a9fac2 100644 --- a/ql/instruments/vanillaswap.cpp +++ b/ql/instruments/vanillaswap.cpp @@ -23,6 +23,7 @@ #include #include #include +#include #include namespace QuantLib { diff --git a/ql/instruments/vanillaswap.hpp b/ql/instruments/vanillaswap.hpp index fd2e2802b02..12137458b77 100644 --- a/ql/instruments/vanillaswap.hpp +++ b/ql/instruments/vanillaswap.hpp @@ -29,7 +29,7 @@ #include #include #include -#include +#include namespace QuantLib { diff --git a/ql/pricingengines/bond/discountingbondengine.cpp b/ql/pricingengines/bond/discountingbondengine.cpp index 4bd306cb6e5..4096744cfe2 100644 --- a/ql/pricingengines/bond/discountingbondengine.cpp +++ b/ql/pricingengines/bond/discountingbondengine.cpp @@ -20,7 +20,7 @@ #include #include -#include +#include #include namespace QuantLib { diff --git a/ql/pricingengines/bond/discountingbondengine.hpp b/ql/pricingengines/bond/discountingbondengine.hpp index 65a44b7ed3d..d4ff4a1812f 100644 --- a/ql/pricingengines/bond/discountingbondengine.hpp +++ b/ql/pricingengines/bond/discountingbondengine.hpp @@ -28,7 +28,7 @@ #include #include #include -#include +#include namespace QuantLib { diff --git a/ql/pricingengines/capfloor/analyticcapfloorengine.cpp b/ql/pricingengines/capfloor/analyticcapfloorengine.cpp index 6faa2da1629..1617400282d 100644 --- a/ql/pricingengines/capfloor/analyticcapfloorengine.cpp +++ b/ql/pricingengines/capfloor/analyticcapfloorengine.cpp @@ -18,7 +18,7 @@ */ #include -#include +#include #include namespace QuantLib { diff --git a/ql/pricingengines/credit/integralcdsengine.cpp b/ql/pricingengines/credit/integralcdsengine.cpp index a9a0f76249f..c55a4934622 100644 --- a/ql/pricingengines/credit/integralcdsengine.cpp +++ b/ql/pricingengines/credit/integralcdsengine.cpp @@ -23,7 +23,7 @@ #include #include #include -#include +#include #include namespace QuantLib { diff --git a/ql/pricingengines/credit/integralcdsengine.hpp b/ql/pricingengines/credit/integralcdsengine.hpp index 844a95a1145..42aaeaae8d4 100644 --- a/ql/pricingengines/credit/integralcdsengine.hpp +++ b/ql/pricingengines/credit/integralcdsengine.hpp @@ -26,7 +26,7 @@ #define quantlib_integral_cds_engine_hpp #include -#include +#include namespace QuantLib { diff --git a/ql/pricingengines/credit/isdacdsengine.cpp b/ql/pricingengines/credit/isdacdsengine.cpp index 9298d7dcc68..b18b8dd0542 100644 --- a/ql/pricingengines/credit/isdacdsengine.cpp +++ b/ql/pricingengines/credit/isdacdsengine.cpp @@ -28,7 +28,7 @@ #include #include #include -#include +#include #include namespace QuantLib { diff --git a/ql/pricingengines/credit/isdacdsengine.hpp b/ql/pricingengines/credit/isdacdsengine.hpp index 791c8d86a95..0ea2913257e 100644 --- a/ql/pricingengines/credit/isdacdsengine.hpp +++ b/ql/pricingengines/credit/isdacdsengine.hpp @@ -28,7 +28,7 @@ #include #include #include -#include +#include namespace QuantLib { diff --git a/ql/pricingengines/credit/midpointcdsengine.cpp b/ql/pricingengines/credit/midpointcdsengine.cpp index b8dd34d368a..753207560b1 100644 --- a/ql/pricingengines/credit/midpointcdsengine.cpp +++ b/ql/pricingengines/credit/midpointcdsengine.cpp @@ -23,7 +23,7 @@ #include #include #include -#include +#include #include namespace QuantLib { diff --git a/ql/pricingengines/credit/midpointcdsengine.hpp b/ql/pricingengines/credit/midpointcdsengine.hpp index f7dfff2bfad..9601a67743b 100644 --- a/ql/pricingengines/credit/midpointcdsengine.hpp +++ b/ql/pricingengines/credit/midpointcdsengine.hpp @@ -27,7 +27,7 @@ #define quantlib_mid_point_cds_engine_hpp #include -#include +#include namespace QuantLib { diff --git a/ql/pricingengines/futures/discountingperpetualfuturesengine.hpp b/ql/pricingengines/futures/discountingperpetualfuturesengine.hpp index 52d53ecc038..7fccac234c9 100644 --- a/ql/pricingengines/futures/discountingperpetualfuturesengine.hpp +++ b/ql/pricingengines/futures/discountingperpetualfuturesengine.hpp @@ -27,7 +27,7 @@ #include #include #include -#include +#include #include namespace QuantLib { diff --git a/ql/pricingengines/mclongstaffschwartzengine.hpp b/ql/pricingengines/mclongstaffschwartzengine.hpp index 06fac871652..9999252ad5d 100644 --- a/ql/pricingengines/mclongstaffschwartzengine.hpp +++ b/ql/pricingengines/mclongstaffschwartzengine.hpp @@ -30,7 +30,7 @@ #include #include #include -#include +#include namespace QuantLib { diff --git a/ql/pricingengines/swap/discountingconstnotionalcrosscurrencyswapengine.cpp b/ql/pricingengines/swap/discountingconstnotionalcrosscurrencyswapengine.cpp index e7b677962a9..79b554083b7 100644 --- a/ql/pricingengines/swap/discountingconstnotionalcrosscurrencyswapengine.cpp +++ b/ql/pricingengines/swap/discountingconstnotionalcrosscurrencyswapengine.cpp @@ -21,6 +21,7 @@ #include #include #include +#include #include namespace QuantLib { diff --git a/ql/pricingengines/swap/discountingconstnotionalcrosscurrencyswapengine.hpp b/ql/pricingengines/swap/discountingconstnotionalcrosscurrencyswapengine.hpp index d3dfa570738..22d7f7a4cc7 100644 --- a/ql/pricingengines/swap/discountingconstnotionalcrosscurrencyswapengine.hpp +++ b/ql/pricingengines/swap/discountingconstnotionalcrosscurrencyswapengine.hpp @@ -27,7 +27,7 @@ #include #include #include -#include +#include namespace QuantLib { diff --git a/ql/pricingengines/swap/discountingswapengine.cpp b/ql/pricingengines/swap/discountingswapengine.cpp index d7ab289c7db..7264e8b60dd 100644 --- a/ql/pricingengines/swap/discountingswapengine.cpp +++ b/ql/pricingengines/swap/discountingswapengine.cpp @@ -21,7 +21,7 @@ #include #include #include -#include +#include #include namespace QuantLib { diff --git a/ql/pricingengines/swap/discountingswapengine.hpp b/ql/pricingengines/swap/discountingswapengine.hpp index 1dbc63be834..93e896ab7ba 100644 --- a/ql/pricingengines/swap/discountingswapengine.hpp +++ b/ql/pricingengines/swap/discountingswapengine.hpp @@ -28,7 +28,7 @@ #include #include #include -#include +#include namespace QuantLib { diff --git a/ql/pricingengines/vanilla/mcamericanengine.hpp b/ql/pricingengines/vanilla/mcamericanengine.hpp index 811a832f8a4..9354d08263e 100644 --- a/ql/pricingengines/vanilla/mcamericanengine.hpp +++ b/ql/pricingengines/vanilla/mcamericanengine.hpp @@ -30,7 +30,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/ql/settings.hpp b/ql/settings.hpp index 41cb71d3144..3253bbcc2ee 100644 --- a/ql/settings.hpp +++ b/ql/settings.hpp @@ -29,7 +29,7 @@ #include #include #include -#include +#include namespace QuantLib { diff --git a/ql/termstructures/volatility/equityfx/blackvolsurfacedelta.cpp b/ql/termstructures/volatility/equityfx/blackvolsurfacedelta.cpp index 64a02aaaf03..1c5065fe222 100644 --- a/ql/termstructures/volatility/equityfx/blackvolsurfacedelta.cpp +++ b/ql/termstructures/volatility/equityfx/blackvolsurfacedelta.cpp @@ -26,6 +26,7 @@ #include #include #include +#include using namespace std; diff --git a/ql/termstructures/volatility/equityfx/blackvolsurfacedelta.hpp b/ql/termstructures/volatility/equityfx/blackvolsurfacedelta.hpp index 1e19cacf485..c94b05fac1c 100644 --- a/ql/termstructures/volatility/equityfx/blackvolsurfacedelta.hpp +++ b/ql/termstructures/volatility/equityfx/blackvolsurfacedelta.hpp @@ -34,6 +34,7 @@ #include #include #include +#include namespace QuantLib { diff --git a/ql/termstructures/volatility/optionlet/optionletstripper.cpp b/ql/termstructures/volatility/optionlet/optionletstripper.cpp index 611a672e39a..f4fc398cb2f 100644 --- a/ql/termstructures/volatility/optionlet/optionletstripper.cpp +++ b/ql/termstructures/volatility/optionlet/optionletstripper.cpp @@ -21,6 +21,7 @@ #include #include +#include #include using std::vector; diff --git a/ql/termstructures/volatility/optionlet/optionletstripper.hpp b/ql/termstructures/volatility/optionlet/optionletstripper.hpp index 8490f2543e3..03858e59368 100644 --- a/ql/termstructures/volatility/optionlet/optionletstripper.hpp +++ b/ql/termstructures/volatility/optionlet/optionletstripper.hpp @@ -30,6 +30,7 @@ #include #include #include +#include namespace QuantLib { diff --git a/ql/termstructures/volatility/optionlet/optionletstripper1.cpp b/ql/termstructures/volatility/optionlet/optionletstripper1.cpp index 5bb602b5e40..0053a50d2f4 100644 --- a/ql/termstructures/volatility/optionlet/optionletstripper1.cpp +++ b/ql/termstructures/volatility/optionlet/optionletstripper1.cpp @@ -31,6 +31,7 @@ #include #include #include +#include namespace QuantLib { diff --git a/ql/termstructures/volatility/optionlet/optionletstripper1.hpp b/ql/termstructures/volatility/optionlet/optionletstripper1.hpp index 7693f7c66cb..c5f95dbec97 100644 --- a/ql/termstructures/volatility/optionlet/optionletstripper1.hpp +++ b/ql/termstructures/volatility/optionlet/optionletstripper1.hpp @@ -30,6 +30,7 @@ #define quantlib_optionletstripper1_hpp #include +#include namespace QuantLib { diff --git a/ql/termstructures/yield/oisratehelper.cpp b/ql/termstructures/yield/oisratehelper.cpp index fa21c634703..9ad87f8df1c 100644 --- a/ql/termstructures/yield/oisratehelper.cpp +++ b/ql/termstructures/yield/oisratehelper.cpp @@ -25,6 +25,7 @@ #include #include #include +#include #include namespace QuantLib { diff --git a/ql/termstructures/yield/oisratehelper.hpp b/ql/termstructures/yield/oisratehelper.hpp index c2dda544ac6..4326334b829 100644 --- a/ql/termstructures/yield/oisratehelper.hpp +++ b/ql/termstructures/yield/oisratehelper.hpp @@ -27,7 +27,7 @@ #include #include -#include +#include #include namespace QuantLib { diff --git a/ql/termstructures/yield/ratehelpers.cpp b/ql/termstructures/yield/ratehelpers.cpp index 188666ae755..f2f04d56905 100644 --- a/ql/termstructures/yield/ratehelpers.cpp +++ b/ql/termstructures/yield/ratehelpers.cpp @@ -28,7 +28,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/ql/termstructures/yield/ratehelpers.hpp b/ql/termstructures/yield/ratehelpers.hpp index f00b25da847..2877f49d4d0 100644 --- a/ql/termstructures/yield/ratehelpers.hpp +++ b/ql/termstructures/yield/ratehelpers.hpp @@ -36,7 +36,7 @@ #include #include #include -#include +#include namespace QuantLib { diff --git a/ql/termstructures/yield/ultimateforwardtermstructure.hpp b/ql/termstructures/yield/ultimateforwardtermstructure.hpp index 1f6d015437e..9bf1da73e73 100644 --- a/ql/termstructures/yield/ultimateforwardtermstructure.hpp +++ b/ql/termstructures/yield/ultimateforwardtermstructure.hpp @@ -25,7 +25,7 @@ #define quantlib_ultimate_forward_term_structure_hpp #include -#include +#include #include #include #include diff --git a/ql/time/schedule.cpp b/ql/time/schedule.cpp index c491c1acbd1..b5ab4711c1f 100644 --- a/ql/time/schedule.cpp +++ b/ql/time/schedule.cpp @@ -19,7 +19,7 @@ FOR A PARTICULAR PURPOSE. See the license for more details. */ -#include +#include #include #include #include diff --git a/ql/time/schedule.hpp b/ql/time/schedule.hpp index 60c6ae5bd27..2f32caf7552 100644 --- a/ql/time/schedule.hpp +++ b/ql/time/schedule.hpp @@ -31,7 +31,7 @@ #include #include #include -#include +#include namespace QuantLib { diff --git a/test-suite/blackvolsurfacedelta.cpp b/test-suite/blackvolsurfacedelta.cpp index 0fe9f493374..71e86e4f8c0 100644 --- a/test-suite/blackvolsurfacedelta.cpp +++ b/test-suite/blackvolsurfacedelta.cpp @@ -29,6 +29,7 @@ #include #include #include +#include using namespace boost::unit_test_framework; using namespace QuantLib; diff --git a/test-suite/cashflows.cpp b/test-suite/cashflows.cpp index 84ac77a0492..c429248ba4b 100644 --- a/test-suite/cashflows.cpp +++ b/test-suite/cashflows.cpp @@ -35,7 +35,7 @@ #include #include #include -#include +#include #include using namespace QuantLib; diff --git a/test-suite/creditdefaultswap.cpp b/test-suite/creditdefaultswap.cpp index bb280bb5aa8..066c9bec79f 100644 --- a/test-suite/creditdefaultswap.cpp +++ b/test-suite/creditdefaultswap.cpp @@ -41,7 +41,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/test-suite/crosscurrencyratehelpers.cpp b/test-suite/crosscurrencyratehelpers.cpp index 95b7b0142ad..257e31503cb 100644 --- a/test-suite/crosscurrencyratehelpers.cpp +++ b/test-suite/crosscurrencyratehelpers.cpp @@ -23,7 +23,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/test-suite/defaultprobabilitycurves.cpp b/test-suite/defaultprobabilitycurves.cpp index ba4b6a798e6..9084cf0fa9c 100644 --- a/test-suite/defaultprobabilitycurves.cpp +++ b/test-suite/defaultprobabilitycurves.cpp @@ -36,6 +36,7 @@ #include #include #include +#include #include #include #include diff --git a/test-suite/overnightindexedswap.cpp b/test-suite/overnightindexedswap.cpp index f3566b24042..f5886fcd2c9 100644 --- a/test-suite/overnightindexedswap.cpp +++ b/test-suite/overnightindexedswap.cpp @@ -57,6 +57,7 @@ #include #include #include +#include #include #include diff --git a/test-suite/period.cpp b/test-suite/period.cpp index 6a7c24ac7e7..e33e834f280 100644 --- a/test-suite/period.cpp +++ b/test-suite/period.cpp @@ -20,6 +20,7 @@ #include "toplevelfixture.hpp" #include "utilities.hpp" #include +#include using namespace QuantLib; using namespace boost::unit_test_framework; diff --git a/test-suite/ultimateforwardtermstructure.cpp b/test-suite/ultimateforwardtermstructure.cpp index 8405401eb01..4058cad3381 100644 --- a/test-suite/ultimateforwardtermstructure.cpp +++ b/test-suite/ultimateforwardtermstructure.cpp @@ -27,6 +27,7 @@ #include #include #include +#include using namespace QuantLib; using namespace boost::unit_test_framework; From e9da2235d91d33075871bbb0bcbb6bfea58b549b Mon Sep 17 00:00:00 2001 From: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Date: Fri, 5 Jun 2026 13:24:09 +0000 Subject: [PATCH 9/9] build: remove dead QL_USE_STD_OPTIONAL flag; reduce ql/optional.hpp to deprecated forwarding header Co-Authored-By: Toby Drinkall --- .ci/userconfig2019.alt.hpp | 5 ----- .ci/userconfig2022.alt.hpp | 5 ----- .ci/userconfig2026.alt.hpp | 5 ----- CMakeLists.txt | 2 -- CMakePresets.json | 2 -- Docs/pages/config.docs | 9 --------- configure.ac | 21 --------------------- ql/config.hpp.cfg | 1 - ql/optional.hpp | 26 +++----------------------- ql/userconfig.hpp | 10 ---------- 10 files changed, 3 insertions(+), 83 deletions(-) diff --git a/.ci/userconfig2019.alt.hpp b/.ci/userconfig2019.alt.hpp index 15ab7ddc97d..b6f882f45ef 100644 --- a/.ci/userconfig2019.alt.hpp +++ b/.ci/userconfig2019.alt.hpp @@ -101,11 +101,6 @@ //# define QL_USE_STD_ANY #endif -/* Define this to use std::optional instead of boost::optional. */ -#ifndef QL_USE_STD_OPTIONAL -//# define QL_USE_STD_OPTIONAL -#endif - /* Define this to use standard smart pointers instead of Boost ones. Note that std::shared_ptr does not check access and can cause segmentation faults. */ diff --git a/.ci/userconfig2022.alt.hpp b/.ci/userconfig2022.alt.hpp index e714c4fbf01..b6f882f45ef 100644 --- a/.ci/userconfig2022.alt.hpp +++ b/.ci/userconfig2022.alt.hpp @@ -101,11 +101,6 @@ //# define QL_USE_STD_ANY #endif -/* Define this to use std::optional instead of boost::optional. */ -#ifndef QL_USE_STD_OPTIONAL -# define QL_USE_STD_OPTIONAL -#endif - /* Define this to use standard smart pointers instead of Boost ones. Note that std::shared_ptr does not check access and can cause segmentation faults. */ diff --git a/.ci/userconfig2026.alt.hpp b/.ci/userconfig2026.alt.hpp index e714c4fbf01..b6f882f45ef 100644 --- a/.ci/userconfig2026.alt.hpp +++ b/.ci/userconfig2026.alt.hpp @@ -101,11 +101,6 @@ //# define QL_USE_STD_ANY #endif -/* Define this to use std::optional instead of boost::optional. */ -#ifndef QL_USE_STD_OPTIONAL -# define QL_USE_STD_OPTIONAL -#endif - /* Define this to use standard smart pointers instead of Boost ones. Note that std::shared_ptr does not check access and can cause segmentation faults. */ diff --git a/CMakeLists.txt b/CMakeLists.txt index f346b7e665c..e4f47a6520d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -64,7 +64,6 @@ option(QL_USE_CLANG_TIDY "Use clang-tidy when building" OFF) option(QL_USE_INDEXED_COUPON "Use indexed coupons instead of par coupons" OFF) option(QL_USE_STD_ANY "Use std::any instead of boost::any" ON) option(QL_USE_STD_CLASSES "Enable all QL_USE_STD_ options" OFF) -option(QL_USE_STD_OPTIONAL "Use std::optional instead of boost::optional" ON) option(QL_USE_STD_SHARED_PTR "Use standard smart pointers instead of Boost ones" OFF) set(QL_EXTERNAL_SUBDIRECTORIES "" CACHE STRING "Optional list of external source directories to be added to the build (semicolon-separated)") # set -lpapi here @@ -87,7 +86,6 @@ endif() # Convenience option to activate all STD options if (QL_USE_STD_CLASSES) set(QL_USE_STD_ANY ON) - set(QL_USE_STD_OPTIONAL ON) set(QL_USE_STD_SHARED_PTR ON) endif() diff --git a/CMakePresets.json b/CMakePresets.json index 901270f62a9..59d28bfc7bd 100644 --- a/CMakePresets.json +++ b/CMakePresets.json @@ -303,7 +303,6 @@ "QL_USE_INDEXED_COUPON": "ON", "QL_USE_STD_SHARED_PTR": "ON", "QL_USE_STD_ANY": "OFF", - "QL_USE_STD_OPTIONAL": "OFF", "QL_COMPILE_WARNING_AS_ERROR": "ON" } }, @@ -323,7 +322,6 @@ "QL_USE_INDEXED_COUPON": "ON", "QL_USE_STD_SHARED_PTR": "ON", "QL_USE_STD_ANY": "OFF", - "QL_USE_STD_OPTIONAL": "OFF", "QL_COMPILE_WARNING_AS_ERROR": "ON", "CMAKE_CXX_COMPILER_LAUNCHER": "sccache" } diff --git a/Docs/pages/config.docs b/Docs/pages/config.docs index c5b4eb82f58..8e85d9c38d9 100644 --- a/Docs/pages/config.docs +++ b/Docs/pages/config.docs @@ -125,15 +125,6 @@ functions will be used instead of `boost::any`. If undefined, the Boost facilities will be used. - \code - #define QL_USE_STD_OPTIONAL - \endcode - If defined (the default), `std::optional` and related classes and - functions will be used instead of `boost::optional`. If undefined, - the Boost facilities will be used; however, be aware that Boost - 1.91 introduced changes in boost::optional that silently changed - the behavior of our code and would cause it to work incorrectly. - \code #define QL_USE_STD_SHARED_PTR \endcode diff --git a/configure.ac b/configure.ac index c9d3701c16c..37150789226 100644 --- a/configure.ac +++ b/configure.ac @@ -287,25 +287,6 @@ if test "$ql_use_std_any" = "yes" ; then fi AC_MSG_RESULT([$ql_use_std_any]) -AC_MSG_CHECKING([whether to enable std::optional instead of boost::optional]) -AC_ARG_ENABLE([std-optional], - AS_HELP_STRING([--enable-std-optional], - [If enabled (the default), std::optional and - related classes and functions will be used - instead of boost::optional. If disabled, - the Boost facilities will be used; however, - be aware that Boost 1.91 introduced changes - in boost::optional that silently changed - the behavior of our code and would cause it - to work incorrectly.]), - [ql_use_std_optional=$enableval], - [ql_use_std_optional=yes]) -if test "$ql_use_std_optional" = "yes" ; then - AC_DEFINE([QL_USE_STD_OPTIONAL],[1], - [Define this if you want to use std::optional.]) -fi -AC_MSG_RESULT([$ql_use_std_optional]) - AC_MSG_CHECKING([whether to enable standard smart pointers]) AC_ARG_ENABLE([std-pointers], AS_HELP_STRING([--enable-std-pointers], @@ -337,8 +318,6 @@ AC_ARG_ENABLE([std-classes], if test "$ql_use_std_classes" = "yes" ; then AC_DEFINE([QL_USE_STD_ANY],[1], [Define this if you want to use std::any.]) - AC_DEFINE([QL_USE_STD_OPTIONAL],[1], - [Define this if you want to use std::optional.]) AC_DEFINE([QL_USE_STD_SHARED_PTR],[1], [Define this if you want to use standard smart pointers.]) fi diff --git a/ql/config.hpp.cfg b/ql/config.hpp.cfg index 3f31e1957bb..73a77525d29 100644 --- a/ql/config.hpp.cfg +++ b/ql/config.hpp.cfg @@ -39,7 +39,6 @@ #cmakedefine QL_THROW_IN_CYCLES 1 #cmakedefine QL_USE_INDEXED_COUPON 1 #cmakedefine QL_USE_STD_ANY 1 -#cmakedefine QL_USE_STD_OPTIONAL 1 #cmakedefine QL_USE_STD_SHARED_PTR 1 #cmakedefine QL_NULL_AS_FUNCTIONS 1 diff --git a/ql/optional.hpp b/ql/optional.hpp index 5039db8837d..94195d440b6 100644 --- a/ql/optional.hpp +++ b/ql/optional.hpp @@ -18,35 +18,15 @@ */ /*! \file optional.hpp - \brief Maps optional to either the boost or std implementation + \brief Deprecated. QuantLib now uses std::optional directly; include . */ #ifndef quantlib_optional_hpp #define quantlib_optional_hpp -#include - -#if defined(QL_USE_STD_OPTIONAL) #include -#else -#if BOOST_VERSION >= 109100 -#error Boost 1.91 introduced changes in boost::optional that silently changed the behavior of our code and would cause it to work incorrectly. Use std::optional instead. -#endif -// Deprecated in version 1.39 -#pragma message("Warning: using boost::optional is deprecated. Enable std::optional instead.") -#include -#endif - -namespace QuantLib::ext { - - #if defined(QL_USE_STD_OPTIONAL) - using std::optional; // NOLINT(misc-unused-using-decls) - inline constexpr const std::nullopt_t& nullopt = std::nullopt; - #else - using boost::optional; // NOLINT(misc-unused-using-decls) - inline constexpr const boost::none_t& nullopt = boost::none; - #endif - } +// Deprecated: this header is retained only for backward compatibility. +// QuantLib now uses std::optional / std::nullopt directly; include . #endif diff --git a/ql/userconfig.hpp b/ql/userconfig.hpp index bc42ae169eb..e54ce55c1aa 100644 --- a/ql/userconfig.hpp +++ b/ql/userconfig.hpp @@ -127,16 +127,6 @@ # define QL_USE_STD_ANY #endif -/* If defined, `std::optional` and related classes and functions will - be used instead of `boost::optional`. If undefined, the Boost - facilities will be used; however, be aware that Boost 1.91 - introduced changes in boost::optional that silently changed the - behavior of our code and would cause it to work incorrectly. -*/ -#ifndef QL_USE_STD_OPTIONAL -# define QL_USE_STD_OPTIONAL -#endif - /* If defined, `std::shared_ptr` and related classes and functions will used instead of `boost::shared_ptr`. If undefined, the Boost facilities will be used. Note that `std::shared_ptr` does not check