The simple way to access each pair on each list is
for (const auto& list : hashTable)
{
for (const auto& pair : list)
{
...
}
}
but the insert
function in the code above worries me. If you are iterating over the vectors/lists while you are simultaneously modifying them, that changes things.
CLICK HERE to find out more related problems solutions.