所以基本上我有一個點結構隊列存儲結構對象
typedef struct point {
unsigned int x;
unsigned int y;
} Point;
現在我想打一個隊列用於存儲點。
queue<Point> *pointsQueue = new queue<Point>; // shouldn't be changed
但是現在,當我試圖將一個點推到隊列中,出現以下錯誤
error:request for member 'push' in 'pointQueue', which is of non-class type 'std::queue<Point>*'
基本上正在創建一個點P
Point p;
p.x = 3;
p.y = 4;
然後我推入排隊
pointQueue.push(p);
我有作爲一個包含文件:
#include <queue>
有可能會或可能不會是堆分配的理由。我們真的不知道沒有代碼。但是這兩種情況中的一種將會覆蓋它! –
一個新的錯誤出現了:從轉換「的std ::隊列 *」非標量型「的std ::隊列」要求 –
thirdage
@thirdage你試圖用一個指針作爲對象的其他地方。 – juanchopanza