Q:

read set from map in c++

It's very silly question but somehow I am not able to solve.
I have map who key is string and value is set and I want to iterate through value and print it for example
std::map<std::string, std::set<std::string>> test_map_set

for (auto it_map = test_map_set["test"].begin(); it_mpa != test_map_set["test"].begin(); it_map ++ )
{
  auto it = it_map->second;  ===> Here I am getting error that it has no member second
  then iterate through set 
}

My question is how to iterate through set ?

A:

Indeed std::string has no member second.
Since you have c++11, you can make life a lot easier:
std::map<std::string, std::set<std::string>> test_map_set

for (std::string& set_element : test_map_set["test"])
{
}

For deleting:
auto& test = test_map_set["test"];
for (auto it = test.begin(); it!= test.end();)
{
    if (it->length()==5)
        it = test.erase(it);
    else
        ++it;
}

This would delete all strings of 5 characters

