However, I got this error in the 'for' line: "error: expected ‘;’ before ‘it’" (and then errors that it is not declared, etc). I'm sure that there is no missing ; in other functions. If you try to write a random line before that you get no error there for example, always in the for.
It is there something that you need to do with iterators when you declare generic datatypes?
Well, I just tried it and I only had one error: You need to use const_iterator instead of iterator because src is const. Other than that it compiled fine for me.
In function ‘void show_map(const std::map<A, B>&)’:
error: need ‘typename’ before ‘std::map<A, B>::iterator’ because ‘std::map<A, B>’ is a dependent scope
clang wrote:
error: missing 'typename' prior to dependent type name 'std::map<A, B>::iterator'
So it should be for( typename std::map<A,B>::const_iterator it = src.begin();