How to create a multi-dimensional map

1
2
3
4
5
6
7
8
9
10
typedef map<????> t_map;

t_map mymap;
int main()
{

    mymap[3][4] = 4; //???
    return 0;
}


I want to create a map that I can use like a multidimensional arrays, but I don't know how to do that. Can anybody help me, please?

Last edited on
Just wondering what your concept of a map is?

Not sure whether you have read these or not.

http://www.cplusplus.com/reference/map/map/
http://www.cplusplus.com/reference/map/multimap/
http://www.cplusplus.com/reference/unordered_map/
> I want to create a map that I can use like a multidimensional arrays

You mean a map, where the mapped type is a map?

1
2
3
4
5
6
7
8
9
#include <map>
#include <string>

int main()
{
    std::map< std::string, std::map< int, double > > my_map ;

    my_map[ "hello" ][ 23 ] = 8.9 ;
}
Thank you!
Topic archived. No new replies allowed.