Hi,
I am trying to see to which key the iterator is pointing in a map. is there a way to do so.
Also, would it be the fastest way to store unique keys in a map.
mapType::iterator it = cube.begin();
mapType::iterator its = it;
std::advance(its,1);
for(; it!= cube.end(); ++it)
{
cout << "Inside it = " << (it) - cube.begin() << endl;
cout << "Inside its = " << (its) - cube.begin() << endl;
for(; its!= cube.end(); ++its)
{
cout << "its = " << (its) - cube.begin() << endl;
vector<int>::const_iterator it1;
vector<int>::const_iterator it3;
for( it1 = it->first.begin(), it3 = its->first.begin(); it1!= it->first.end(), it3!= its->first.end(); ++it1,++it3)
{
//cout << *it1 << " " << *it3 << " ";
if((*it1 == 0 && *it3 == 1) || (*it1 == 1 && *it3 == 0))
break;
else if(*it1 == *it3)
tempo.push_back(*it1);
else if((*it1 == 0 && *it3 == 2) || (*it1 == 2 && *it3 == 0))
tempo.push_back(0);
else
tempo.push_back(1);
}
if(cube.count(tempo) <= 0)
cube[tempo].push_back(10);
cout << endl;
}
}
The code marked in green does not work.