Remove "using namespace" from headers and make single param constructors explicit

This commit is contained in:
stefiosif
2022-12-03 15:43:00 +02:00
parent d7e87e0956
commit 7c78bbd7ca
9 changed files with 13 additions and 30 deletions

View File

@@ -15,7 +15,7 @@ template<typename T> std::ostream& operator<<(std::ostream& os, Graph<T>& G);
template<typename T>
class Graph {
public:
~Graph();
virtual ~Graph() = default;
// Return true if there is a path from u to v
virtual bool contains(const T& u, const T& v) =0;
@@ -41,11 +41,6 @@ public:
friend std::ostream& operator<<<>(std::ostream& os, Graph<T>& G);
};
template<typename T>
Graph<T>::~Graph() {
adjList.clear();
}
template<typename T>
auto Graph<T>::vertices() {
return std::views::keys(adjList);
@@ -62,7 +57,7 @@ std::uint16_t Graph<T>::E() {
for (const auto& u : vertices()) {
edges += static_cast<std::uint16_t>(adjList[u].size());
}
return static_cast<std::uint16_t>(edges);
return edges;
}
template<typename T>