-
Notifications
You must be signed in to change notification settings - Fork 22
Alien dictionary (additional task) #21
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?
Alien dictionary (additional task) #21
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
|
||
// Helper function to capture the output of FindAlphabeticOrder | ||
std::string CaptureOutput(const std::vector<std::string>& dictionary) { | ||
std::ostringstream output; |
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 'output' of type 'std::ostringstream' (aka 'basic_ostringstream') can be declared 'const' [misc-const-correctness]
std::ostringstream output; | |
std::ostringstream const output; |
|
||
#include <stack> | ||
|
||
#include "graph.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: 'graph.hpp' file not found [clang-diagnostic-error]
#include "graph.hpp"
^
for (const auto &neighbor : vertex->adjacent) { | ||
std::cout << neighbor->data << " "; | ||
} | ||
std::cout << std::endl; |
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: do not use 'std::endl' with streams; use '\n' instead [performance-avoid-endl]
std::cout << std::endl; | |
std::cout << '\n'; |
lib/src/graph.hpp
Outdated
} | ||
|
||
protected: | ||
std::vector<std::shared_ptr<Vertex<T>>> vertices_; |
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: member variable 'vertices_' has protected visibility [cppcoreguidelines-non-private-member-variables-in-classes]
std::vector<std::shared_ptr<Vertex<T>>> vertices_;
^
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
|
||
// Helper function to capture the output of FindAlphabeticOrder | ||
std::string CaptureOutput(const std::vector<std::string>& dictionary) { | ||
std::ostringstream output; |
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 'output' of type 'std::ostringstream' (aka 'basic_ostringstream') can be declared 'const' [misc-const-correctness]
std::ostringstream output; | |
std::ostringstream const output; |
for (const auto &neighbor : vertex->adjacent) { | ||
std::cout << neighbor->data << " "; | ||
} | ||
std::cout << std::endl; |
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: do not use 'std::endl' with streams; use '\n' instead [performance-avoid-endl]
std::cout << std::endl; | |
std::cout << '\n'; |
lib/src/graph.hpp
Outdated
} | ||
|
||
protected: | ||
std::vector<std::shared_ptr<Vertex<T>>> vertices_; |
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: member variable 'vertices_' has protected visibility [cppcoreguidelines-non-private-member-variables-in-classes]
std::vector<std::shared_ptr<Vertex<T>>> vertices_;
^
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 23. Check the log or trigger a new build to see more.
|
||
// Helper function to capture the output of FindAlphabeticOrder | ||
std::string CaptureOutput(const std::vector<std::string>& dictionary) { | ||
std::ostringstream output; |
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 'output' of type 'std::ostringstream' (aka 'basic_ostringstream') can be declared 'const' [misc-const-correctness]
std::ostringstream output; | |
std::ostringstream const output; |
}; | ||
|
||
template<typename T, typename VT> | ||
concept IsVertex = std::derived_from<T, Vertex<VT>>; |
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: 'T' does not refer to a value [clang-diagnostic-error]
concept IsVertex = std::derived_from<T, Vertex<VT>>;
^
Additional context
lib/src/graph.hpp:19: declared here
template<typename T, typename VT>
^
}; | ||
|
||
template<typename T, typename VT> | ||
concept IsVertex = std::derived_from<T, Vertex<VT>>; |
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: a template declaration can only declare a single entity [clang-diagnostic-error]
concept IsVertex = std::derived_from<T, Vertex<VT>>;
^
}; | ||
|
||
template<typename T, typename VT> | ||
concept IsVertex = std::derived_from<T, Vertex<VT>>; |
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: no member named 'derived_from' in namespace 'std' [clang-diagnostic-error]
concept IsVertex = std::derived_from<T, Vertex<VT>>;
^
}; | ||
|
||
template<typename T, typename VT> | ||
concept IsVertex = std::derived_from<T, Vertex<VT>>; |
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: unknown type name 'concept' [clang-diagnostic-error]
concept IsVertex = std::derived_from<T, Vertex<VT>>;
^
* Add a new vertex to the graph | ||
* @param data | ||
*/ | ||
virtual void AddVertex(const T &data) { |
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: unknown type name 'T' [clang-diagnostic-error]
virtual void AddVertex(const T &data) {
^
vertices_.push_back(std::make_shared<VertexType>(data)); | ||
}; | ||
|
||
std::shared_ptr<VertexType> operator[](size_t index) { |
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 'VertexType' [clang-diagnostic-error]
std::shared_ptr<VertexType> operator[](size_t index) {
^
return vertices_[index]; | ||
} | ||
|
||
const std::shared_ptr<VertexType> operator[](size_t index) const { |
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 'VertexType' [clang-diagnostic-error]
const std::shared_ptr<VertexType> operator[](size_t index) const {
^
* @param vertex | ||
* @return size_t | ||
*/ | ||
size_t Find(const T &vertex) const { |
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: unknown type name 'T' [clang-diagnostic-error]
size_t Find(const T &vertex) const {
^
* Remove a vertex from the graph | ||
* @param vertex | ||
*/ | ||
virtual void RemoveVertex(std::shared_ptr<VertexType> vertex) { |
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 'VertexType' [clang-diagnostic-error]
virtual void RemoveVertex(std::shared_ptr<VertexType> vertex) {
^
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
|
||
// Helper function to capture the output of FindAlphabeticOrder | ||
std::string CaptureOutput(const std::vector<std::string>& dictionary) { | ||
std::ostringstream output; |
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 'output' of type 'std::ostringstream' (aka 'basic_ostringstream') can be declared 'const' [misc-const-correctness]
std::ostringstream output; | |
std::ostringstream const output; |
}; | ||
|
||
template <typename T, typename VT> | ||
concept IsVertex = std::derived_from<T, Vertex<VT>>; |
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: 'T' does not refer to a value [clang-diagnostic-error]
concept IsVertex = std::derived_from<T, Vertex<VT>>;
^
Additional context
lib/src/graph.hpp:19: declared here
template <typename T, typename VT>
^
/// @tparam VertexType | ||
/// @tparam T | ||
template <typename VertexType, typename T> | ||
requires IsVertex<VertexType, T> |
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: expected ';' at end of declaration [clang-diagnostic-error]
requires IsVertex<VertexType, T> | |
requires IsVertex<VertexType, T>; |
/// @tparam VertexType | ||
/// @tparam T | ||
template <typename VertexType, typename T> | ||
requires IsVertex<VertexType, T> |
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: unknown type name 'requires' [clang-diagnostic-error]
requires IsVertex<VertexType, T>
^
/// @tparam VertexType | ||
/// @tparam T | ||
template <typename VertexType, typename T> | ||
requires IsVertex<VertexType, T> |
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 template partial specialization does not specialize any template argument; to define the primary template, remove the template argument list [clang-diagnostic-error]
requires IsVertex<VertexType, T> | |
requires IsVertex |
* @param target | ||
*/ | ||
virtual void RemoveDirEdge(std::shared_ptr<VertexType> source, | ||
std::shared_ptr<VertexType> target) { |
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 'VertexType' [clang-diagnostic-error]
std::shared_ptr<VertexType> target) {
^
* @param vertex_1 | ||
* @param vertex_2 | ||
*/ | ||
virtual void AddEdge(std::shared_ptr<VertexType> vertex_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: use of undeclared identifier 'VertexType' [clang-diagnostic-error]
virtual void AddEdge(std::shared_ptr<VertexType> vertex_1,
^
* @param vertex_2 | ||
*/ | ||
virtual void AddEdge(std::shared_ptr<VertexType> vertex_1, | ||
std::shared_ptr<VertexType> vertex_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: use of undeclared identifier 'VertexType' [clang-diagnostic-error]
std::shared_ptr<VertexType> vertex_2) {
^
* @param vertex_1 | ||
* @param vertex_2 | ||
*/ | ||
virtual void RemoveEdge(std::shared_ptr<VertexType> vertex_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: use of undeclared identifier 'VertexType' [clang-diagnostic-error]
virtual void RemoveEdge(std::shared_ptr<VertexType> vertex_1,
^
} | ||
|
||
protected: | ||
std::vector<std::shared_ptr<VertexType>> vertices_; |
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: member variable 'vertices_' has protected visibility [cppcoreguidelines-non-private-member-variables-in-classes]
std::vector<std::shared_ptr<VertexType>> vertices_;
^
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
|
||
// Helper function to capture the output of FindAlphabeticOrder | ||
std::string CaptureOutput(const std::vector<std::string>& dictionary) { | ||
std::ostringstream output; |
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 'output' of type 'std::ostringstream' (aka 'basic_ostringstream') can be declared 'const' [misc-const-correctness]
std::ostringstream output; | |
std::ostringstream const output; |
/// @tparam T | ||
template <typename VertexType, typename T> | ||
requires IsVertex<VertexType, T> | ||
class Graph { |
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: constructor does not initialize these fields: vertices_ [cppcoreguidelines-pro-type-member-init]
lib/src/graph.hpp:209:
- std::vector<std::shared_ptr<VertexType>> vertices_;
+ std::vector<std::shared_ptr<VertexType>> vertices_{};
/// @tparam T | ||
template <typename VertexType, typename T> | ||
requires IsVertex<VertexType, T> | ||
class Graph { |
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: destructor of 'Graph' is public and non-virtual [cppcoreguidelines-virtual-class-destructor]
class Graph {
^
Additional context
lib/src/graph.hpp:27: make it public and virtual
class Graph {
^
} | ||
|
||
protected: | ||
std::vector<std::shared_ptr<VertexType>> vertices_; |
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: member variable 'vertices_' has protected visibility [cppcoreguidelines-non-private-member-variables-in-classes]
std::vector<std::shared_ptr<VertexType>> vertices_;
^
No description provided.