add some assertions
This commit is contained in:
parent
a1862661e8
commit
05ab338cf2
2 changed files with 6 additions and 0 deletions
|
@ -23,6 +23,8 @@
|
||||||
*/
|
*/
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
|
|
||||||
|
#include <cassert>
|
||||||
|
|
||||||
// Anonymous name spaces may be used to show the reader
|
// Anonymous name spaces may be used to show the reader
|
||||||
// that a function will only be used in the current file.
|
// that a function will only be used in the current file.
|
||||||
namespace
|
namespace
|
||||||
|
|
|
@ -40,6 +40,7 @@
|
||||||
*/
|
*/
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
#include <cassert>
|
||||||
/**
|
/**
|
||||||
* Namespaces can be used in order to make sure different modules,
|
* Namespaces can be used in order to make sure different modules,
|
||||||
* possibly implemented by different people don't have classes/functions/...
|
* possibly implemented by different people don't have classes/functions/...
|
||||||
|
@ -238,18 +239,21 @@ Node & Graph::node(NodeId const id)
|
||||||
inline
|
inline
|
||||||
NodeId Graph::matched_neighbor(NodeId const id) const
|
NodeId Graph::matched_neighbor(NodeId const id) const
|
||||||
{
|
{
|
||||||
|
assert(id <= num_nodes());
|
||||||
return _nodes[id].matched_neighbor;
|
return _nodes[id].matched_neighbor;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline
|
inline
|
||||||
NodeId Graph::ear_or_root_neighbor(const ED::NodeId id) const
|
NodeId Graph::ear_or_root_neighbor(const ED::NodeId id) const
|
||||||
{
|
{
|
||||||
|
assert(id <= num_nodes());
|
||||||
return _nodes[id].ear_or_root_neighbor;
|
return _nodes[id].ear_or_root_neighbor;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline
|
inline
|
||||||
NodeId Graph::root_of_ear_component(const ED::NodeId id) const
|
NodeId Graph::root_of_ear_component(const ED::NodeId id) const
|
||||||
{
|
{
|
||||||
|
assert(id <= num_nodes());
|
||||||
return _nodes[id].root_of_ear_component;
|
return _nodes[id].root_of_ear_component;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue