Array of maps

Is it possible to make an array of maps?? How can I do that?

I want to have a class having a array of maps
1
2
3
4
5
6
7
8
9
10
11
class X
{
private:
   map<const unsigned long long, unsigned long long> *table;

public:
   X()
   {
      table = new map<const unsigned long long, unsigned long long>(10);
    }
}


Thanks
The same way you make any other array.
table = new map<const unsigned long long, unsigned long long>[10];

It may not be a bad idea to use a vector instead, though:
1
2
3
typedef std::map<const unsigned long long, unsigned long long> map_t;
std::vector<map_t> table;
X():table(10){}
I think that should work except that, instead of (10), you should have [10].
You might want to make a typedef for that map<const unsigned long long, unsigned long long>. That's a lot to have to type.
Topic archived. No new replies allowed.