-
Notifications
You must be signed in to change notification settings - Fork 3
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
Enhance Graph adders #236
Enhance Graph adders #236
Conversation
@@ -271,10 +277,16 @@ | |||
Func f = streetLength) const; | |||
}; | |||
|
|||
template <typename node_t, typename... TArgs> |
Check notice
Code scanning / Cppcheck (reported by Codacy)
MISRA 12.3 rule Note
@@ -271,10 +277,16 @@ | |||
Func f = streetLength) const; | |||
}; | |||
|
|||
template <typename node_t, typename... TArgs> | |||
requires(std::is_base_of_v<Node, node_t>, |
Check notice
Code scanning / Cppcheck (reported by Codacy)
MISRA 12.3 rule Note
@@ -271,10 +277,16 @@ | |||
Func f = streetLength) const; | |||
}; | |||
|
|||
template <typename node_t, typename... TArgs> | |||
requires(std::is_base_of_v<Node, node_t>, | |||
std::constructible_from<node_t, Id, TArgs...>) |
Check notice
Code scanning / Cppcheck (reported by Codacy)
MISRA 12.3 rule Note
std::constructible_from<node_t, Id, TArgs...>) | ||
node_t& Graph::addNode(Id id, TArgs&&... args) { | ||
addNode(std::make_unique<node_t>(id, std::forward<TArgs>(args)...)); | ||
return dynamic_cast<node_t&>(*m_nodes[id]); |
Check notice
Code scanning / Cppcheck (reported by Codacy)
MISRA 15.5 rule Note
@@ -283,6 +295,14 @@ | |||
addNodes(std::forward<Tn>(nodes)...); | |||
} | |||
|
|||
template <typename edge_t, typename... TArgs> |
Check notice
Code scanning / Cppcheck (reported by Codacy)
MISRA 12.3 rule Note
@@ -283,6 +295,14 @@ | |||
addNodes(std::forward<Tn>(nodes)...); | |||
} | |||
|
|||
template <typename edge_t, typename... TArgs> | |||
requires(std::is_base_of_v<Street, edge_t>, |
Check notice
Code scanning / Cppcheck (reported by Codacy)
MISRA 12.3 rule Note
@@ -283,6 +295,14 @@ | |||
addNodes(std::forward<Tn>(nodes)...); | |||
} | |||
|
|||
template <typename edge_t, typename... TArgs> | |||
requires(std::is_base_of_v<Street, edge_t>, | |||
std::constructible_from<edge_t, Id, TArgs...>) |
Check notice
Code scanning / Cppcheck (reported by Codacy)
MISRA 12.3 rule Note
std::constructible_from<edge_t, Id, TArgs...>) | ||
edge_t& Graph::addEdge(Id id, TArgs&&... args) { | ||
addStreet(std::make_unique<edge_t>(id, std::forward<TArgs>(args)...)); | ||
return dynamic_cast<edge_t&>(*m_streets[id]); |
Check notice
Code scanning / Cppcheck (reported by Codacy)
MISRA 15.5 rule Note
@@ -20,13 +20,12 @@ | |||
Bench b1(n_rep); | |||
|
|||
std::cout << "Benchmarking addNode\n"; | |||
Intersection n1(std::rand()); | |||
b1.benchmark([&g1](const Intersection& node) -> void { g1.addNode(node); }, n1); | |||
b1.benchmark([&g1]() -> void { g1.addNode<Intersection>(std::rand()); }); |
Check notice
Code scanning / Cppcheck (reported by Codacy)
Do not use the rand() function for generating pseudorandom numbers Note test
No description provided.