C++ 如何声明boost无序\u多重映射

C++ 如何声明boost无序\u多重映射,c++,boost,C++,Boost,我正在尝试使用boost无序_multimap类,但在声明它时遇到了问题。错误出现在代码后面 #include <iostream> #include <map> // header file needed for to use MAP STL #include <boost/unordered_map.hpp> using namespace std; int main(void) { map<int, map<int, map<in

我正在尝试使用boost无序_multimap类,但在声明它时遇到了问题。错误出现在代码后面

#include <iostream>
#include <map> // header file needed for to use MAP STL
#include <boost/unordered_map.hpp>

using namespace std;

int main(void)
{

map<int, map<int, map<int,int> > > _3dstl;

_3dstl[0][0][0] = 10;

cout<<_3d[0][0][0]<<endl;


typedef boost::unordered_multimap<int, typedef boost::unordered_multimap<int, int>> unordered_map;
unordered_map _2d;

    return 0;
}
更改此行:

typedef boost::unordered_multimap<int, typedef boost::unordered_multimap<int, int>> unordered_map;
typedef boost::无序多映射无序映射;
为此:

typedef boost::unordered_multimap<int, boost::unordered_multimap<int, int> > unordered_map;
typedef boost::无序多映射无序映射;
第二个typedef不是必需的,它是一个语法错误。同样在C++2003中,您必须注意模板声明中的
>



另外,请为typedef使用不同的名称,然后使用
unordered_-map
,因为如果使用
使用名称空间std,这将与
std::unordered_-map
冲突(这是一种不好的做法)。一个建议是
intmap2d
或其他什么。

鉴于OP的
使用名称空间std,这仍然是一个糟糕的命名约定。不要给结果中的家伙打电话
unordered\u map
,以免让你的同龄人将来头疼:-)
typedef boost::unordered_multimap<int, boost::unordered_multimap<int, int> > unordered_map;