Skip to content

Commit

Permalink
using make unique
Browse files Browse the repository at this point in the history
  • Loading branch information
lformaggia committed Apr 10, 2024
1 parent b756de8 commit 93a6384
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class QuadratureRuleAdaptive final : public QuadratureRuleBase
//!
/*!@{*/
constexpr unsigned int
num_nodes()const
num_nodes() const
{
return therule_.num_nodes();
}
Expand Down Expand Up @@ -97,8 +97,7 @@ template <class SQR>
std::unique_ptr<QuadratureRuleBase>
QuadratureRuleAdaptive<SQR>::clone() const
{
return std::unique_ptr<QuadratureRuleBase>(
new QuadratureRuleAdaptive<SQR>(*this));
return std::make_unique<QuadratureRuleAdaptive<SQR>>(*this);
}

/*!
Expand All @@ -113,10 +112,10 @@ QuadratureRuleAdaptive<SQR>::apply(FunPoint const &f, double const &a,
using std::make_pair;
using std::pair;
using std::queue;
unsigned int counter(0);
double result(0);
double dSize = b - a;
queue<pair<double, double> > subint;
unsigned int counter(0);
double result(0);
double dSize = b - a;
queue<pair<double, double>> subint;
subint.push(make_pair(a, b));

while(counter < maxIter_ && !subint.empty())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,7 @@ template <typename SQR>
std::unique_ptr<QuadratureRuleBase>
QuadratureRulePlusError<SQR>::clone() const
{
return std::unique_ptr<QuadratureRuleBase>(
new QuadratureRulePlusError<SQR>(*this));
return std::make_unique<QuadratureRulePlusError<SQR> >(*this);
}

/*!
Expand Down
2 changes: 1 addition & 1 deletion Examples/src/QuadratureRule/baseVersion/montecarlo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ MonteCarlo::MonteCarlo()
std::unique_ptr<QuadratureRuleBase>
MonteCarlo::clone() const
{
return std::unique_ptr<QuadratureRuleBase>(new MonteCarlo(*this));
return std::make_unique<MonteCarlo>(*this);
}

void
Expand Down

0 comments on commit 93a6384

Please sign in to comment.