Skip to content

Commit

Permalink
Automated fixes by clang-tidy
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions[bot] authored and lballabio committed Feb 8, 2021
1 parent cb63142 commit cddf2c4
Show file tree
Hide file tree
Showing 209 changed files with 338 additions and 344 deletions.
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
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: 1 addition & 1 deletion ql/errors.hpp
Expand Up @@ -48,7 +48,7 @@ namespace QuantLib {
/*! the automatically generated destructor would
not have the throw specifier.
*/
~Error() throw() override {}
~Error() throw() override = default;
//! 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
2 changes: 1 addition & 1 deletion ql/experimental/commodities/energycommodity.cpp
Expand Up @@ -26,7 +26,7 @@
namespace QuantLib {


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

EnergyDailyPosition::EnergyDailyPosition(const Date& date,
Real payLegPrice,
Expand Down
2 changes: 1 addition & 1 deletion ql/experimental/commodities/exchangecontract.hpp
Expand Up @@ -48,7 +48,7 @@ namespace QuantLib {
Date underlyingEndDate_;
};

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

inline ExchangeContract::ExchangeContract(const std::string& code,
Date expirationDate,
Expand Down
2 changes: 1 addition & 1 deletion ql/experimental/commodities/paymentterm.hpp
Expand Up @@ -86,7 +86,7 @@ namespace QuantLib {
: name(name), eventType(eventType),
offsetDays(offsetDays), calendar(calendar) {}

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

inline const std::string& PaymentTerm::name() const {
return data_->name;
Expand Down
2 changes: 1 addition & 1 deletion ql/experimental/commodities/quantity.hpp
Expand Up @@ -122,7 +122,7 @@ namespace QuantLib {

// inline definitions

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

inline Quantity::Quantity(const CommodityType& commodityType,
const UnitOfMeasure& unitOfMeasure,
Expand Down
2 changes: 1 addition & 1 deletion ql/experimental/commodities/unitofmeasure.hpp
Expand Up @@ -102,7 +102,7 @@ namespace QuantLib {

// inline definitions

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

inline const std::string& UnitOfMeasure::name() const {
return data_->name;
Expand Down
2 changes: 1 addition & 1 deletion ql/experimental/commodities/unitofmeasureconversion.hpp
Expand Up @@ -105,7 +105,7 @@ namespace QuantLib {

// inline definitions

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

inline const CommodityType& UnitOfMeasureConversion::commodityType() const {
return data_->commodityType;
Expand Down
2 changes: 1 addition & 1 deletion ql/experimental/credit/basket.hpp
Expand Up @@ -52,7 +52,7 @@ namespace QuantLib {
*/
class Basket : public LazyObject {
public:
Basket() {}
Basket() = default;
/*! Constructs a basket of simple collection of constant notional
positions subject to default risk only.
Expand Down

0 comments on commit cddf2c4

Please sign in to comment.