Because the compiler doesn't yet know the type of std::map<S, table<T>*>, it can't yet know that std::map<S, table<T>*>::iterator is a type (it could be a member). You need to tell it that it will be a type: