Access a vector inside of a map that is inside another map
I have a map called nfa (see below)
map<string, NFANode*> nfa;
nfa is filled with NFANode objects. (see below)
class NFANode {
public:
string label;
map<string,vector<NFANode*> >tr;
bool accepting;
bool starting;
NFANode(string s, bool a, bool x){
accepting = a;
label = s;
starting = x;
}
};
Inside each object there is another map call tr and inside of tr there is
a vector with information. I am trying to access the vector to print out
each element of the vector and cannot figure out how. I have been trying
to use an iterator with no luck.
map<string, NFANode*>::iterator nfaIt;
for (nfaIt = nfa.begin(); nfaIt != nfa.end(); ++nfaIt){
cout << "content of tr are: " << nfaIt->second->tr->second << endl;
}
Any help would be greatly appreciated.
No comments:
Post a Comment