list<string>& whichList = theLists[ myhash( x, theLists.size( ) ) ];
I was wondering how to access a certain position say “i” and see if it was empty at that position.
I was doing it like this:
if(whichList[i] == 0)
but it does not seem to be working.
I realize this is wrong. Any suggestions?
The standard way to find the first list element whose value is the empty string is to use
std::find:Its position can be computed (expensively) as
std::distance(whichList.begin(), it), but it is unlikely that you will need the actual numerical index, assuming that you have made a concious decision thatstd::listwas the correct container type for your application.