Skip to content

tasks 01-06 - #18

Open
VasechkinND wants to merge 1 commit into
DafeMipt213:mainfrom
VasechkinND:main
Open

tasks 01-06#18
VasechkinND wants to merge 1 commit into
DafeMipt213:mainfrom
VasechkinND:main

Conversation

@VasechkinND

Copy link
Copy Markdown

No description provided.

@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

There were too many comments to post at once. Showing the first 25 out of 55. Check the log or trigger a new build to see more.

Comment thread task_02/src/main.cpp
};

Graph::Graph(int vertices) {
V = vertices;

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: 'V' should be initialized in a member initializer of the constructor [cppcoreguidelines-prefer-member-initializer]

task_02/src/main.cpp:18:

- Graph::Graph(int vertices) {
-     V = vertices;
+ Graph::Graph(int vertices) : V(vertices) {
+     

Comment thread task_02/src/main.cpp

Graph::Graph(int vertices) {
V = vertices;
adj = new std::list<int>[V];

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: 'adj' should be initialized in a member initializer of the constructor [cppcoreguidelines-prefer-member-initializer]

task_02/src/main.cpp:18:

- Graph::Graph(int vertices) {
+ Graph::Graph(int vertices), adj(new std::list<int>[V]) {
Suggested change
adj = new std::list<int>[V];

Comment thread task_02/src/main.cpp
visited[u] = true;
disc[u] = low[u] = ++time;

for (int v : adj[u]) {

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

Suggested change
for (int v : adj[u]) {
for (int const v : adj[u]) {

Comment thread task_02/src/main.cpp
visited[u] = true;
disc[u] = low[u] = ++time;

for (int v : adj[u]) {

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

Suggested change
for (int v : adj[u]) {
for (int const v : adj[u]) {

Comment thread task_03/src/main.cpp
std::vector<std::pair<int, int>> *edges;

Graph(int vertices) {
numVertices = vertices;

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: 'numVertices' should be initialized in a member initializer of the constructor [cppcoreguidelines-prefer-member-initializer]

task_03/src/main.cpp:13:

-     Graph(int vertices) {
-         numVertices = vertices;
+     Graph(int vertices) : numVertices(vertices) {
+         

Comment thread task_04/src/main.cpp
void relax(int start, int current, std::vector<std::vector<int>>& distances, std::priority_queue<std::pair<int, int>, std::vector<std::pair<int, int>>, std::greater<std::pair<int, int>>>& q) {
for (const auto& edge : adjacencyList[current]) {
int next = edge.first;
int weight = edge.second;

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

Suggested change
int weight = edge.second;
int const weight = edge.second;

Comment thread task_04/src/main.cpp
q.emplace(0, start);

while (!q.empty()) {
int current = q.top().second;

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

Suggested change
int current = q.top().second;
int const current = q.top().second;

Comment thread task_04/src/main.cpp
};

int main() {
int vertices = 5;

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

Suggested change
int vertices = 5;
int const vertices = 5;

Comment thread task_05/src/main.cpp
};

SegmentTree::SegmentTree(const vector<int>& array) {
arr = array;

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: 'arr' should be initialized in a member initializer of the constructor [cppcoreguidelines-prefer-member-initializer]

task_05/src/main.cpp:20:

- SegmentTree::SegmentTree(const vector<int>& array) {
-     arr = array;
+ SegmentTree::SegmentTree(const vector<int>& array) : arr(array) {
+     

Comment thread task_05/src/main.cpp
SegmentTree::SegmentTree(const vector<int>& array) {
arr = array;
tree.resize(4 * arr.size());
build(1, 0, arr.size() - 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: narrowing conversion from 'size_type' (aka 'unsigned long') to signed type 'int' is implementation-defined [cppcoreguidelines-narrowing-conversions]

    build(1, 0, arr.size() - 1);
                ^

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