How to pass std::map as a default constructor parameter in c++ class function
问题 I have a problem when attempting to use std::map in clang-3.3 and clang-3.0 on Ubuntu 12.04: #include <iostream> #include <map> #include <string> class A { public: #if 0 //clang compiles ok typedef std::map<std::string,std::string> MapKeyValue_t; void PrintMap(const MapKeyValue_t &my_map = MapKeyValue_t()) #else // clang compiles fail void PrintMap(const std::map<std::string,std::string> &my_map = std::map<std::string,std::string>()) #endif { std::map<std::string,std::string>::const_iterator