-
Notifications
You must be signed in to change notification settings - Fork 23
Kulikov Maksimilian #35
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clang-tidy made some suggestions
task_03/src/bell_john.hpp
Outdated
@@ -0,0 +1,8 @@ | |||
#include "dijkstra.hpp" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: 'dijkstra.hpp' file not found [clang-diagnostic-error]
#include "dijkstra.hpp"
^
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clang-tidy made some suggestions
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clang-tidy made some suggestions
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clang-tidy made some suggestions
@@ -1 +1,45 @@ | |||
#include "util.hpp" | |||
|
|||
EdgeOrientedGraph::EdgeOrientedGraph(int V, std::vector<std::vector<int>> edges) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: the parameter 'edges' is copied for each invocation but only used as a const reference; consider making it a const reference [performance-unnecessary-value-param]
lib/src/util.hpp:12:
- EdgeOrientedGraph(int V, std::vector<std::vector<int>> edges);
+ EdgeOrientedGraph(int V, const std::vector<std::vector<int>>& edges);
EdgeOrientedGraph::EdgeOrientedGraph(int V, std::vector<std::vector<int>> edges) { | |
EdgeOrientedGraph::EdgeOrientedGraph(int V, const std::vector<std::vector<int>>& edges) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
нет тестов, и задач, и код стайл не тот(
и форматирование не то(
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
не экономь на именах
@@ -0,0 +1,33 @@ | |||
#include "topo.hpp" | |||
|
|||
void topo_recr(EdgeOrientedGraph& graph, std::stack<int>& vstack, std::vector<int>& vcolor, int current) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
не по код стайлу(
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clang-tidy made some suggestions
There were too many comments to post at once. Showing the first 15 out of 18. Check the log or trigger a new build to see more.
@@ -1 +1,45 @@ | |||
#include "util.hpp" | |||
|
|||
EdgeOrientedGraph::EdgeOrientedGraph(int V, std::vector<std::vector<int>> edges) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: the parameter 'edges' is copied for each invocation but only used as a const reference; consider making it a const reference [performance-unnecessary-value-param]
lib/src/util.hpp:12:
- EdgeOrientedGraph(int V, std::vector<std::vector<int>> edges);
+ EdgeOrientedGraph(int V, const std::vector<std::vector<int>>& edges);
EdgeOrientedGraph::EdgeOrientedGraph(int V, std::vector<std::vector<int>> edges) { | |
EdgeOrientedGraph::EdgeOrientedGraph(int V, const std::vector<std::vector<int>>& edges) { |
|
||
EdgeOrientedGraph::EdgeOrientedGraph(EdgeOrientedGraph const& graph) : _ways(graph._ways) {} | ||
|
||
int EdgeOrientedGraph::size() { return _ways.size(); } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: narrowing conversion from 'size_type' (aka 'unsigned long') to signed type 'int' is implementation-defined [cppcoreguidelines-narrowing-conversions]
int EdgeOrientedGraph::size() { return _ways.size(); }
^
} | ||
|
||
OrientedWeightedGraph::OrientedWeightedGraph(std::vector<std::vector<double>> const& weights) : _weights(weights) { | ||
int V = weights.size(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: narrowing conversion from 'size_type' (aka 'unsigned long') to signed type 'int' is implementation-defined [cppcoreguidelines-narrowing-conversions]
int V = weights.size();
^
} | ||
|
||
OrientedWeightedGraph::OrientedWeightedGraph(std::vector<std::vector<double>> const& weights) : _weights(weights) { | ||
int V = weights.size(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: variable 'V' of type 'int' can be declared 'const' [misc-const-correctness]
int V = weights.size(); | |
int const V = weights.size(); |
x.pop_back(); | ||
} | ||
|
||
int OrientedWeightedGraph::size() { return _weights.size(); } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: narrowing conversion from 'size_type' (aka 'unsigned long') to signed type 'int' is implementation-defined [cppcoreguidelines-narrowing-conversions]
int OrientedWeightedGraph::size() { return _weights.size(); }
^
task_04/src/test.cpp
Outdated
TEST(Dijkstra, Simple) { | ||
std::vector<double> expected = {0., 7., 9., 20., 20., 11.}; | ||
|
||
double inf = std::numeric_limits<double>::infinity(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: variable 'inf' of type 'double' can be declared 'const' [misc-const-correctness]
double inf = std::numeric_limits<double>::infinity(); | |
double const inf = std::numeric_limits<double>::infinity(); |
#include <cmath> | ||
|
||
template<class Comparator> | ||
std::vector<std::vector<double>> sparse_table(std::vector<double> vals, Comparator comp) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: the parameter 'vals' is copied for each invocation but only used as a const reference; consider making it a const reference [performance-unnecessary-value-param]
std::vector<std::vector<double>> sparse_table(std::vector<double> vals, Comparator comp) {
^
|
||
template<class Comparator> | ||
std::vector<std::vector<double>> sparse_table(std::vector<double> vals, Comparator comp) { | ||
int K = static_cast<int>(std::log2(vals.size()))+1; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: variable 'K' of type 'int' can be declared 'const' [misc-const-correctness]
int K = static_cast<int>(std::log2(vals.size()))+1; | |
int const K = static_cast<int>(std::log2(vals.size()))+1; |
|
||
template<class Comparator> | ||
double rmq(int start, int finish, std::vector<std::vector<double>> sparse_table, Comparator comp) { | ||
int K = static_cast<int>(std::log2(finish - start + 1)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: variable 'K' of type 'int' can be declared 'const' [misc-const-correctness]
int K = static_cast<int>(std::log2(finish - start + 1)); | |
int const K = static_cast<int>(std::log2(finish - start + 1)); |
task_05/src/test.cpp
Outdated
TEST(TopologySort, Simple) { | ||
ASSERT_EQ(1, 1); // Stack [] | ||
TEST(RMQ, Simple) { | ||
double expected = 2; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: variable 'expected' of type 'double' can be declared 'const' [misc-const-correctness]
double expected = 2; | |
double const expected = 2; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clang-tidy made some suggestions
@@ -1 +1,45 @@ | |||
#include "util.hpp" | |||
|
|||
EdgeOrientedGraph::EdgeOrientedGraph(int V, std::vector<std::vector<int>> edges) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: the parameter 'edges' is copied for each invocation but only used as a const reference; consider making it a const reference [performance-unnecessary-value-param]
lib/src/util.hpp:12:
- EdgeOrientedGraph(int V, std::vector<std::vector<int>> edges);
+ EdgeOrientedGraph(int V, const std::vector<std::vector<int>>& edges);
EdgeOrientedGraph::EdgeOrientedGraph(int V, std::vector<std::vector<int>> edges) { | |
EdgeOrientedGraph::EdgeOrientedGraph(int V, const std::vector<std::vector<int>>& edges) { |
|
||
EdgeOrientedGraph::EdgeOrientedGraph(EdgeOrientedGraph const& graph) : _ways(graph._ways) {} | ||
|
||
int EdgeOrientedGraph::size() { return _ways.size(); } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: narrowing conversion from 'size_type' (aka 'unsigned long') to signed type 'int' is implementation-defined [cppcoreguidelines-narrowing-conversions]
int EdgeOrientedGraph::size() { return _ways.size(); }
^
} | ||
|
||
OrientedWeightedGraph::OrientedWeightedGraph(std::vector<std::vector<double>> const& weights) : _weights(weights) { | ||
int V = weights.size(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: narrowing conversion from 'size_type' (aka 'unsigned long') to signed type 'int' is implementation-defined [cppcoreguidelines-narrowing-conversions]
int V = weights.size();
^
} | ||
|
||
OrientedWeightedGraph::OrientedWeightedGraph(std::vector<std::vector<double>> const& weights) : _weights(weights) { | ||
int V = weights.size(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: variable 'V' of type 'int' can be declared 'const' [misc-const-correctness]
int V = weights.size(); | |
int const V = weights.size(); |
x.pop_back(); | ||
} | ||
|
||
int OrientedWeightedGraph::size() { return _weights.size(); } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: narrowing conversion from 'size_type' (aka 'unsigned long') to signed type 'int' is implementation-defined [cppcoreguidelines-narrowing-conversions]
int OrientedWeightedGraph::size() { return _weights.size(); }
^
|
||
template<class Comparator> | ||
double rmq(int start, int finish, std::vector<std::vector<double>> sparse_table, Comparator comp) { | ||
int K = static_cast<int>(std::log2(finish - start + 1)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: variable 'K' of type 'int' can be declared 'const' [misc-const-correctness]
int K = static_cast<int>(std::log2(finish - start + 1)); | |
int const K = static_cast<int>(std::log2(finish - start + 1)); |
|
||
TEST(TopologySort, Simple) { | ||
TEST(RMQ, Simple) { | ||
// double expected = 2; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: variable 'expected' of type 'double' can be declared 'const' [misc-const-correctness]
// double expected = 2; | |
double const expected = 2; |
TEST(RMQ, Simple) { | ||
// double expected = 2; | ||
// // 0 1 2 3 4 5 6 7 8 9 | ||
// std::vector<double> vals = {3, 8, 6, 4, 2, 5, 9, 0, 7, 1}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: variable 'vals' of type 'std::vector' can be declared 'const' [misc-const-correctness]
// std::vector<double> vals = {3, 8, 6, 4, 2, 5, 9, 0, 7, 1}; | |
std::vector<double> const vals = {3, 8, 6, 4, 2, 5, 9, 0, 7, 1}; |
// double expected = 2; | ||
// // 0 1 2 3 4 5 6 7 8 9 | ||
// std::vector<double> vals = {3, 8, 6, 4, 2, 5, 9, 0, 7, 1}; | ||
// std::vector<std::vector<double>> result = sparse_table(vals, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: variable 'result' of type 'std::vector<std::vector>' can be declared 'const' [misc-const-correctness]
// std::vector<std::vector<double>> result = sparse_table(vals, | |
std::vector<std::vector<double>> const result = sparse_table(vals, |
// std::vector<double> vals = {3, 8, 6, 4, 2, 5, 9, 0, 7, 1}; | ||
// std::vector<std::vector<double>> result = sparse_table(vals, | ||
// std::less<double>()); | ||
// double num = rmq(1, 6, res, std::less<double>()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: use of undeclared identifier 'res' [clang-diagnostic-error]
double num = rmq(1, 6, res, std::less<double>());
^
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clang-tidy made some suggestions
@@ -1 +1,45 @@ | |||
#include "util.hpp" | |||
|
|||
EdgeOrientedGraph::EdgeOrientedGraph(int V, std::vector<std::vector<int>> edges) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: the parameter 'edges' is copied for each invocation but only used as a const reference; consider making it a const reference [performance-unnecessary-value-param]
lib/src/util.hpp:12:
- EdgeOrientedGraph(int V, std::vector<std::vector<int>> edges);
+ EdgeOrientedGraph(int V, const std::vector<std::vector<int>>& edges);
EdgeOrientedGraph::EdgeOrientedGraph(int V, std::vector<std::vector<int>> edges) { | |
EdgeOrientedGraph::EdgeOrientedGraph(int V, const std::vector<std::vector<int>>& edges) { |
|
||
EdgeOrientedGraph::EdgeOrientedGraph(EdgeOrientedGraph const& graph) : _ways(graph._ways) {} | ||
|
||
int EdgeOrientedGraph::size() { return _ways.size(); } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: narrowing conversion from 'size_type' (aka 'unsigned long') to signed type 'int' is implementation-defined [cppcoreguidelines-narrowing-conversions]
int EdgeOrientedGraph::size() { return _ways.size(); }
^
} | ||
|
||
OrientedWeightedGraph::OrientedWeightedGraph(std::vector<std::vector<double>> const& weights) : _weights(weights) { | ||
int V = weights.size(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: narrowing conversion from 'size_type' (aka 'unsigned long') to signed type 'int' is implementation-defined [cppcoreguidelines-narrowing-conversions]
int V = weights.size();
^
} | ||
|
||
OrientedWeightedGraph::OrientedWeightedGraph(std::vector<std::vector<double>> const& weights) : _weights(weights) { | ||
int V = weights.size(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: variable 'V' of type 'int' can be declared 'const' [misc-const-correctness]
int V = weights.size(); | |
int const V = weights.size(); |
x.pop_back(); | ||
} | ||
|
||
int OrientedWeightedGraph::size() { return _weights.size(); } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: narrowing conversion from 'size_type' (aka 'unsigned long') to signed type 'int' is implementation-defined [cppcoreguidelines-narrowing-conversions]
int OrientedWeightedGraph::size() { return _weights.size(); }
^
|
||
template<class Comparator> | ||
std::vector<std::vector<double>> sparse_table(std::vector<double> vals, Comparator comp) { | ||
int K = static_cast<int>(std::log2(vals.size()))+1; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: variable 'K' of type 'int' can be declared 'const' [misc-const-correctness]
int K = static_cast<int>(std::log2(vals.size()))+1; | |
int const K = static_cast<int>(std::log2(vals.size()))+1; |
|
||
template<class Comparator> | ||
double rmq(int start, int finish, std::vector<std::vector<double>> sparse_table, Comparator comp) { | ||
int K = static_cast<int>(std::log2(finish - start + 1)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: variable 'K' of type 'int' can be declared 'const' [misc-const-correctness]
int K = static_cast<int>(std::log2(finish - start + 1)); | |
int const K = static_cast<int>(std::log2(finish - start + 1)); |
|
||
TEST(TopologySort, Simple) { | ||
TEST(RMQ, Simple) { | ||
// double expected = 2; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: variable 'expected' of type 'double' can be declared 'const' [misc-const-correctness]
// double expected = 2; | |
double const expected = 2; |
TEST(RMQ, Simple) { | ||
// double expected = 2; | ||
// // 0 1 2 3 4 5 6 7 8 9 | ||
// std::vector<double> vals = {3, 8, 6, 4, 2, 5, 9, 0, 7, 1}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: variable 'vals' of type 'std::vector' can be declared 'const' [misc-const-correctness]
// std::vector<double> vals = {3, 8, 6, 4, 2, 5, 9, 0, 7, 1}; | |
std::vector<double> const vals = {3, 8, 6, 4, 2, 5, 9, 0, 7, 1}; |
// double expected = 2; | ||
// // 0 1 2 3 4 5 6 7 8 9 | ||
// std::vector<double> vals = {3, 8, 6, 4, 2, 5, 9, 0, 7, 1}; | ||
// std::vector<std::vector<double>> result = sparse_table(vals, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: variable 'result' of type 'std::vector<std::vector>' can be declared 'const' [misc-const-correctness]
// std::vector<std::vector<double>> result = sparse_table(vals, | |
std::vector<std::vector<double>> const result = sparse_table(vals, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clang-tidy made some suggestions
@@ -1 +1,45 @@ | |||
#include "util.hpp" | |||
|
|||
EdgeOrientedGraph::EdgeOrientedGraph(int V, std::vector<std::vector<int>> edges) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: the parameter 'edges' is copied for each invocation but only used as a const reference; consider making it a const reference [performance-unnecessary-value-param]
lib/src/util.hpp:12:
- EdgeOrientedGraph(int V, std::vector<std::vector<int>> edges);
+ EdgeOrientedGraph(int V, const std::vector<std::vector<int>>& edges);
EdgeOrientedGraph::EdgeOrientedGraph(int V, std::vector<std::vector<int>> edges) { | |
EdgeOrientedGraph::EdgeOrientedGraph(int V, const std::vector<std::vector<int>>& edges) { |
|
||
EdgeOrientedGraph::EdgeOrientedGraph(EdgeOrientedGraph const& graph) : _ways(graph._ways) {} | ||
|
||
int EdgeOrientedGraph::size() { return _ways.size(); } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: narrowing conversion from 'size_type' (aka 'unsigned long') to signed type 'int' is implementation-defined [cppcoreguidelines-narrowing-conversions]
int EdgeOrientedGraph::size() { return _ways.size(); }
^
} | ||
|
||
OrientedWeightedGraph::OrientedWeightedGraph(std::vector<std::vector<double>> const& weights) : _weights(weights) { | ||
int V = weights.size(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: narrowing conversion from 'size_type' (aka 'unsigned long') to signed type 'int' is implementation-defined [cppcoreguidelines-narrowing-conversions]
int V = weights.size();
^
} | ||
|
||
OrientedWeightedGraph::OrientedWeightedGraph(std::vector<std::vector<double>> const& weights) : _weights(weights) { | ||
int V = weights.size(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: variable 'V' of type 'int' can be declared 'const' [misc-const-correctness]
int V = weights.size(); | |
int const V = weights.size(); |
x.pop_back(); | ||
} | ||
|
||
int OrientedWeightedGraph::size() { return _weights.size(); } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: narrowing conversion from 'size_type' (aka 'unsigned long') to signed type 'int' is implementation-defined [cppcoreguidelines-narrowing-conversions]
int OrientedWeightedGraph::size() { return _weights.size(); }
^
|
||
template<class Comparator> | ||
std::vector<std::vector<double>> sparse_table(std::vector<double> vals, Comparator comp) { | ||
int K = static_cast<int>(std::log2(vals.size()))+1; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: variable 'K' of type 'int' can be declared 'const' [misc-const-correctness]
int K = static_cast<int>(std::log2(vals.size()))+1; | |
int const K = static_cast<int>(std::log2(vals.size()))+1; |
|
||
template<class Comparator> | ||
double rmq(int start, int finish, std::vector<std::vector<double>> sparse_table, Comparator comp) { | ||
int K = static_cast<int>(std::log2(finish - start + 1)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: variable 'K' of type 'int' can be declared 'const' [misc-const-correctness]
int K = static_cast<int>(std::log2(finish - start + 1)); | |
int const K = static_cast<int>(std::log2(finish - start + 1)); |
|
||
TEST(TopologySort, Simple) { | ||
TEST(RMQ, Simple) { | ||
// double expected = 2; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: variable 'expected' of type 'double' can be declared 'const' [misc-const-correctness]
// double expected = 2; | |
double const expected = 2; |
TEST(RMQ, Simple) { | ||
// double expected = 2; | ||
// // 0 1 2 3 4 5 6 7 8 9 | ||
// std::vector<double> vals = {3, 8, 6, 4, 2, 5, 9, 0, 7, 1}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: variable 'vals' of type 'std::vector' can be declared 'const' [misc-const-correctness]
// std::vector<double> vals = {3, 8, 6, 4, 2, 5, 9, 0, 7, 1}; | |
std::vector<double> const vals = {3, 8, 6, 4, 2, 5, 9, 0, 7, 1}; |
// double expected = 2; | ||
// // 0 1 2 3 4 5 6 7 8 9 | ||
// std::vector<double> vals = {3, 8, 6, 4, 2, 5, 9, 0, 7, 1}; | ||
// std::vector<std::vector<double>> result = sparse_table(vals, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: variable 'result' of type 'std::vector<std::vector>' can be declared 'const' [misc-const-correctness]
// std::vector<std::vector<double>> result = sparse_table(vals, | |
std::vector<std::vector<double>> const result = sparse_table(vals, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clang-tidy made some suggestions
@@ -1 +1,45 @@ | |||
#include "util.hpp" | |||
|
|||
EdgeOrientedGraph::EdgeOrientedGraph(int V, std::vector<std::vector<int>> edges) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: the parameter 'edges' is copied for each invocation but only used as a const reference; consider making it a const reference [performance-unnecessary-value-param]
lib/src/util.hpp:12:
- EdgeOrientedGraph(int V, std::vector<std::vector<int>> edges);
+ EdgeOrientedGraph(int V, const std::vector<std::vector<int>>& edges);
EdgeOrientedGraph::EdgeOrientedGraph(int V, std::vector<std::vector<int>> edges) { | |
EdgeOrientedGraph::EdgeOrientedGraph(int V, const std::vector<std::vector<int>>& edges) { |
|
||
EdgeOrientedGraph::EdgeOrientedGraph(EdgeOrientedGraph const& graph) : _ways(graph._ways) {} | ||
|
||
int EdgeOrientedGraph::size() { return _ways.size(); } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: narrowing conversion from 'size_type' (aka 'unsigned long') to signed type 'int' is implementation-defined [cppcoreguidelines-narrowing-conversions]
int EdgeOrientedGraph::size() { return _ways.size(); }
^
} | ||
|
||
OrientedWeightedGraph::OrientedWeightedGraph(std::vector<std::vector<double>> const& weights) : _weights(weights) { | ||
int V = weights.size(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: narrowing conversion from 'size_type' (aka 'unsigned long') to signed type 'int' is implementation-defined [cppcoreguidelines-narrowing-conversions]
int V = weights.size();
^
} | ||
|
||
OrientedWeightedGraph::OrientedWeightedGraph(std::vector<std::vector<double>> const& weights) : _weights(weights) { | ||
int V = weights.size(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: variable 'V' of type 'int' can be declared 'const' [misc-const-correctness]
int V = weights.size(); | |
int const V = weights.size(); |
x.pop_back(); | ||
} | ||
|
||
int OrientedWeightedGraph::size() { return _weights.size(); } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: narrowing conversion from 'size_type' (aka 'unsigned long') to signed type 'int' is implementation-defined [cppcoreguidelines-narrowing-conversions]
int OrientedWeightedGraph::size() { return _weights.size(); }
^
|
||
std::vector<double> dijkstra(OrientedWeightedGraph graph, int from_key) | ||
{ | ||
double infinity = std::numeric_limits<double>::infinity(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: variable 'infinity' of type 'double' can be declared 'const' [misc-const-correctness]
double infinity = std::numeric_limits<double>::infinity(); | |
double const infinity = std::numeric_limits<double>::infinity(); |
#include <cmath> | ||
|
||
template<class Comparator> | ||
std::vector<std::vector<double>> sparse_table(std::vector<double> vals, Comparator comp) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: the parameter 'vals' is copied for each invocation but only used as a const reference; consider making it a const reference [performance-unnecessary-value-param]
std::vector<std::vector<double>> sparse_table(std::vector<double> vals, Comparator comp) {
^
|
||
template<class Comparator> | ||
std::vector<std::vector<double>> sparse_table(std::vector<double> vals, Comparator comp) { | ||
int K = static_cast<int>(std::log2(vals.size()))+1; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: variable 'K' of type 'int' can be declared 'const' [misc-const-correctness]
int K = static_cast<int>(std::log2(vals.size()))+1; | |
int const K = static_cast<int>(std::log2(vals.size()))+1; |
|
||
template<class Comparator> | ||
double rmq(int start, int finish, std::vector<std::vector<double>> sparse_table, Comparator comp) { | ||
int K = static_cast<int>(std::log2(finish - start + 1)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: variable 'K' of type 'int' can be declared 'const' [misc-const-correctness]
int K = static_cast<int>(std::log2(finish - start + 1)); | |
int const K = static_cast<int>(std::log2(finish - start + 1)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clang-tidy made some suggestions
@@ -1 +1,45 @@ | |||
#include "util.hpp" | |||
|
|||
EdgeOrientedGraph::EdgeOrientedGraph(int V, std::vector<std::vector<int>> edges) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: the parameter 'edges' is copied for each invocation but only used as a const reference; consider making it a const reference [performance-unnecessary-value-param]
lib/src/util.hpp:12:
- EdgeOrientedGraph(int V, std::vector<std::vector<int>> edges);
+ EdgeOrientedGraph(int V, const std::vector<std::vector<int>>& edges);
EdgeOrientedGraph::EdgeOrientedGraph(int V, std::vector<std::vector<int>> edges) { | |
EdgeOrientedGraph::EdgeOrientedGraph(int V, const std::vector<std::vector<int>>& edges) { |
|
||
EdgeOrientedGraph::EdgeOrientedGraph(EdgeOrientedGraph const& graph) : _ways(graph._ways) {} | ||
|
||
int EdgeOrientedGraph::size() { return _ways.size(); } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: narrowing conversion from 'size_type' (aka 'unsigned long') to signed type 'int' is implementation-defined [cppcoreguidelines-narrowing-conversions]
int EdgeOrientedGraph::size() { return _ways.size(); }
^
} | ||
|
||
OrientedWeightedGraph::OrientedWeightedGraph(std::vector<std::vector<double>> const& weights) : _weights(weights) { | ||
int V = weights.size(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: narrowing conversion from 'size_type' (aka 'unsigned long') to signed type 'int' is implementation-defined [cppcoreguidelines-narrowing-conversions]
int V = weights.size();
^
} | ||
|
||
OrientedWeightedGraph::OrientedWeightedGraph(std::vector<std::vector<double>> const& weights) : _weights(weights) { | ||
int V = weights.size(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: variable 'V' of type 'int' can be declared 'const' [misc-const-correctness]
int V = weights.size(); | |
int const V = weights.size(); |
x.pop_back(); | ||
} | ||
|
||
int OrientedWeightedGraph::size() { return _weights.size(); } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: narrowing conversion from 'size_type' (aka 'unsigned long') to signed type 'int' is implementation-defined [cppcoreguidelines-narrowing-conversions]
int OrientedWeightedGraph::size() { return _weights.size(); }
^
|
||
std::vector<double> dijkstra(OrientedWeightedGraph graph, int from_key) | ||
{ | ||
double infinity = std::numeric_limits<double>::infinity(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: variable 'infinity' of type 'double' can be declared 'const' [misc-const-correctness]
double infinity = std::numeric_limits<double>::infinity(); | |
double const infinity = std::numeric_limits<double>::infinity(); |
#include <cmath> | ||
|
||
template<class Comparator> | ||
std::vector<std::vector<double>> sparse_table(std::vector<double> vals, Comparator comp) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: the parameter 'vals' is copied for each invocation but only used as a const reference; consider making it a const reference [performance-unnecessary-value-param]
std::vector<std::vector<double>> sparse_table(std::vector<double> vals, Comparator comp) {
^
|
||
template<class Comparator> | ||
std::vector<std::vector<double>> sparse_table(std::vector<double> vals, Comparator comp) { | ||
int K = static_cast<int>(std::log2(vals.size()))+1; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: variable 'K' of type 'int' can be declared 'const' [misc-const-correctness]
int K = static_cast<int>(std::log2(vals.size()))+1; | |
int const K = static_cast<int>(std::log2(vals.size()))+1; |
|
||
template<class Comparator> | ||
double rmq(int start, int finish, std::vector<std::vector<double>> sparse_table, Comparator comp) { | ||
int K = static_cast<int>(std::log2(finish - start + 1)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: variable 'K' of type 'int' can be declared 'const' [misc-const-correctness]
int K = static_cast<int>(std::log2(finish - start + 1)); | |
int const K = static_cast<int>(std::log2(finish - start + 1)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clang-tidy made some suggestions
@@ -1 +1,45 @@ | |||
#include "util.hpp" | |||
|
|||
EdgeOrientedGraph::EdgeOrientedGraph(int V, std::vector<std::vector<int>> edges) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: the parameter 'edges' is copied for each invocation but only used as a const reference; consider making it a const reference [performance-unnecessary-value-param]
lib/src/util.hpp:12:
- EdgeOrientedGraph(int V, std::vector<std::vector<int>> edges);
+ EdgeOrientedGraph(int V, const std::vector<std::vector<int>>& edges);
EdgeOrientedGraph::EdgeOrientedGraph(int V, std::vector<std::vector<int>> edges) { | |
EdgeOrientedGraph::EdgeOrientedGraph(int V, const std::vector<std::vector<int>>& edges) { |
|
||
EdgeOrientedGraph::EdgeOrientedGraph(EdgeOrientedGraph const& graph) : _ways(graph._ways) {} | ||
|
||
int EdgeOrientedGraph::size() { return _ways.size(); } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: narrowing conversion from 'size_type' (aka 'unsigned long') to signed type 'int' is implementation-defined [cppcoreguidelines-narrowing-conversions]
int EdgeOrientedGraph::size() { return _ways.size(); }
^
} | ||
|
||
OrientedWeightedGraph::OrientedWeightedGraph(std::vector<std::vector<double>> const& weights) : _weights(weights) { | ||
int V = weights.size(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: narrowing conversion from 'size_type' (aka 'unsigned long') to signed type 'int' is implementation-defined [cppcoreguidelines-narrowing-conversions]
int V = weights.size();
^
} | ||
|
||
OrientedWeightedGraph::OrientedWeightedGraph(std::vector<std::vector<double>> const& weights) : _weights(weights) { | ||
int V = weights.size(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: variable 'V' of type 'int' can be declared 'const' [misc-const-correctness]
int V = weights.size(); | |
int const V = weights.size(); |
x.pop_back(); | ||
} | ||
|
||
int OrientedWeightedGraph::size() { return _weights.size(); } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: narrowing conversion from 'size_type' (aka 'unsigned long') to signed type 'int' is implementation-defined [cppcoreguidelines-narrowing-conversions]
int OrientedWeightedGraph::size() { return _weights.size(); }
^
|
||
std::vector<double> dijkstra(OrientedWeightedGraph graph, int from_key) | ||
{ | ||
double infinity = std::numeric_limits<double>::infinity(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: variable 'infinity' of type 'double' can be declared 'const' [misc-const-correctness]
double infinity = std::numeric_limits<double>::infinity(); | |
double const infinity = std::numeric_limits<double>::infinity(); |
#include <cmath> | ||
|
||
template<class Comparator> | ||
std::vector<std::vector<double>> sparse_table(std::vector<double> vals, Comparator comp) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: the parameter 'vals' is copied for each invocation but only used as a const reference; consider making it a const reference [performance-unnecessary-value-param]
std::vector<std::vector<double>> sparse_table(std::vector<double> vals, Comparator comp) {
^
|
||
template<class Comparator> | ||
std::vector<std::vector<double>> sparse_table(std::vector<double> vals, Comparator comp) { | ||
int K = static_cast<int>(std::log2(vals.size()))+1; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: variable 'K' of type 'int' can be declared 'const' [misc-const-correctness]
int K = static_cast<int>(std::log2(vals.size()))+1; | |
int const K = static_cast<int>(std::log2(vals.size()))+1; |
|
||
template<class Comparator> | ||
double rmq(int start, int finish, std::vector<std::vector<double>> sparse_table, Comparator comp) { | ||
int K = static_cast<int>(std::log2(finish - start + 1)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: variable 'K' of type 'int' can be declared 'const' [misc-const-correctness]
int K = static_cast<int>(std::log2(finish - start + 1)); | |
int const K = static_cast<int>(std::log2(finish - start + 1)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clang-tidy made some suggestions
@@ -1 +1,45 @@ | |||
#include "util.hpp" | |||
|
|||
EdgeOrientedGraph::EdgeOrientedGraph(int V, std::vector<std::vector<int>> edges) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: the parameter 'edges' is copied for each invocation but only used as a const reference; consider making it a const reference [performance-unnecessary-value-param]
lib/src/util.hpp:12:
- EdgeOrientedGraph(int V, std::vector<std::vector<int>> edges);
+ EdgeOrientedGraph(int V, const std::vector<std::vector<int>>& edges);
EdgeOrientedGraph::EdgeOrientedGraph(int V, std::vector<std::vector<int>> edges) { | |
EdgeOrientedGraph::EdgeOrientedGraph(int V, const std::vector<std::vector<int>>& edges) { |
|
||
EdgeOrientedGraph::EdgeOrientedGraph(EdgeOrientedGraph const& graph) : _ways(graph._ways) {} | ||
|
||
int EdgeOrientedGraph::size() { return _ways.size(); } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: narrowing conversion from 'size_type' (aka 'unsigned long') to signed type 'int' is implementation-defined [cppcoreguidelines-narrowing-conversions]
int EdgeOrientedGraph::size() { return _ways.size(); }
^
} | ||
|
||
OrientedWeightedGraph::OrientedWeightedGraph(std::vector<std::vector<double>> const& weights) : _weights(weights) { | ||
int V = weights.size(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: narrowing conversion from 'size_type' (aka 'unsigned long') to signed type 'int' is implementation-defined [cppcoreguidelines-narrowing-conversions]
int V = weights.size();
^
} | ||
|
||
OrientedWeightedGraph::OrientedWeightedGraph(std::vector<std::vector<double>> const& weights) : _weights(weights) { | ||
int V = weights.size(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: variable 'V' of type 'int' can be declared 'const' [misc-const-correctness]
int V = weights.size(); | |
int const V = weights.size(); |
x.pop_back(); | ||
} | ||
|
||
int OrientedWeightedGraph::size() { return _weights.size(); } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: narrowing conversion from 'size_type' (aka 'unsigned long') to signed type 'int' is implementation-defined [cppcoreguidelines-narrowing-conversions]
int OrientedWeightedGraph::size() { return _weights.size(); }
^
|
||
std::vector<double> dijkstra(OrientedWeightedGraph graph, int from_key) | ||
{ | ||
double infinity = std::numeric_limits<double>::infinity(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: variable 'infinity' of type 'double' can be declared 'const' [misc-const-correctness]
double infinity = std::numeric_limits<double>::infinity(); | |
double const infinity = std::numeric_limits<double>::infinity(); |
#include <cmath> | ||
|
||
template<class Comparator> | ||
std::vector<std::vector<double>> sparse_table(std::vector<double> vals, Comparator comp) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: the parameter 'vals' is copied for each invocation but only used as a const reference; consider making it a const reference [performance-unnecessary-value-param]
std::vector<std::vector<double>> sparse_table(std::vector<double> vals, Comparator comp) {
^
|
||
template<class Comparator> | ||
std::vector<std::vector<double>> sparse_table(std::vector<double> vals, Comparator comp) { | ||
int K = static_cast<int>(std::log2(vals.size()))+1; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: variable 'K' of type 'int' can be declared 'const' [misc-const-correctness]
int K = static_cast<int>(std::log2(vals.size()))+1; | |
int const K = static_cast<int>(std::log2(vals.size()))+1; |
|
||
template<class Comparator> | ||
double rmq(int start, int finish, std::vector<std::vector<double>> sparse_table, Comparator comp) { | ||
int K = static_cast<int>(std::log2(finish - start + 1)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: variable 'K' of type 'int' can be declared 'const' [misc-const-correctness]
int K = static_cast<int>(std::log2(finish - start + 1)); | |
int const K = static_cast<int>(std::log2(finish - start + 1)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clang-tidy made some suggestions
@@ -1 +1,45 @@ | |||
#include "util.hpp" | |||
|
|||
EdgeOrientedGraph::EdgeOrientedGraph(int V, std::vector<std::vector<int>> edges) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: the parameter 'edges' is copied for each invocation but only used as a const reference; consider making it a const reference [performance-unnecessary-value-param]
lib/src/util.hpp:12:
- EdgeOrientedGraph(int V, std::vector<std::vector<int>> edges);
+ EdgeOrientedGraph(int V, const std::vector<std::vector<int>>& edges);
EdgeOrientedGraph::EdgeOrientedGraph(int V, std::vector<std::vector<int>> edges) { | |
EdgeOrientedGraph::EdgeOrientedGraph(int V, const std::vector<std::vector<int>>& edges) { |
|
||
EdgeOrientedGraph::EdgeOrientedGraph(EdgeOrientedGraph const& graph) : _ways(graph._ways) {} | ||
|
||
int EdgeOrientedGraph::size() { return _ways.size(); } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: narrowing conversion from 'size_type' (aka 'unsigned long') to signed type 'int' is implementation-defined [cppcoreguidelines-narrowing-conversions]
int EdgeOrientedGraph::size() { return _ways.size(); }
^
} | ||
|
||
OrientedWeightedGraph::OrientedWeightedGraph(std::vector<std::vector<double>> const& weights) : _weights(weights) { | ||
int V = weights.size(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: narrowing conversion from 'size_type' (aka 'unsigned long') to signed type 'int' is implementation-defined [cppcoreguidelines-narrowing-conversions]
int V = weights.size();
^
} | ||
|
||
OrientedWeightedGraph::OrientedWeightedGraph(std::vector<std::vector<double>> const& weights) : _weights(weights) { | ||
int V = weights.size(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: variable 'V' of type 'int' can be declared 'const' [misc-const-correctness]
int V = weights.size(); | |
int const V = weights.size(); |
x.pop_back(); | ||
} | ||
|
||
int OrientedWeightedGraph::size() { return _weights.size(); } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: narrowing conversion from 'size_type' (aka 'unsigned long') to signed type 'int' is implementation-defined [cppcoreguidelines-narrowing-conversions]
int OrientedWeightedGraph::size() { return _weights.size(); }
^
|
||
std::vector<double> dijkstra(OrientedWeightedGraph graph, int from_key) | ||
{ | ||
double infinity = std::numeric_limits<double>::infinity(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: variable 'infinity' of type 'double' can be declared 'const' [misc-const-correctness]
double infinity = std::numeric_limits<double>::infinity(); | |
double const infinity = std::numeric_limits<double>::infinity(); |
#include <cmath> | ||
|
||
template<class Comparator> | ||
std::vector<std::vector<double>> sparse_table(std::vector<double> vals, Comparator comp) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: the parameter 'vals' is copied for each invocation but only used as a const reference; consider making it a const reference [performance-unnecessary-value-param]
std::vector<std::vector<double>> sparse_table(std::vector<double> vals, Comparator comp) {
^
|
||
template<class Comparator> | ||
std::vector<std::vector<double>> sparse_table(std::vector<double> vals, Comparator comp) { | ||
int K = static_cast<int>(std::log2(vals.size()))+1; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: variable 'K' of type 'int' can be declared 'const' [misc-const-correctness]
int K = static_cast<int>(std::log2(vals.size()))+1; | |
int const K = static_cast<int>(std::log2(vals.size()))+1; |
|
||
template<class Comparator> | ||
double rmq(int start, int finish, std::vector<std::vector<double>> sparse_table, Comparator comp) { | ||
int K = static_cast<int>(std::log2(finish - start + 1)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: variable 'K' of type 'int' can be declared 'const' [misc-const-correctness]
int K = static_cast<int>(std::log2(finish - start + 1)); | |
int const K = static_cast<int>(std::log2(finish - start + 1)); |
Куликов Максимилиан
Б03-312