Skip to content

. - #24

Open
KsenyaM2005 wants to merge 5 commits into
DafeMipt213:mainfrom
KsenyaM2005:main
Open

.#24
KsenyaM2005 wants to merge 5 commits into
DafeMipt213:mainfrom
KsenyaM2005:main

Conversation

@KsenyaM2005

Copy link
Copy Markdown

1 commit

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

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

Comment thread lib/src/graph.cpp
marks_[elem] = Color::White;
}

void Graph::DFS(int u, std::function<void(int)> action, bool is_clean_marks) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: the parameter 'action' is copied for each invocation but only used as a const reference; consider making it a const reference [performance-unnecessary-value-param]

lib/src/graph.hpp:19:

-   void DFS(int u, std::function<void(int)> action, bool is_clean_marks = true);
+   void DFS(int u, const std::function<void(int)>& action, bool is_clean_marks = true);
Suggested change
void Graph::DFS(int u, std::function<void(int)> action, bool is_clean_marks) {
void Graph::DFS(int u, const std::function<void(int)>& action, bool is_clean_marks) {

Comment thread lib/src/graph.cpp
}

std::map<int, std::vector<std::pair<int, int>>> Graph::Johnson() {
int s = -inf;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: variable 's' of type 'int' can be declared 'const' [misc-const-correctness]

Suggested change
int s = -inf;
int const s = -inf;

Comment thread lib/src/graph.hpp
void Add(int elem, int parent, int weight = 1);
bool IsCycle();
bool Find(int elem);
int Size() { return graph_.size(); }

Copy link
Copy Markdown

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 Size() { return graph_.size(); }
                      ^

Comment thread lib/src/tree.hpp
return (i - 1) / 2;
}
size_t LeftChld(size_t i) {
size_t inf = std::numeric_limits<int>::infinity() + 1;

Copy link
Copy Markdown

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 'size_t' (aka 'unsigned long') can be declared 'const' [misc-const-correctness]

Suggested change
size_t inf = std::numeric_limits<int>::infinity() + 1;
size_t const inf = std::numeric_limits<int>::infinity() + 1;

Comment thread lib/src/tree.hpp
return 2 * i + 1;
}
size_t RightChld(size_t i) {
size_t inf = std::numeric_limits<int>::infinity() + 1;

Copy link
Copy Markdown

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 'size_t' (aka 'unsigned long') can be declared 'const' [misc-const-correctness]

Suggested change
size_t inf = std::numeric_limits<int>::infinity() + 1;
size_t const inf = std::numeric_limits<int>::infinity() + 1;

Comment thread task_05/src/rmq.cpp
int Recursion(BinTree t, size_t l, size_t m, size_t i) {
if (t.LeftChld(i) >= l && t.RightChld(i) <= m)
return t.data_[i];
int inf = std::numeric_limits<int>::infinity() + 1;

Copy link
Copy Markdown

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 'int' can be declared 'const' [misc-const-correctness]

Suggested change
int inf = std::numeric_limits<int>::infinity() + 1;
int const inf = std::numeric_limits<int>::infinity() + 1;

Comment thread task_05/src/rmq.hpp
@@ -0,0 +1,3 @@
#include "/workspaces/algorithms_2nd/lib/src/tree.hpp"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: '/workspaces/algorithms_2nd/lib/src/tree.hpp' file not found [clang-diagnostic-error]

#include "/workspaces/algorithms_2nd/lib/src/tree.hpp"
         ^

Comment thread task_05/src/test.cpp
@@ -1,6 +1,14 @@

#include <gtest/gtest.h>

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: 'gtest/gtest.h' file not found [clang-diagnostic-error]

#include <gtest/gtest.h>
         ^

Comment thread task_06/src/lca.hpp
@@ -0,0 +1,3 @@
#include "/workspaces/algorithms_2nd/task_05/src/rmq.hpp"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: '/workspaces/algorithms_2nd/task_05/src/rmq.hpp' file not found [clang-diagnostic-error]

#include "/workspaces/algorithms_2nd/task_05/src/rmq.hpp" 
         ^

Comment thread task_06/src/test.cpp
@@ -1,6 +1,11 @@

#include <gtest/gtest.h>

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: 'gtest/gtest.h' file not found [clang-diagnostic-error]

#include <gtest/gtest.h>
         ^

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant