for (std::multimap <double, std::map<int,StopID>>::iterator p = m.begin(); p != m.end(); p ++ ){
In the above you are iterating over the multimap and p->second points at the whole inner map, not a single entry in it. You need to iterate over the map too to access all entries in that.
You can use range based for-loops and structured bindings to make life easier.
for(auto& [the_double, the_map] : m) {
for(auto& [the_int, the_type_a] : the_map) {
// do what you want with the TypeA reference "the_type_a"
}
}
Edit: If I understand comments correctly, the map always contains exactly one int, TypeA pair - and in that case, just replace the map with a std::pair<int, TypeA> and you can have one loop only:
#include <utility> // std::pair
int main() {
std::multimap <double, std::pair<int, TypeA>> m;
for(auto& [the_double, the_pair] : m) {
auto& [the_int, the_type_a] = the_pair;
// do what you want with the int and TypeA references
}
}