Skip to content

Commit

Permalink
Use std::unique_ptr::operator-> rather than std::unique_ptr::get (#1676)
Browse files Browse the repository at this point in the history
  • Loading branch information
flomnes authored Oct 5, 2023
1 parent ab4e14b commit 3033c34
Show file tree
Hide file tree
Showing 19 changed files with 20 additions and 20 deletions.
2 changes: 1 addition & 1 deletion src/analyzer/atsp/correlations.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -629,7 +629,7 @@ bool ATSP::computeMonthlyCorrelations()
}

// removing the mapping list
delete mapping;
delete[] mapping;

return true;
}
Expand Down
2 changes: 1 addition & 1 deletion src/solver/optimisation/opt_alloc_probleme_a_optimiser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ void OPT_AllocateFromNumberOfVariableConstraints(PROBLEME_ANTARES_A_RESOUDRE* Pr

static void optimisationAllocateProblem(PROBLEME_HEBDO* problemeHebdo, const int mxPaliers)
{
PROBLEME_ANTARES_A_RESOUDRE* ProblemeAResoudre = problemeHebdo->ProblemeAResoudre.get();
const auto& ProblemeAResoudre = problemeHebdo->ProblemeAResoudre;

int NombreDePasDeTempsPourUneOptimisation
= problemeHebdo->NombreDePasDeTempsPourUneOptimisation;
Expand Down
4 changes: 2 additions & 2 deletions src/solver/optimisation/opt_appel_solveur_lineaire.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ static SimplexResult OPT_TryToCallSimplex(
IResultWriter& writer
)
{
PROBLEME_ANTARES_A_RESOUDRE* ProblemeAResoudre = problemeHebdo->ProblemeAResoudre.get();
const auto& ProblemeAResoudre = problemeHebdo->ProblemeAResoudre;
auto ProbSpx
= (PROBLEME_SPX*)(ProblemeAResoudre->ProblemesSpx[(int)NumIntervalle]);
auto solver = (MPSolver*)(ProblemeAResoudre->ProblemesSpx[(int)NumIntervalle]);
Expand Down Expand Up @@ -304,7 +304,7 @@ bool OPT_AppelDuSimplexe(const OptimizationOptions& options,
const OptPeriodStringGenerator& optPeriodStringGenerator,
IResultWriter& writer)
{
PROBLEME_ANTARES_A_RESOUDRE* ProblemeAResoudre = problemeHebdo->ProblemeAResoudre.get();
const auto& ProblemeAResoudre = problemeHebdo->ProblemeAResoudre;
Optimization::PROBLEME_SIMPLEXE_NOMME Probleme(ProblemeAResoudre->NomDesVariables,
ProblemeAResoudre->NomDesContraintes,
ProblemeAResoudre->StatutDesVariables,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ void OPT_ConstruireLaMatriceDesContraintesDuProblemeLineaireCoutsDeDemarrage(
PROBLEME_HEBDO* problemeHebdo,
bool Simulation)
{
PROBLEME_ANTARES_A_RESOUDRE* ProblemeAResoudre = problemeHebdo->ProblemeAResoudre.get();
const auto& ProblemeAResoudre = problemeHebdo->ProblemeAResoudre;

int nombreDePasDeTempsPourUneOptimisation
= problemeHebdo->NombreDePasDeTempsPourUneOptimisation;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ using namespace Antares::Data;

void OPT_ConstruireLaMatriceDesContraintesDuProblemeLineaire(PROBLEME_HEBDO* problemeHebdo, Solver::IResultWriter& writer)
{
PROBLEME_ANTARES_A_RESOUDRE* ProblemeAResoudre = problemeHebdo->ProblemeAResoudre.get();
const auto& ProblemeAResoudre = problemeHebdo->ProblemeAResoudre;

int nombreDePasDeTempsDUneJournee = problemeHebdo->NombreDePasDeTempsDUneJournee;
int nombreDePasDeTempsPourUneOptimisation
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ void OPT_ConstruireLaListeDesVariablesOptimiseesDuProblemeLineaireCoutsDeDemarra
PROBLEME_HEBDO* problemeHebdo,
bool Simulation)
{
PROBLEME_ANTARES_A_RESOUDRE* ProblemeAResoudre = problemeHebdo->ProblemeAResoudre.get();
const auto& ProblemeAResoudre = problemeHebdo->ProblemeAResoudre;

int nombreDePasDeTempsPourUneOptimisation
= problemeHebdo->NombreDePasDeTempsPourUneOptimisation;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@

void OPT_ConstruireLaListeDesVariablesOptimiseesDuProblemeLineaire(PROBLEME_HEBDO* problemeHebdo)
{
PROBLEME_ANTARES_A_RESOUDRE* ProblemeAResoudre = problemeHebdo->ProblemeAResoudre.get();
const auto& ProblemeAResoudre = problemeHebdo->ProblemeAResoudre;

int NombreDePasDeTempsPourUneOptimisation
= problemeHebdo->NombreDePasDeTempsPourUneOptimisation;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@

void OPT_ConstruireLaListeDesVariablesOptimiseesDuProblemeQuadratique(PROBLEME_HEBDO* problemeHebdo)
{
PROBLEME_ANTARES_A_RESOUDRE* ProblemeAResoudre = problemeHebdo->ProblemeAResoudre.get();
const auto& ProblemeAResoudre = problemeHebdo->ProblemeAResoudre;
assert(ProblemeAResoudre != NULL);

int nombreDeVariables = 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ using namespace Antares;

int OPT_DecompteDesVariablesEtDesContraintesDuProblemeAOptimiser(PROBLEME_HEBDO* problemeHebdo)
{
PROBLEME_ANTARES_A_RESOUDRE* ProblemeAResoudre = problemeHebdo->ProblemeAResoudre.get();
const auto& ProblemeAResoudre = problemeHebdo->ProblemeAResoudre;
int nombreDePasDeTempsPourUneOptimisation
= problemeHebdo->NombreDePasDeTempsPourUneOptimisation;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ void OPT_InitialiserLesBornesDesVariablesDuProblemeLineaire(PROBLEME_HEBDO* prob
const int DernierPdtDeLIntervalle,
const int optimizationNumber)
{
PROBLEME_ANTARES_A_RESOUDRE* ProblemeAResoudre = problemeHebdo->ProblemeAResoudre.get();
const auto& ProblemeAResoudre = problemeHebdo->ProblemeAResoudre;

std::vector<double*>& AdresseOuPlacerLaValeurDesVariablesOptimisees
= ProblemeAResoudre->AdresseOuPlacerLaValeurDesVariablesOptimisees;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ using namespace Yuni;
void OPT_InitialiserLesBornesDesVariablesDuProblemeQuadratique(PROBLEME_HEBDO* problemeHebdo,
int PdtHebdo)
{
PROBLEME_ANTARES_A_RESOUDRE* ProblemeAResoudre = problemeHebdo->ProblemeAResoudre.get();
const auto& ProblemeAResoudre = problemeHebdo->ProblemeAResoudre;

for (int i = 0; i < ProblemeAResoudre->NombreDeVariables; i++)
ProblemeAResoudre->AdresseOuPlacerLaValeurDesVariablesOptimisees[i] = nullptr;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ void OPT_InitialiserLesBornesDesVariablesDuProblemeLineaireCoutsDeDemarrage(
const int PremierPdtDeLIntervalle,
const int DernierPdtDeLIntervalle)
{
PROBLEME_ANTARES_A_RESOUDRE* ProblemeAResoudre = problemeHebdo->ProblemeAResoudre.get();
const auto& ProblemeAResoudre = problemeHebdo->ProblemeAResoudre;
int NombreDePasDeTempsPourUneOptimisation
= problemeHebdo->NombreDePasDeTempsPourUneOptimisation;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ void OPT_InitialiserLesCoutsLineaire(PROBLEME_HEBDO* problemeHebdo,
const int PremierPdtDeLIntervalle,
const int DernierPdtDeLIntervalle)
{
PROBLEME_ANTARES_A_RESOUDRE* ProblemeAResoudre = problemeHebdo->ProblemeAResoudre.get();
const auto& ProblemeAResoudre = problemeHebdo->ProblemeAResoudre;

int pdtJour = 0;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@

void OPT_InitialiserLesCoutsQuadratiques(PROBLEME_HEBDO* problemeHebdo, int PdtHebdo)
{
PROBLEME_ANTARES_A_RESOUDRE* ProblemeAResoudre = problemeHebdo->ProblemeAResoudre.get();
const auto& ProblemeAResoudre = problemeHebdo->ProblemeAResoudre;

ProblemeAResoudre->CoutLineaire.assign(ProblemeAResoudre->NombreDeVariables, 0.);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ void OPT_InitialiserLesCoutsLineaireCoutsDeDemarrage(PROBLEME_HEBDO* problemeHeb
const int PremierPdtDeLIntervalle,
const int DernierPdtDeLIntervalle)
{
PROBLEME_ANTARES_A_RESOUDRE* ProblemeAResoudre = problemeHebdo->ProblemeAResoudre.get();
const auto& ProblemeAResoudre = problemeHebdo->ProblemeAResoudre;
std::vector<double>& CoutLineaire = ProblemeAResoudre->CoutLineaire;

for (int pdtHebdo = PremierPdtDeLIntervalle, pdtJour = 0; pdtHebdo < DernierPdtDeLIntervalle;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ void OPT_InitialiserLeSecondMembreDuProblemeLineaire(PROBLEME_HEBDO* problemeHeb
{
int weekFirstHour = problemeHebdo->weekInTheYear * 168;

PROBLEME_ANTARES_A_RESOUDRE* ProblemeAResoudre = problemeHebdo->ProblemeAResoudre.get();
const auto& ProblemeAResoudre = problemeHebdo->ProblemeAResoudre;

std::vector<double>& SecondMembre = ProblemeAResoudre->SecondMembre;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@

void OPT_InitialiserLeSecondMembreDuProblemeQuadratique(PROBLEME_HEBDO* problemeHebdo, int PdtHebdo)
{
PROBLEME_ANTARES_A_RESOUDRE* ProblemeAResoudre = problemeHebdo->ProblemeAResoudre.get();
const auto& ProblemeAResoudre = problemeHebdo->ProblemeAResoudre;

for (uint32_t pays = 0; pays < problemeHebdo->NombreDePays - 1; pays++)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ void OPT_InitialiserLeSecondMembreDuProblemeLineaireCoutsDeDemarrage(PROBLEME_HE
int PremierPdtDeLIntervalle,
int DernierPdtDeLIntervalle)
{
PROBLEME_ANTARES_A_RESOUDRE* ProblemeAResoudre = problemeHebdo->ProblemeAResoudre.get();
const auto& ProblemeAResoudre = problemeHebdo->ProblemeAResoudre;
std::vector<double>& SecondMembre = ProblemeAResoudre->SecondMembre;

std::vector<double*>& AdresseOuPlacerLaValeurDesCoutsMarginaux
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ void OPT_LiberationProblemesSimplexe(const OptimizationOptions& options, const P

int nbIntervalles = problemeHebdo->NombreDePasDeTemps / NombreDePasDeTempsPourUneOptimisation;

const PROBLEME_ANTARES_A_RESOUDRE* ProblemeAResoudre = problemeHebdo->ProblemeAResoudre.get();
const auto& ProblemeAResoudre = problemeHebdo->ProblemeAResoudre;
if (!ProblemeAResoudre)
return;

Expand Down

0 comments on commit 3033c34

Please sign in to comment.