I’m trying to use the boost unordered_multimap class and I’m having trouble declaring it. The error follows the code.
#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;
}
This is the error:
||In function 'int main()':|
|17|error: template argument 2 is invalid|
|17|error: template argument 5 is invalid|
|17|warning: 'typedef' was ignored in this declaration|
|18|error: 'unordered_map' was not declared in this scope|
|18|error: expected ';' before 'location3d'|
||=== Build finished: 4 errors, 1 warnings ===|
Change this line:
To this:
The second typedef is not necessary and a syntax error. Also in C++2003 you have to watch out for
>>in template declarations.Also, please use a different name then
unordered_mapfor the typedef, since this will collide withstd::unordered_mapif you useusing namespace std;(which is IMO a bad practice). A suggestion would beintmap2dor something.