Skip to content
Snippets Groups Projects
Commit 27f76d69 authored by Joseph Mirabel's avatar Joseph Mirabel Committed by Joseph Mirabel
Browse files

Fix loop of shared ptr of SymbolicComponent

parent f7933b44
No related branches found
No related tags found
No related merge requests found
...@@ -34,7 +34,7 @@ namespace hpp { ...@@ -34,7 +34,7 @@ namespace hpp {
class HPP_MANIPULATION_DLLAPI SymbolicComponent class HPP_MANIPULATION_DLLAPI SymbolicComponent
{ {
public: public:
typedef std::set<SymbolicComponentPtr_t> SymbolicComponents_t; typedef std::set<SymbolicComponent*> SymbolicComponents_t;
/// return a shared pointer to new instance /// return a shared pointer to new instance
static SymbolicComponentPtr_t create (const RoadmapPtr_t& roadmap); static SymbolicComponentPtr_t create (const RoadmapPtr_t& roadmap);
......
...@@ -52,18 +52,18 @@ namespace hpp { ...@@ -52,18 +52,18 @@ namespace hpp {
{ {
if (otherCC->state_ != state_) return false; if (otherCC->state_ != state_) return false;
SymbolicComponents_t::const_iterator it = std::find SymbolicComponents_t::const_iterator it = std::find
(to_.begin(), to_.end(), otherCC); (to_.begin(), to_.end(), otherCC.get());
if (it == to_.end()) return false; if (it == to_.end()) return false;
it = std::find it = std::find
(from_.begin(), from_.end(), otherCC); (from_.begin(), from_.end(), otherCC.get());
if (it == from_.end()) return false; if (it == from_.end()) return false;
return true; return true;
} }
void SymbolicComponent::canReach (const SymbolicComponentPtr_t& otherCC) void SymbolicComponent::canReach (const SymbolicComponentPtr_t& otherCC)
{ {
to_.insert(otherCC); to_.insert(otherCC.get());
otherCC->from_.insert(weak_.lock()); otherCC->from_.insert(this);
} }
void SymbolicComponent::merge (SymbolicComponentPtr_t other) void SymbolicComponent::merge (SymbolicComponentPtr_t other)
...@@ -79,11 +79,11 @@ namespace hpp { ...@@ -79,11 +79,11 @@ namespace hpp {
// Add other's nodes to this list. // Add other's nodes to this list.
nodes_.insert (nodes_.end (), other->nodes_.begin(), other->nodes_.end()); nodes_.insert (nodes_.end (), other->nodes_.begin(), other->nodes_.end());
from_.erase (other); from_.erase (other.get());
other->from_.erase (weak_.lock()); other->from_.erase (this);
from_.insert (other->from_.begin(), other->from_.end()); from_.insert (other->from_.begin(), other->from_.end());
to_.erase (other); to_.erase (other.get());
other->to_.erase (weak_.lock()); other->to_.erase (this);
to_.insert (other->to_.begin(), other->to_.end()); to_.insert (other->to_.begin(), other->to_.end());
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment