@@ -383,26 +383,23 @@ CPILeg::operator Leg() const {
383383 refEnd = schedule_.calendar ().adjust (start + schedule_.tenor (), bdc);
384384 }
385385
386- ext::shared_ptr<CPICoupon> coup;
387-
388- coup = ext::make_shared<CPICoupon>(
386+ auto coup = ext::make_shared<CPICoupon>(
389387 baseCPI_, // all have same base for ratio
390- baseDate,
391- paymentDate, detail::get (notionals_, i, 0.0 ), start, end, index_,
392- observationLag_, observationInterpolation_, paymentDayCounter_, detail::get (fixedRates_, i, 0.0 ),
388+ baseDate, paymentDate, detail::get (notionals_, i, 0.0 ), start, end, index_, observationLag_,
389+ observationInterpolation_, paymentDayCounter_, detail::get (fixedRates_, i, 0.0 ),
393390 detail::get (spreads_, i, 0.0 ), refStart, refEnd, exCouponDate, subtractInflationNominalAllCoupons_);
394391
395392 // set a pricer for the underlying coupon straight away because it only provides computation - not data
396- ext::shared_ptr <CPICouponPricer> pricer ( new CPICouponPricer ( Handle<YieldTermStructure>(rateCurve_) ));
393+ auto pricer = ext::make_shared <CPICouponPricer>( Handle<YieldTermStructure>(rateCurve_));
397394 coup->setPricer (pricer);
398395
399396 if (detail::noOption (caps_, floors_, i)) { // just swaplet
400- leg.push_back (ext::dynamic_pointer_cast<CashFlow>( coup) );
397+ leg.push_back (coup);
401398 } else { // cap/floorlet
402- ext::shared_ptr<CappedFlooredCPICoupon> cfCoup = ext::make_shared<CappedFlooredCPICoupon>(
399+ auto cfCoup = ext::make_shared<CappedFlooredCPICoupon>(
403400 coup, startDate_, detail::get (caps_, i, Null<Rate>()), detail::get (floors_, i, Null<Rate>()));
404401 // in this case we need to set the "outer" pricer later that handles cap and floor
405- leg.push_back (ext::dynamic_pointer_cast<CashFlow>( cfCoup) );
402+ leg.push_back (cfCoup);
406403 }
407404 }
408405 }
0 commit comments