From 759f41896ebae3c7b333b7f5263f9a4829434eb9 Mon Sep 17 00:00:00 2001 From: Mann Patel Date: Fri, 4 Jun 2021 20:06:27 +0000 Subject: [PATCH] fixed: clang-tidy warnings --- data_structures/sparse_table.cpp | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/data_structures/sparse_table.cpp b/data_structures/sparse_table.cpp index d9b38cc59..d40ce709d 100644 --- a/data_structures/sparse_table.cpp +++ b/data_structures/sparse_table.cpp @@ -1,6 +1,7 @@ #include #include #include +#include /** * * @file @@ -47,14 +48,16 @@ namespace sparse_table { const static int N = 12345, M = 14; // The array to compute its sparse table. - int n, a[N]; + int n; + std::array a; // // Sparse table related variables. // // ST[j][i] : the sparse table value (min, max, ...etc) in the interval [i, i + (2^j) - 1]. // LOG[i] : floor(log2(i)). - int ST[M][N], LOG[N]; + std::array,M> ST; + std::array LOG; /** * @@ -108,11 +111,11 @@ namespace sparse_table { * @brief testcase for sparse_table */ static void test(){ - int testcase[] = {1,2,3,4,5,6,7,8,9,10}; + std::array testcase = {1,2,3,4,5,6,7,8,9,10}; int testcase_size = sizeof(testcase)/sizeof(testcase[0]); - - data_structures::sparse_table::Sparse_table st; - + + data_structures::sparse_table::Sparse_table st{}; + // copying testcase to the struct std::copy(std::begin(testcase),std::end(testcase),std::begin(st.a)); st.n = testcase_size;