move implementation into cpp file

This commit is contained in:
Robert Haschke 2018-04-27 11:05:42 +02:00 committed by Robert Haschke
parent bbb64f2f8c
commit 67b6dcb49b
2 changed files with 18 additions and 14 deletions

View File

@ -93,20 +93,7 @@ public:
return Priority(this->depth() + other.depth(),
this->cost() + other.cost());
}
inline bool operator<(const Priority& other) const {
/* infinite cost should always be last */
if (std::isinf(this->cost()) && std::isinf(other.cost()))
return this->depth() > other.depth();
else if (std::isinf(this->cost()))
return false;
else if (std::isinf(other.cost()))
return true;
if (this->depth() == other.depth())
return this->cost() < other.cost();
else
return this->depth() > other.depth();
}
bool operator<(const Priority& other) const;
};
typedef std::deque<SolutionBase*> Solutions;

View File

@ -55,6 +55,23 @@ InterfaceState::InterfaceState(const InterfaceState &other)
{
}
bool InterfaceState::Priority::operator<(const InterfaceState::Priority& other) const {
// infinite costs go always last
if (std::isinf(this->cost()) && std::isinf(other.cost()))
return this->depth() > other.depth();
else if (std::isinf(this->cost()))
return false;
else if (std::isinf(other.cost()))
return true;
if (this->depth() == other.depth())
return this->cost() < other.cost();
else
return this->depth() > other.depth();
}
Interface::Interface(const Interface::NotifyFunction &notify)
: notify_(notify)
{}