X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/e8a6be46801437262a0e5c88626615af6b4e2da7..78da1c00f59351748ceb0f957c7293b6bd71a31d:/teshsuite/surf/lmm_usage/lmm_usage.cpp diff --git a/teshsuite/surf/lmm_usage/lmm_usage.cpp b/teshsuite/surf/lmm_usage/lmm_usage.cpp index d2affab765..249ddf7a72 100644 --- a/teshsuite/surf/lmm_usage/lmm_usage.cpp +++ b/teshsuite/surf/lmm_usage/lmm_usage.cpp @@ -12,6 +12,7 @@ #include "xbt/module.h" #include "xbt/sysdep.h" #include +#include #include XBT_LOG_NEW_DEFAULT_CATEGORY(surf_test, "Messages specific for surf example"); @@ -95,18 +96,16 @@ static void test2() static void test3() { - int flows = 11; - int links = 10; + constexpr int flows = 11; + constexpr int links = 10; - auto* A = new double*[links + 5]; + std::array, links + 5> A; /* array to add the constraints of fictitious variables */ - double B[15] = { 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 1, 1, 1, 1, 1 }; + std::array B{{10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 1, 1, 1, 1, 1}}; for (int i = 0; i < links + 5; i++) { - A[i] = new double[flows + 5]; for (int j = 0; j < flows + 5; j++) { A[i][j] = 0.0; - if (i >= links || j >= flows) { A[i][j] = 0.0; } @@ -133,12 +132,12 @@ static void test3() lmm::System* Sys = lmm::make_new_maxmin_system(false); /* Creates the constraints */ - auto* tmp_cnst = new lmm::Constraint*[15]; + std::array tmp_cnst; for (int i = 0; i < 15; i++) tmp_cnst[i] = Sys->constraint_new(nullptr, B[i]); /* Creates the variables */ - auto* tmp_var = new lmm::Variable*[16]; + std::array tmp_var; for (int j = 0; j < 16; j++) { tmp_var[j] = Sys->variable_new(nullptr, 1.0, -1.0, 15); Sys->update_variable_penalty(tmp_var[j], 1.0); @@ -157,12 +156,7 @@ static void test3() for (int j = 0; j < 16; j++) Sys->variable_free(tmp_var[j]); - delete[] tmp_var; - delete[] tmp_cnst; delete Sys; - for (int i = 0; i < links + 5; i++) - delete[] A[i]; - delete[] A; } int main(int argc, char** argv)