Skip to content

Commit

Permalink
Merge 7d8b193 into 8a70608
Browse files Browse the repository at this point in the history
  • Loading branch information
lballabio committed Feb 9, 2021
2 parents 8a70608 + 7d8b193 commit 7bee18e
Show file tree
Hide file tree
Showing 235 changed files with 474 additions and 521 deletions.
5 changes: 4 additions & 1 deletion .clang-tidy
@@ -1,7 +1,10 @@
---
Checks: '-*,readability-*,bugprone-*,misc-*,performance-*,modernize-redundant-void-arg,modernize-deprecated-headers,modernize-use-override,modernize-use-auto,modernize-use-nullptr,-readability-else-after-return,-readability-named-parameter,-readability-braces-around-statements,-readability-inconsistent-declaration-parameter-name,-readability-isolate-declaration,-readability-magic-numbers,-readability-convert-member-functions-to-static,-bugprone-macro-parentheses,-bugprone-narrowing-conversions,-bugprone-branch-clone,-misc-non-private-member-variables-in-classes,-misc-unused-parameters'
Checks: '-*,readability-*,bugprone-*,misc-*,performance-*,modernize-redundant-void-arg,modernize-deprecated-headers,modernize-use-override,modernize-use-auto,modernize-use-nullptr,modernize-use-default-member-init,modernize-use-equals-default,modernize-use-equals-delete,-readability-else-after-return,-readability-named-parameter,-readability-braces-around-statements,-readability-inconsistent-declaration-parameter-name,-readability-isolate-declaration,-readability-magic-numbers,-readability-convert-member-functions-to-static,-bugprone-macro-parentheses,-bugprone-narrowing-conversions,-bugprone-branch-clone,-misc-non-private-member-variables-in-classes,-misc-unused-parameters'
WarningsAsErrors: ''
HeaderFilterRegex: '.*'
AnalyzeTemporaryDtors: false
FormatStyle: file
CheckOptions:
- key: modernize-use-default-member-init.UseAssignment
value: 1
...
2 changes: 1 addition & 1 deletion Examples/GlobalOptimizer/GlobalOptimizer.cpp
Expand Up @@ -146,7 +146,7 @@ class TestFunction : public CostFunction {
explicit TestFunction(const RealFunc & f, const ArrayFunc & fs = ArrayFunc()) : f_(f), fs_(fs) {}
explicit TestFunction(Real (*f)(const Array&), Disposable<Array> (*fs)(const Array&) = nullptr)
: f_(f), fs_(fs) {}
~TestFunction() override {}
~TestFunction() override = default;
Real value(const Array& x) const override { return f_(x); }
Disposable<Array> values(const Array& x) const override {
if(!fs_)
Expand Down
2 changes: 1 addition & 1 deletion ql/cashflow.hpp
Expand Up @@ -37,7 +37,7 @@ namespace QuantLib {
*/
class CashFlow : public Event {
public:
~CashFlow() override {}
~CashFlow() override = default;
//! \name Event interface
//@{
//! \note This is inherited from the event class
Expand Down
4 changes: 2 additions & 2 deletions ql/cashflows/cashflows.hpp
Expand Up @@ -40,8 +40,8 @@ namespace QuantLib {
/*! \todo add tests */
class CashFlows {
private:
CashFlows();
CashFlows(const CashFlows&);
CashFlows() = delete;
CashFlows(const CashFlows&) = delete;

class IrrFinder {
public:
Expand Down
23 changes: 10 additions & 13 deletions ql/cashflows/conundrumpricer.hpp
Expand Up @@ -34,7 +34,7 @@ namespace QuantLib {

class VanillaOptionPricer {
public:
virtual ~VanillaOptionPricer() {}
virtual ~VanillaOptionPricer() = default;
virtual Real operator()(Real strike,
Option::Type optionType,
Real deflator) const = 0;
Expand All @@ -61,7 +61,7 @@ namespace QuantLib {

class GFunction {
public:
virtual ~GFunction() {}
virtual ~GFunction() = default;
virtual Real operator()(Real x) = 0;
virtual Real firstDerivative(Real x) = 0;
virtual Real secondDerivative(Real x) = 0;
Expand All @@ -84,7 +84,7 @@ namespace QuantLib {
newGFunctionWithShifts(const CmsCoupon& coupon,
const Handle<Quote>& meanReversion);
private:
GFunctionFactory();
GFunctionFactory() = delete;

class GFunctionStandard : public GFunction {
public:
Expand Down Expand Up @@ -155,15 +155,12 @@ namespace QuantLib {
Real Rs_;
mutable Real derivative_;
public:
virtual ~ObjectiveFunction() {}
ObjectiveFunction(const GFunctionWithShifts& o,
const Real Rs)
: o_(o), Rs_(Rs) {}
virtual Real operator()(const Real& x) const;
Real derivative (const Real& x) const;
void setSwapRateValue(Real x);
const GFunctionWithShifts& gFunctionWithShifts() const {
return o_; }
virtual ~ObjectiveFunction() = default;
ObjectiveFunction(const GFunctionWithShifts& o, const Real Rs) : o_(o), Rs_(Rs) {}
virtual Real operator()(const Real& x) const;
Real derivative(const Real& x) const;
void setSwapRateValue(Real x);
const GFunctionWithShifts& gFunctionWithShifts() const { return o_; }
};

ext::shared_ptr<ObjectiveFunction> objectiveFunction_;
Expand Down Expand Up @@ -267,7 +264,7 @@ namespace QuantLib {
public:
typedef Real argument_type;
typedef Real result_type;
virtual ~Function() {}
virtual ~Function() = default;
virtual Real operator()(Real x) const = 0;
};

Expand Down
4 changes: 2 additions & 2 deletions ql/cashflows/couponpricer.hpp
Expand Up @@ -43,7 +43,7 @@ namespace QuantLib {
class FloatingRateCouponPricer: public virtual Observer,
public virtual Observable {
public:
~FloatingRateCouponPricer() override {}
~FloatingRateCouponPricer() override = default;
//! \name required interface
//@{
virtual Real swapletPrice() const = 0;
Expand Down Expand Up @@ -164,7 +164,7 @@ namespace QuantLib {
public:
virtual Real meanReversion() const = 0;
virtual void setMeanReversion(const Handle<Quote>&) = 0;
virtual ~MeanRevertingPricer() {}
virtual ~MeanRevertingPricer() = default;
};

void setCouponPricer(const Leg& leg,
Expand Down
2 changes: 1 addition & 1 deletion ql/cashflows/cpicouponpricer.cpp
Expand Up @@ -21,7 +21,7 @@

namespace QuantLib {

CPICouponPricer::CPICouponPricer() {}
CPICouponPricer::CPICouponPricer() = default;

CPICouponPricer::CPICouponPricer(
const Handle<YieldTermStructure>& nominalTermStructure)
Expand Down
2 changes: 1 addition & 1 deletion ql/cashflows/inflationcouponpricer.cpp
Expand Up @@ -34,7 +34,7 @@ namespace QuantLib {
}


YoYInflationCouponPricer::YoYInflationCouponPricer() {}
YoYInflationCouponPricer::YoYInflationCouponPricer() = default;

YoYInflationCouponPricer::YoYInflationCouponPricer(
const Handle<YieldTermStructure>& nominalTermStructure)
Expand Down
2 changes: 1 addition & 1 deletion ql/cashflows/inflationcouponpricer.hpp
Expand Up @@ -53,7 +53,7 @@ namespace QuantLib {
class InflationCouponPricer: public virtual Observer,
public virtual Observable {
public:
~InflationCouponPricer() override {}
~InflationCouponPricer() override = default;
//! \name Interface
//@{
virtual Real swapletPrice() const = 0;
Expand Down
16 changes: 6 additions & 10 deletions ql/cashflows/lineartsrpricer.hpp
Expand Up @@ -70,11 +70,7 @@ namespace QuantLib {

struct Settings {

Settings()
: strategy_(RateBound), vegaRatio_(0.01),
priceThreshold_(1.0E-8), stdDevs_(3.0),
lowerRateBound_(defaultLowerBound), upperRateBound_(defaultUpperBound),
defaultBounds_(true) {}
Settings() : lowerRateBound_(defaultLowerBound), upperRateBound_(defaultUpperBound) {}

Settings &withRateBound(const Real lowerRateBound = defaultLowerBound,
const Real upperRateBound = defaultUpperBound) {
Expand Down Expand Up @@ -152,12 +148,12 @@ namespace QuantLib {
BSStdDevs
};

Strategy strategy_;
Real vegaRatio_;
Real priceThreshold_;
Real stdDevs_;
Strategy strategy_ = RateBound;
Real vegaRatio_ = 0.01;
Real priceThreshold_ = 1.0E-8;
Real stdDevs_ = 3.0;
Real lowerRateBound_, upperRateBound_;
bool defaultBounds_;
bool defaultBounds_ = true;
};


Expand Down
2 changes: 1 addition & 1 deletion ql/cashflows/timebasket.hpp
Expand Up @@ -37,7 +37,7 @@ namespace QuantLib {
// this is needed for Visual C++ 6
typedef std::map<Date,Real> super;
public:
TimeBasket() {}
TimeBasket() = default;
TimeBasket(const std::vector<Date>& dates,
const std::vector<Real>& values);
//! \name Map interface
Expand Down
2 changes: 1 addition & 1 deletion ql/currencies/exchangeratemanager.hpp
Expand Up @@ -70,7 +70,7 @@ namespace QuantLib {
void clear();

struct Entry {
Entry() {}
Entry() = default;
Entry(const ExchangeRate& rate,
const Date& start, const Date& end)
: rate(rate), startDate(start), endDate(end) {}
Expand Down
2 changes: 1 addition & 1 deletion ql/currency.hpp
Expand Up @@ -112,7 +112,7 @@ namespace QuantLib {

// inline definitions

inline Currency::Currency() {}
inline Currency::Currency() = default;

inline void Currency::checkNonEmpty() const {
QL_REQUIRE(data_, "no currency data provided");
Expand Down
4 changes: 2 additions & 2 deletions ql/discretizedasset.hpp
Expand Up @@ -38,7 +38,7 @@ namespace QuantLib {
DiscretizedAsset()
: latestPreAdjustment_(QL_MAX_REAL),
latestPostAdjustment_(QL_MAX_REAL) {}
virtual ~DiscretizedAsset() {}
virtual ~DiscretizedAsset() = default;

//! \name inspectors
//@{
Expand Down Expand Up @@ -143,7 +143,7 @@ namespace QuantLib {
//! Useful discretized discount bond asset
class DiscretizedDiscountBond : public DiscretizedAsset {
public:
DiscretizedDiscountBond() {}
DiscretizedDiscountBond() = default;
void reset(Size size) override { values_ = Array(size, 1.0); }
std::vector<Time> mandatoryTimes() const override { return std::vector<Time>(); }
};
Expand Down
2 changes: 2 additions & 0 deletions ql/errors.hpp
Expand Up @@ -45,10 +45,12 @@ namespace QuantLib {
long line,
const std::string& functionName,
const std::string& message = "");
#ifdef QL_PATCH_MSVC_2013
/*! the automatically generated destructor would
not have the throw specifier.
*/
~Error() throw() override {}
#endif
//! returns the error message.
const char* what() const throw() override;

Expand Down
2 changes: 1 addition & 1 deletion ql/event.hpp
Expand Up @@ -39,7 +39,7 @@ namespace QuantLib {
*/
class Event : public Observable {
public:
~Event() override {}
~Event() override = default;
//! \name Event interface
//@{
//! returns the date at which the event occurs
Expand Down
2 changes: 1 addition & 1 deletion ql/exercise.hpp
Expand Up @@ -39,7 +39,7 @@ namespace QuantLib {
};
// constructor
explicit Exercise(Type type) : type_(type) {}
virtual ~Exercise() {}
virtual ~Exercise() = default;
// inspectors
Type type() const { return type_; }
Date date(Size index) const { return dates_[index]; }
Expand Down
11 changes: 7 additions & 4 deletions ql/experimental/basismodels/swaptioncfs.hpp
Expand Up @@ -45,7 +45,8 @@ namespace QuantLib {
IborLegCashFlows(const Leg& iborLeg,
const Handle<YieldTermStructure>& discountCurve,
bool contTenorSpread = true);
IborLegCashFlows(){}; // allow default constructor which does nothing
IborLegCashFlows() = default;
; // allow default constructor which does nothing
};


Expand All @@ -61,8 +62,9 @@ namespace QuantLib {
SwapCashFlows(const ext::shared_ptr<VanillaSwap>& swap,
const Handle<YieldTermStructure>& discountCurve,
bool contTenorSpread = true);
SwapCashFlows(){}; // allow default constructor which does nothing
// inspectors
SwapCashFlows() = default;
; // allow default constructor which does nothing
// inspectors
inline const Leg& fixedLeg() const { return fixedLeg_; }
inline const std::vector<Real>& fixedTimes() const { return fixedTimes_; }
inline const std::vector<Real>& fixedWeights() const { return fixedWeights_; }
Expand All @@ -79,7 +81,8 @@ namespace QuantLib {
SwaptionCashFlows(const ext::shared_ptr<Swaption>& swaption,
const Handle<YieldTermStructure>& discountCurve,
bool contTenorSpread = true);
SwaptionCashFlows(){}; // allow default constructor which does nothing
SwaptionCashFlows() = default;
; // allow default constructor which does nothing
// inspectors
inline ext::shared_ptr<Swaption> swaption() const { return swaption_; }
inline const std::vector<Real>& exerciseTimes() const { return exerciseTimes_; }
Expand Down
3 changes: 2 additions & 1 deletion ql/experimental/basismodels/tenoroptionletvts.hpp
Expand Up @@ -75,7 +75,8 @@ namespace QuantLib {
public:
// return the correlation between two FRA rates starting at start1 and start2
virtual Real operator()(const Time& start1, const Time& start2) const = 0;
virtual ~CorrelationStructure(){};
virtual ~CorrelationStructure() = default;
;
};

// very basic choice for correlation structure
Expand Down
2 changes: 1 addition & 1 deletion ql/experimental/callablebonds/callablebond.hpp
Expand Up @@ -170,7 +170,7 @@ namespace QuantLib {

class CallableBond::arguments : public Bond::arguments {
public:
arguments() {}
arguments() = default;
std::vector<Date> couponDates;
std::vector<Real> couponAmounts;
//! redemption = face amount * redemption / 100.
Expand Down
2 changes: 1 addition & 1 deletion ql/experimental/callablebonds/callablebondvolstructure.hpp
Expand Up @@ -60,7 +60,7 @@ namespace QuantLib {
const DayCounter& dc = DayCounter(),
BusinessDayConvention bdc = Following);
//@}
~CallableBondVolatilityStructure() override {}
~CallableBondVolatilityStructure() override = default;
//! \name Volatility, variance and smile
//@{
//! returns the volatility for a given option time and bondLength
Expand Down
2 changes: 1 addition & 1 deletion ql/experimental/catbonds/catbond.hpp
Expand Up @@ -45,7 +45,7 @@ namespace QuantLib {
const Date& issueDate,
const ext::shared_ptr<NotionalRisk>& notionalRisk)
: Bond(settlementDays, calendar, issueDate), notionalRisk_(notionalRisk) {}
~CatBond() override {}
~CatBond() override = default;

void setupArguments(PricingEngine::arguments*) const override;
void fetchResults(const PricingEngine::results*) const override;
Expand Down
4 changes: 2 additions & 2 deletions ql/experimental/catbonds/catrisk.hpp
Expand Up @@ -53,7 +53,7 @@ namespace QuantLib {
: start_(start), end_(end)
{}

virtual ~CatSimulation(){}
virtual ~CatSimulation() = default;
virtual bool nextPath(std::vector<std::pair<Date, Real> > &path) = 0;
protected:
Date start_;
Expand All @@ -62,7 +62,7 @@ namespace QuantLib {

class CatRisk {
public:
virtual ~CatRisk() {}
virtual ~CatRisk() = default;
virtual ext::shared_ptr<CatSimulation> newSimulation(const Date& start, const Date& end) const = 0;
};

Expand Down
4 changes: 2 additions & 2 deletions ql/experimental/catbonds/riskynotional.hpp
Expand Up @@ -34,7 +34,7 @@ namespace QuantLib {

class EventPaymentOffset {
public:
virtual ~EventPaymentOffset() {}
virtual ~EventPaymentOffset() = default;
virtual Date paymentDate(const Date& eventDate) = 0;
};

Expand Down Expand Up @@ -63,7 +63,7 @@ namespace QuantLib {
public:
explicit NotionalRisk(const ext::shared_ptr<EventPaymentOffset>& paymentOffset)
: paymentOffset_(paymentOffset) {}
virtual ~NotionalRisk() {}
virtual ~NotionalRisk() = default;

virtual void updatePath(const std::vector<std::pair<Date, Real> >& events,
NotionalPath& path) const = 0;
Expand Down
2 changes: 1 addition & 1 deletion ql/experimental/commodities/commoditytype.hpp
Expand Up @@ -41,7 +41,7 @@ namespace QuantLib {
and must be reassigned to a valid currency before being
used.
*/
CommodityType() {}
CommodityType() = default;
CommodityType(const std::string& code, const std::string& name);
//! \name Inspectors
//@{
Expand Down
2 changes: 1 addition & 1 deletion ql/experimental/commodities/commodityunitcost.hpp
Expand Up @@ -31,7 +31,7 @@ namespace QuantLib {

class CommodityUnitCost {
public:
CommodityUnitCost() {}
CommodityUnitCost() = default;
CommodityUnitCost(const Money& amount,
const UnitOfMeasure& unitOfMeasure) :
amount_(amount), unitOfMeasure_(unitOfMeasure) {}
Expand Down
2 changes: 1 addition & 1 deletion ql/experimental/commodities/dateinterval.hpp
Expand Up @@ -39,7 +39,7 @@ namespace QuantLib {
Date startDate_;
Date endDate_;
public:
DateInterval() {}
DateInterval() = default;
DateInterval(const Date& startDate, const Date& endDate)
: startDate_(startDate), endDate_(endDate) {
QL_REQUIRE(endDate_ >= startDate_,
Expand Down
3 changes: 1 addition & 2 deletions ql/experimental/commodities/energycommodity.cpp
Expand Up @@ -26,8 +26,7 @@
namespace QuantLib {


EnergyDailyPosition::EnergyDailyPosition()
: payLegPrice(0), receiveLegPrice(0), unrealized(false) {}
EnergyDailyPosition::EnergyDailyPosition() = default;

EnergyDailyPosition::EnergyDailyPosition(const Date& date,
Real payLegPrice,
Expand Down

0 comments on commit 7bee18e

Please sign in to comment.