, .
set<Cell*> cellSet;
Cell* cell = new Cell();
if (cellSet.find(cell) != cellSet.end())
{
}
, Cell, Cell ( , ). ++ , , .
To actually compare objects, you need to use find_if () and pass the predicate (functor).
struct PointerCellTest
{
Cell& m_lhs;
PointerCellTest(Cell* lhs): m_lhs(lhs) {}
bool operator()(Cell* rhs)
{
return lhs.<PLOP> == rhs.<PLOP>
}
};
if(find_if(cellSet.begin(),cellSet.end(),PointerCellTest(cell)) != cellSet.end())
{
}
source
share