Hi Daved,
Thanks for taking the time to look over my code. I previously tried most of the things you posted, but I couldn't get any of them to work. Here are the errors:
mapfill->first: The Lit object (key)
Code:
map<Lit, vector<Index> >::const_iterator mapfill;
for(mapfill = M.begin(); mapfill != M.end(); mapfill++)
{
mapfill->first.display(); //ERROR
}
error C2662: 'display' : cannot convert 'this' pointer from 'const class Lit' to 'class Lit &' Conversion loses qualifiers
mapfill->second: The vector<Index> (value)
Code:
map<Lit, vector<Index> >::const_iterator mapfill;
for(mapfill = M.begin(); mapfill != M.end(); mapfill++)
{
(mapfill->second)[0].show(); //ERROR
}
error C2662: 'show' : cannot convert 'this' pointer from 'const class Index' to 'class Index &'
Conversion loses qualifiers
I did get this one to work:
M[v][1].show();
If you are using iterators, then you don't need the operator[]:
Yes. I realized when I was testing my code that using an iterator obviated the need to do a key look up: I could just use iterator->second[x]. But, I wanted to test the key look up process anyway, so I tried using the iterator to get the Lit object key, but I couldn't get it to work. The syntax M[*mapfill][0].show()....hmmm, just had an idea. Yep, this works:
M[mapfill->first][0].show();
I forgot mapfill points to a pair type.