Skip to content

Homework #6

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

LightAboveFighter
Copy link
Contributor

No description provided.

Copy link

@github-actions github-actions bot left a 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

@@ -0,0 +1,126 @@
#ifndef __GRAPH_H__
#define __GRAPH_H__

Choose a reason for hiding this comment

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

warning: declaration uses identifier 'GRAPH_H', which is a reserved identifier [bugprone-reserved-identifier]

Suggested change
#define __GRAPH_H__
#define GRAPH_H_


template<typename T, typename NameType>
class Graph {
static_assert(std::is_arithmetic<T>::value, "Graph: paths' lenghts must be arithmetic!");

Choose a reason for hiding this comment

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

warning: no header providing "std::is_arithmetic" is directly included [misc-include-cleaner]

lib/src/graph.cpp:3:

- #include <unordered_map>
+ #include <type_traits>
+ #include <unordered_map>

public:
node(NameType name) : name{name}, paths{} {}
NameType name{NameType()};
std::unordered_map<node*, T> paths;

Choose a reason for hiding this comment

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

warning: use default member initializer for 'paths' [cppcoreguidelines-use-default-member-init]

lib/src/graph.cpp:14:

-         node(NameType name) : name{name}, paths{} {}
+         node(NameType name) : name{name}, {}
Suggested change
std::unordered_map<node*, T> paths;
std::unordered_map<node*, T> paths{};


public:

Graph(std::initializer_list<std::pair<NameType, NameType>> links, T base_lenght = 1) {

Choose a reason for hiding this comment

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

warning: no header providing "std::pair" is directly included [misc-include-cleaner]

lib/src/graph.cpp:4:

- #include <vector>
+ #include <utility>
+ #include <vector>

@@ -0,0 +1 @@
#include <stack>

Choose a reason for hiding this comment

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

warning: included header stack is not used directly [misc-include-cleaner]

Suggested change
#include <stack>
>

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