Skip to content

Commit

Permalink
Add a few structured bindings to check C++17 compilation
Browse files Browse the repository at this point in the history
  • Loading branch information
lballabio committed Jul 23, 2024
1 parent 3f98c71 commit c9e1631
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions ql/experimental/termstructures/crosscurrencyratehelpers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,7 @@ namespace QuantLib {
Date refDt = discountCurveHandle->referenceDate();
const YieldTermStructure& discountRef = **discountCurveHandle;
bool includeSettleDtFlows = true;
Real npv, bps;
std::tie(npv, bps) = CashFlows::npvbps(iborLeg, discountRef, includeSettleDtFlows, refDt, refDt);
auto [npv, bps] = CashFlows::npvbps(iborLeg, discountRef, includeSettleDtFlows, refDt, refDt);
// Include NPV of the notional exchange at start and maturity.
// on the settlement date
npv += (-1.0) * discountRef.discount(CashFlows::startDate(iborLeg));
Expand Down Expand Up @@ -231,10 +230,8 @@ namespace QuantLib {
isBasisOnFxBaseCurrencyLeg) {}

Real ConstNotionalCrossCurrencyBasisSwapRateHelper::impliedQuote() const {
Real npvBaseCcy = 0.0, bpsBaseCcy = 0.0;
std::tie(npvBaseCcy, bpsBaseCcy) = npvbpsConstNotionalLeg(baseCcyIborLeg_, baseCcyLegDiscountHandle());
Real npvQuoteCcy = 0.0, bpsQuoteCcy = 0.0;
std::tie(npvQuoteCcy, bpsQuoteCcy) = npvbpsConstNotionalLeg(quoteCcyIborLeg_, quoteCcyLegDiscountHandle());
auto [npvBaseCcy, bpsBaseCcy] = npvbpsConstNotionalLeg(baseCcyIborLeg_, baseCcyLegDiscountHandle());
auto [npvQuoteCcy, bpsQuoteCcy] = npvbpsConstNotionalLeg(quoteCcyIborLeg_, quoteCcyLegDiscountHandle());
Real bps = isBasisOnFxBaseCurrencyLeg_ ? -bpsBaseCcy : bpsQuoteCcy;
return -(npvQuoteCcy - npvBaseCcy) / bps;
}
Expand Down

0 comments on commit c9e1631

Please sign in to comment.