So you want a grid of ints? How do you translate the ints back into items? Another array? Is this for the map save file, or the in memory map?
I'd just go with instance pointers, but hey, it's only wrong if it doesn't work.
This along the lines of what J-Snake was mentioning, basically a grid of lists.
class Object { ... };
class Container : public Object {
// ...
private:
list<Object*> _contents; // Or whatever you want here.
};
Object * item_grid[3][3] = {
{new Container, new Container, new Container},
... };
Now you can define the Container mechanics however you like, as your kinda bizzare sounding int map, an stl vector, a straight up array, a ball of fuzzy cats, whatever.
Basically, you have a
concept of each grid square being able to contain multiple items. Then you can refine the concept into an implementation. So maybe when drawing the map you'll draw each item in the container, one atop the other, or maybe instead of drawing all the items, you'll just draw a little bag icon, or whatever. Just start with the conceptualization of how you're going to manage the items, then find an implementation to express that concept.
PS > in my game, I opted for extreme simplicity at the cost of memory (a pretty cheap resource these days).
struct Cell
{
Sprite * tile;
Entity * layers[MAX_LAYERS];
// miscellaneous stuff here
};
typedef vector<vector<Cell> > Map;