Error when accessing members of a Node* inside of a queue

ساخت وبلاگ

Vote count: -1

I'm implementing an algorithm that involves a variation of BFS using Visual C++. The queue contains objects of type Node* which I am trying to access the members (left and right subtrees) of. For some reason, simply running the following code retus an error:

queue<Node*> aQueue;
aQueue.push(root);
cout << aQueue.front->left;// Error: left of '->data' must point tclass/struct/union/generic type 

If I'm trying to implement BFS with a queue in C++ and I need to access the members of the Node pointer at the front of the queue, what is the proper way to do it?

asked 2 mins ago

- - , .
.

back soft...
ما را در سایت back soft دنبال می کنید

برچسب : نویسنده : استخدام کار backsoft بازدید : 258 تاريخ : دوشنبه 21 تير 1395 ساعت: 5:39