This is a really easy question I'm sure but I'd appreciate the help. :)
Here's my variable in the .h file:
map<int, map<int, map<int, CString>*>*> batch;
Here's me trying to assign a value:
((*((*(batch[atoi(transnum)]))[1]))[atoi(*docnum)]) = page;
I added some extra parentheses while trying to figure this out in order to make sure the derefs were being processed in the right order - unfortunately, it still doesn't work. My application just crashes when running this line. I have it wrapped in a try {} catch {}, but no exception appears to be thrown. I don't use C++ very often and am wondering whether someone can tell me what I'm doing incorrectly.
Here's the relationship I'm trying to model:
List of transaction numbers (integers), needs to be ordered by key.
For each transaction number, I have two types of documents, Payments and Invoices (buckets represented by 0 and then 1 respectively in my data struct above)
In each type bucket, there can be one or more documents, These documents need to be ordered by id (docid)
Each docid links to a string that consists of a comma-delimited list of files on the file system for processing.
If you think there's a better data structure to use, I'd be interested to hear it.
EDIT: I know there are many better ways to do this. The scenario was that I was handed a heap of horrible MFC-riddled C++ code and told to have something done yesterday. It basically boiled down to getting the data structure in there, loading it up and then outputting it somewhere else. I was just trying to pound it out quickly when I asked this question. I appreciate the design suggestions though.
Thank you!
Tom