get ready to use Mempool with seen position

This commit is contained in:
Hieu Hoang 2015-12-30 16:16:36 +00:00
parent 2cdbad5f2d
commit 654f2616e6
2 changed files with 8 additions and 4 deletions

View File

@ -65,8 +65,8 @@ std::ostream& operator<<(std::ostream &out, const CubeEdge &obj)
bool
CubeEdge::SeenPosition(const size_t x, const size_t y, SeenPositions &seenPositions) const
{
std::pair<const CubeEdge*, int> val(this, (x<<16) + y);
boost::unordered_set< std::pair<const CubeEdge*, int> >::iterator iter = seenPositions.find(val);
SeenPositionItem val(this, (x<<16) + y);
boost::unordered_set<SeenPositionItem>::iterator iter = seenPositions.find(val);
return (iter != seenPositions.end());
}
@ -76,7 +76,7 @@ CubeEdge::SetSeenPosition(const size_t x, const size_t y, SeenPositions &seenPos
//UTIL_THROW_IF2(x >= (1<<17), "Error");
//UTIL_THROW_IF2(y >= (1<<17), "Error");
std::pair<const CubeEdge*, int> val(this, (x<<16) + y);
SeenPositionItem val(this, (x<<16) + y);
seenPositions.insert(val);
}

View File

@ -60,7 +60,11 @@ public:
typedef std::priority_queue<QueueItem*,
std::vector<QueueItem*>,
QueueItemOrderer> Queue;
typedef boost::unordered_set< std::pair<const CubeEdge*, int> > SeenPositions;
typedef std::pair<const CubeEdge*, int> SeenPositionItem;
typedef boost::unordered_set<SeenPositionItem,
boost::hash<SeenPositionItem>,
std::equal_to<SeenPositionItem> > SeenPositions;
const Hypotheses &hypos;
const InputPath &path;