C++ typedef 映射错误
C++ typedef map error
在 visual studio 2013 终极版中:
一)
using namespace std;
typedef map<string, double> my_set;
=> error: map is not a template
b)
typedef std::map<string, double> my_set;
=> error: qualified name is not allowed
a 或 b 在文件 foo.h 中,两个版本均无效。我究竟做错了什么?
(是的,花了一些时间谷歌搜索 => 没有结果,c++ 是一种奇怪的语言)
您是否包含 <map>
和 <string>
?
#include <map>
#include <string>
typedef std::map<std::string, double> my_set;
在 visual studio 2013 终极版中:
一)
using namespace std;
typedef map<string, double> my_set;
=> error: map is not a template
b)
typedef std::map<string, double> my_set;
=> error: qualified name is not allowed
a 或 b 在文件 foo.h 中,两个版本均无效。我究竟做错了什么? (是的,花了一些时间谷歌搜索 => 没有结果,c++ 是一种奇怪的语言)
您是否包含 <map>
和 <string>
?
#include <map>
#include <string>
typedef std::map<std::string, double> my_set;