Re: Multiple index maps
On Jul 1, 12:24pm, fgh.vbn....@gmail.com wrote:
> I am frequently using maps like the following:
> map<string, map<int, vector< pair<int, int> > > > m1;
> map<int, map<string, map<int, int> > > m2;
>
> This can be a little difficult to maintain if another coder doesn't
> really know the what the indexes stand for, the ordering of the
> indexes, etc.,
>
> Is there a better way to define multiple index maps? Of course, I can
> typedef the inner maps into something more readable but is that always
> good?
>
> Sometimes the index ordering matters and sometimes it doesn't. Does
> that make a difference?
why can't you use a struct to contain the multiple keys and use a
compare functor to compare the compound key.
|