C
Chad E. Dollins
Hello someone said that I should check this forum out for help to my c++
problems.
I will admit at this point I may have really ran myself into the ground
with this code that I am writing, but I'm hoping for a little help from
you guys.
I have a class that needs use of a bread-first search of a quareney tree.
In this class I have a nested class that should be the implementation of a
tree that contains two nested classes of its own. Those two classes are a
Position representation of cartestian coordinate with accessors and
modifiers and comparison methods. The other inner class is a treenode
class. This class holds several things, first of all a * to a vector of
TreeNode * that represent children nodes, A Position as its Payload, A *
to the parent TreeNode, and * pointer to a Maze object no mentioned above.
So, my problem is that as I iterate over my children vector I would like
to access the payload members accessors of the current treenode in the
vector. Except I get this instead:
error: request for member `payload' in `
*(&p1)->__gnu_cxx::__normal_iterator<_Iterator, _Container>:perator->
[with _Iterator = cs371p:rog::robowars4::Robot::Tree::TreeNode**,
_Container =
std::vector<cs371p:rog::robowars4::Robot::Tree::TreeNode*,
std::allocator<cs371p:rog::robowars4::Robot::Tree::TreeNode*> >]()',
which
is of non-class type `cs371p:rog::robowars4::Robot::Tree::TreeNode*'
The line of code looks like this:
vector< TreeNode *>::iterator p1;
for(p1 = children->begin();p1 != children->end();++p1)
This LINE RIGHT HERE->>>> p1->payload->getX();
Please, lemme know what you think any feed back is appreciated
--Chad
problems.
I will admit at this point I may have really ran myself into the ground
with this code that I am writing, but I'm hoping for a little help from
you guys.
I have a class that needs use of a bread-first search of a quareney tree.
In this class I have a nested class that should be the implementation of a
tree that contains two nested classes of its own. Those two classes are a
Position representation of cartestian coordinate with accessors and
modifiers and comparison methods. The other inner class is a treenode
class. This class holds several things, first of all a * to a vector of
TreeNode * that represent children nodes, A Position as its Payload, A *
to the parent TreeNode, and * pointer to a Maze object no mentioned above.
So, my problem is that as I iterate over my children vector I would like
to access the payload members accessors of the current treenode in the
vector. Except I get this instead:
error: request for member `payload' in `
*(&p1)->__gnu_cxx::__normal_iterator<_Iterator, _Container>:perator->
[with _Iterator = cs371p:rog::robowars4::Robot::Tree::TreeNode**,
_Container =
std::vector<cs371p:rog::robowars4::Robot::Tree::TreeNode*,
std::allocator<cs371p:rog::robowars4::Robot::Tree::TreeNode*> >]()',
which
is of non-class type `cs371p:rog::robowars4::Robot::Tree::TreeNode*'
The line of code looks like this:
vector< TreeNode *>::iterator p1;
for(p1 = children->begin();p1 != children->end();++p1)
This LINE RIGHT HERE->>>> p1->payload->getX();
Please, lemme know what you think any feed back is appreciated
--Chad