У меня есть класс со структурой в нем и список с этими структурами.
Но когда я перебираю этот список, я не могу получить свойства из своей структуры.
ошибка: запрос члена 'x_' в 'it.std::_List_const_iterator<_Tp>::operator* с _Tp = AStarPlanner::Cell*', который имеет неклассовый тип 'AStarPlanner::Cell* const '
Заголовочный файл:
class AStarPlanner {
public:
AStarPlanner(int width, int height, const costmap_2d::Costmap2D* costmap);
virtual ~AStarPlanner();
protected:
struct Cell {
int x_;
int y_;
int f_; // f = g + h
int g_; // g = cost so far
int h_; // h = predicted extra cost
//CellInfo* visited_from_; // pointer to cell from which this cell is visited
Cell(int x, int y, int g, int h) : x_(x), y_(y), g_(g), h_(h) {
f_ = g_ + h_;
}
};
bool cellInList(const Cell* cell, const std::list<Cell*> liste);
};
файл cpp:
bool AStarPlanner::cellInList(const Cell* cell, const list<Cell*> liste)
{
list<Cell*>::const_iterator it;
for (it = liste.begin(); it != liste.end(); it++)
{
if ( it->x_ == cell->x_ && it->y_ == cell->y_)
return true;
}
return false;
}