0
我正在使用unordered_map,我無法將指針向量聲明爲值。我有以下聲明:不能在boost/unordered_map中使用矢量
//file test.h
#include <boost/unordered_map.hpp>
#include <boost/foreach.hpp>
struct Record
{
char **data;
};
typedef boost::unordered_map<std::string, std::vector<Record*> > MAP;
typedef std::pair<std::string,std::vector<Record*> > PAIR;
我已經包含在TEST.CPP這個頭文件,當我編譯使用G ++,我得到以下錯誤:
/usr/include/boost/detail/container_fwd.hpp:80: error: provided for ‘template<class T, class Allocator> struct std::vector’
test.h:10: error: template argument 2 is invalid
test.h:10: error: template argument 5 is invalid
test.h:10: error: invalid type in declaration before ‘;’ token
任何想法,這個錯誤是什麼手段?
是否有可能MAP是在代碼的某個地方定義的宏? – Loghorn
哪一行導致問題? –
請發佈一個自包含的測試用例。用你當前的代碼,可以說你缺少至少兩個重要的頭文件。 – juanchopanza