Skip to content

Commit 7fb8855

Browse files
committed
Merge pull request lballabio#217.
2 parents f782a96 + 98514f0 commit 7fb8855

File tree

11 files changed

+15
-19
lines changed

11 files changed

+15
-19
lines changed

Examples/Gaussian1dModels/Gaussian1dModels.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -668,11 +668,11 @@ int main(int argc, char *argv[]) {
668668
std::cout << "\nThat was it. Thank you for running this demo. Bye."
669669
<< std::endl;
670670

671-
} catch (QuantLib::Error e) {
671+
} catch (const QuantLib::Error& e) {
672672
std::cout << "terminated with a ql exception: " << e.what()
673673
<< std::endl;
674674
return 1;
675-
} catch (std::exception e) {
675+
} catch (const std::exception& e) {
676676
std::cout << "terminated with a general exception: " << e.what()
677677
<< std::endl;
678678
return 1;

ql/experimental/coupons/lognormalcmsspreadpricer.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ namespace QuantLib {
8080
private:
8181
class PrivateObserver : public Observer {
8282
public:
83-
PrivateObserver(LognormalCmsSpreadPricer *t) : t_(t) {}
83+
explicit PrivateObserver(LognormalCmsSpreadPricer *t) : t_(t) {}
8484
void update() { t_->flushCache(); }
8585

8686
private:

ql/experimental/coupons/strippedcapflooredcoupon.hpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ namespace QuantLib {
3232

3333
public:
3434

35-
StrippedCappedFlooredCoupon(const boost::shared_ptr<CappedFlooredCoupon> &underlying);
35+
explicit StrippedCappedFlooredCoupon(const boost::shared_ptr<CappedFlooredCoupon> &underlying);
3636

3737
//! Coupon interface
3838
Rate rate() const;
@@ -67,7 +67,7 @@ namespace QuantLib {
6767

6868
class StrippedCappedFlooredCouponLeg {
6969
public:
70-
StrippedCappedFlooredCouponLeg(const Leg &underlyingLeg);
70+
explicit StrippedCappedFlooredCouponLeg(const Leg &underlyingLeg);
7171
operator Leg() const;
7272
private:
7373
Leg underlyingLeg_;

ql/experimental/math/laplaceinterpolation.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ template <class M> void laplaceInterpolation(M &A, Real relTol = 1E-6) {
4040

4141
struct f_A {
4242
const SparseMatrix &g;
43-
f_A(const SparseMatrix &g) : g(g) {}
43+
explicit f_A(const SparseMatrix &g) : g(g) {}
4444
Disposable<Array> operator()(const Array &x) const {
4545
return prod(g, x);
4646
}

ql/experimental/math/piecewiseintegral.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ inline Real PiecewiseIntegral::integrate(const boost::function<Real(Real)> &f,
8989
}
9090

9191
if (b0 == criticalPoints_.end()) {
92-
b0--;
92+
--b0;
9393
if (!close_enough(*b0, b)) {
9494
res += integrate_h(f, (*b0) * eps_, b);
9595
}

ql/experimental/volatility/zabr.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,7 @@ ZabrModel::x(const std::vector<Real> &strikes) const {
320320
QL_REQUIRE(strikes[0] > 0.0 || beta_ < 1.0,
321321
"strikes must be positive (" << strikes[0] << ") if beta = 1");
322322
for (std::vector<Real>::const_iterator i = strikes.begin() + 1;
323-
i != strikes.end(); i++)
323+
i != strikes.end(); ++i)
324324
QL_REQUIRE(*i > *(i - 1), "strikes must be strictly ascending ("
325325
<< *(i - 1) << "," << *i << ")");
326326

ql/models/shortrate/onefactormodels/gsr.hpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -170,12 +170,12 @@ class Gsr : public Gaussian1dModel, public CalibratedModel {
170170
// volsteptimes_)
171171

172172
struct VolatilityObserver : public Observer {
173-
VolatilityObserver(Gsr *p) : p_(p) {}
173+
explicit VolatilityObserver(Gsr *p) : p_(p) {}
174174
void update() { p_->updateVolatility(); }
175175
Gsr *p_;
176176
};
177177
struct ReversionObserver : public Observer {
178-
ReversionObserver(Gsr *p) : p_(p) {}
178+
explicit ReversionObserver(Gsr *p) : p_(p) {}
179179
void update() { p_->updateReversion(); }
180180
Gsr *p_;
181181
};

ql/termstructures/volatility/swaption/cmsmarketcalibration.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ namespace {
3030

3131
class ObjectiveFunction : public CostFunction {
3232
public:
33-
ObjectiveFunction(CmsMarketCalibration *smileAndCms)
33+
explicit ObjectiveFunction(CmsMarketCalibration *smileAndCms)
3434
: smileAndCms_(smileAndCms), volCube_(smileAndCms->volCube_),
3535
cmsMarket_(smileAndCms->cmsMarket_),
3636
weights_(smileAndCms->weights_),
@@ -67,7 +67,7 @@ namespace {
6767

6868
class ObjectiveFunction3 : public ObjectiveFunction {
6969
public:
70-
ObjectiveFunction3(CmsMarketCalibration *smileAndCms)
70+
explicit ObjectiveFunction3(CmsMarketCalibration *smileAndCms)
7171
: ObjectiveFunction(smileAndCms) {};
7272

7373
private:
@@ -100,7 +100,7 @@ namespace {
100100

101101
class ObjectiveFunction6 : public ObjectiveFunction {
102102
public:
103-
ObjectiveFunction6(CmsMarketCalibration *smileAndCms)
103+
explicit ObjectiveFunction6(CmsMarketCalibration *smileAndCms)
104104
: ObjectiveFunction(smileAndCms) {};
105105

106106
private:

ql/termstructures/volatility/swaption/swaptionvolcube1.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ namespace QuantLib {
197197

198198
class PrivateObserver : public Observer {
199199
public:
200-
PrivateObserver(SwaptionVolCube1x<Model> *v)
200+
explicit PrivateObserver(SwaptionVolCube1x<Model> *v)
201201
: v_(v) {}
202202
void update() {
203203
v_->setParameterGuess();

ql/time/date.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -842,7 +842,7 @@ namespace QuantLib {
842842
struct nopunct : std::numpunct<char> {
843843
std::string do_grouping() const {return "";}
844844
};
845-
FormatResetter(std::ostream &out)
845+
explicit FormatResetter(std::ostream &out)
846846
: out_(&out), flags_(out.flags()), filler_(out.fill()),
847847
loc_(out.getloc()) {
848848
std::locale loc (out.getloc(),new nopunct);

test-suite/markovfunctional.cpp

-4
Original file line numberDiff line numberDiff line change
@@ -1390,11 +1390,7 @@ void MarkovFunctionalTest::testVanillaEngines() {
13901390
for (Size i = 0; i < c4.size(); i++) {
13911391
c4[i].setPricingEngine(blackCapFloorEngine4);
13921392
Real blackPrice = c4[i].NPV();
1393-
std::vector<Real> blackOptionlets =
1394-
c4[i].result<std::vector<Real> >("optionletsPrice");
13951393
c4[i].setPricingEngine(mfCapFloorEngine4);
1396-
std::vector<Real> mfOptionlets =
1397-
c4[i].result<std::vector<Real> >("optionletsPrice");
13981394
Real mfPrice = c4[i].NPV();
13991395
if (fabs(blackPrice - mfPrice) > tol1)
14001396
BOOST_ERROR(

0 commit comments

Comments
 (0)