diff --git a/ql/experimental/termstructures/basisswapratehelpers.hpp b/ql/experimental/termstructures/basisswapratehelpers.hpp index 975399f963..a1971a11ff 100644 --- a/ql/experimental/termstructures/basisswapratehelpers.hpp +++ b/ql/experimental/termstructures/basisswapratehelpers.hpp @@ -53,6 +53,8 @@ namespace QuantLib { Real impliedQuote() const override; void accept(AcyclicVisitor&) override; + // NOLINTNEXTLINE(cppcoreguidelines-noexcept-swap,performance-noexcept-swap) + ext::shared_ptr swap() const { return swap_; } private: void initializeDates() override; void setTermStructure(YieldTermStructure*) override; @@ -94,6 +96,8 @@ namespace QuantLib { Real impliedQuote() const override; void accept(AcyclicVisitor&) override; + // NOLINTNEXTLINE(cppcoreguidelines-noexcept-swap,performance-noexcept-swap) + ext::shared_ptr swap() const { return swap_; } private: void initializeDates() override; void setTermStructure(YieldTermStructure*) override; diff --git a/ql/termstructures/yield/oisratehelper.cpp b/ql/termstructures/yield/oisratehelper.cpp index 64d3908e7b..ce211d3eed 100644 --- a/ql/termstructures/yield/oisratehelper.cpp +++ b/ql/termstructures/yield/oisratehelper.cpp @@ -112,7 +112,7 @@ namespace QuantLib { Date lastPaymentDate = std::max(swap_->overnightLeg().back()->date(), swap_->fixedLeg().back()->date()); - latestRelevantDate_ = std::max(maturityDate_, lastPaymentDate); + latestRelevantDate_ = latestDate_ = std::max(maturityDate_, lastPaymentDate); switch (pillarChoice_) { case Pillar::MaturityDate: @@ -135,8 +135,6 @@ namespace QuantLib { default: QL_FAIL("unknown Pillar::Choice(" << Integer(pillarChoice_) << ")"); } - - latestDate_ = std::max(swap_->maturityDate(), lastPaymentDate); } void OISRateHelper::setTermStructure(YieldTermStructure* t) { @@ -233,9 +231,10 @@ namespace QuantLib { setCouponPricer(swap_->overnightLeg(), pricer); earliestDate_ = swap_->startDate(); + maturityDate_ = swap_->maturityDate(); Date lastPaymentDate = std::max(swap_->overnightLeg().back()->date(), swap_->fixedLeg().back()->date()); - latestDate_ = std::max(swap_->maturityDate(), lastPaymentDate); + latestRelevantDate_ = latestDate_ = std::max(maturityDate_, lastPaymentDate); } DatedOISRateHelper::DatedOISRateHelper(const Date& startDate, diff --git a/ql/termstructures/yield/oisratehelper.hpp b/ql/termstructures/yield/oisratehelper.hpp index 3efd315082..9135c479ee 100644 --- a/ql/termstructures/yield/oisratehelper.hpp +++ b/ql/termstructures/yield/oisratehelper.hpp @@ -155,6 +155,12 @@ namespace QuantLib { Real impliedQuote() const override; void setTermStructure(YieldTermStructure*) override; //@} + //! \name inspectors + //@{ + // NOLINTNEXTLINE(cppcoreguidelines-noexcept-swap,performance-noexcept-swap) + ext::shared_ptr swap() const { return swap_; } + //@} + //@} //! \name Visitability //@{ void accept(AcyclicVisitor&) override;