When I try to compile this with gcc, it says two errors to the constructor:
- error: expected `,' or `...' before '>' token
- error: wrong number of template arguments (1, should be 4)
Of course I tried it with parentheses , and without const reference too, but it doesn't worked either way.
@writeonsharma
It seems that only std::map has problems like this (is there a specific reason for this?), but I could solve the problem by adding an empty constructor
yes you can.. i thought you want only this kind of code so i wrote for you. other wise you can remove the default value and the code will run fine.
there is some problem in maps when we initialize them in initialization list.. since some time and im trying to figure it out but with no success. this is related to the rest of two parameters of map which are compare and allocator. we need to give them also some values but how im not able to find.
what bazzy suggested i've tried that and its giving error. even if it will compile it will give segmentation fault. how can you take a reference of nothing? am i correct? you can try it.