I dont know how to give data to a map of map.
I'm lost....
For example :
map <int, map<int,char>> map1;
Imagine this is row, col data....
- how can I give data , for example: row 1 col 1 value 243
- How can I retrieve the pair data for row 7, col 23
- How can I iterate about the data of row 7 ?
- How can I iterate about row-data?
I understand the basica Map but not this. (and I dont find anything clear on the web...)
Thanks
Well, map doesn't allow duplicates, so you will only be able to have one column in any given row, which probably isn't what you want. You'll really want a std::multimap< int, std::map< int, char > > if you want a "spreadsheet-like" data structure. But nesting STL containers is usually a little harder to read/maintain. I would probably do something like this:
According to the standard, during the lexical analysis phase of compilation, the principle of "maximum munch" applies. Since >> is a valid operator, it will be tokenized as one, rather than two separate symbols unless there is whitespace between them.