How I can define a list of map::iterator and map of list::iterator
问题 I need a list of Map::iterator and map of List::iterator. How I can do this: typedef std::list<Map::iterator> List; typedef std::map<int, List::iterator> Map; Maybe I can use something like forward declaration for iterator? 回答1: Something like this should help you: #include <cassert> #include <iostream> #include <list> #include <map> #include <string> struct decl_t { typedef std::map<std::string, decl_t> map_t; typedef std::list<std::pair<int, typename map_t::iterator>> list_t; list_t: