I am trying to print out a chess board on the console. The data structure i am using is a set of pairs. I am having trouble accessing the pair's elements. I do realize a map is probably better in this case but i am using somebody else's code so I don't want to mess with it. Thanks in advance!
error i am getting says: error: 'struct std::_Rb_tree_const_iterator<const char*>' has no member named 'second'
Here is my code:
set< const pair<char, pair<int, int> >* > chosen;
for (int row=0; row<8; row++){
for (int col=0; col<8; col++) {
for (typename set<const A*>::iterator it = chosen.begin();
it != chosen.end(); it++) {
if (*it->first=='B'
&& *it.second.first==row
&& *it.second.second==col) {cout<<"B ";}
else if (*it.first=='K'
&& *it.second.first==row
&& *it.second.second==col) {cout<<"B ";}
else {
cout <<"_ ";
}
}
cout <<"\n";
}
}