public CapFloor value() { VanillaSwap swap = makeVanillaSwap_; List <CashFlow> leg = swap.floatingLeg(); if (firstCapletExcluded_) { leg.RemoveAt(0); } // only leaves the last coupon if (asOptionlet_ && leg.Count > 1) { leg.RemoveRange(0, leg.Count - 2); // Sun Studio needs an lvalue } List <double> strikeVector; if (strike_ == null) { // temporary patch... // should be fixed for every CapFloor::Engine BlackCapFloorEngine temp = engine_ as BlackCapFloorEngine; Utils.QL_REQUIRE(temp != null, () => "cannot calculate ATM without a BlackCapFloorEngine"); Handle <YieldTermStructure> discountCurve = temp.termStructure(); strikeVector = new InitializedList <double>(1, CashFlows.atmRate(leg, discountCurve, false, discountCurve.link.referenceDate())); } else { strikeVector = new InitializedList <double>(1, strike_.Value); } CapFloor capFloor = new CapFloor(capFloorType_, leg, strikeVector); capFloor.setPricingEngine(engine_); return(capFloor); }