I have a large database of tennis match reords played in the ATP and WTA tours over several years. I am going through these to generate a match history for each player in each year in each tour. I have 5 years of data and 4 tours (hence the dimensions in the declaration below). I want to do a typedef not just for these specified dimensions, but in general so I can declare another Array2DPlayerHistoryMap object, but if I don't put in a dimension the compiler compains. How can I do the 2nd and 3rd lines for the general case?

typedef map<string,set<MatchRecordPointer>> PlayerHistoryMap;
typedef array<PlayerHistoryMap,5> ArrayOfPlayerHistoryMap;
typedef array<ArrayOfPlayerHistoryMap,4> Array2DPlayerHistoryMap;
Array2DPlayerHistoryMap PlayerMatchHistory;
3 Years
Discussion Span
Last Post by mike_2000_17

If you don't know ahead of time what size you need for the arrays, then you need to use a dynamic array type instead of std::array (which is only for static size arrays). The class you can use is std::vector (see docs). This would make your lines look like this:

typedef map<string,set<MatchRecordPointer>> PlayerHistoryMap;
typedef vector<PlayerHistoryMap> ArrayOfPlayerHistoryMap;
typedef vector<ArrayOfPlayerHistoryMap> Array2DPlayerHistoryMap;
Array2DPlayerHistoryMap PlayerMatchHistory;
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.