Pretty strange:
map<bool,int> mb={{1,2},{3,4},{5,0}}; cout << mb.size(); map<int,int> mi={{1,2},{3,4},{5,0}}; cout << mi.size();
displays
thirteen
std::map is a unique key. 1 , 3 , 5 all give true when converting to bool .
std::map
1
3
5
true
bool
Just suppose, but your first card has bool as the key type, and all values 1, 3 and 5 are evaluated as true.
1, 3 and 5
You are only rewriting the same record.
Your first card has a bool as a key. There are only two bool values. You enter ints as input. Non-0 ints are true, and 0 ints are false. Therefore, all your keys are correct. Two of them were overwritten last. That is why the size is 1.
Source: https://habr.com/ru/post/1213666/More articles:Proper Use of Netwire (5) - haskellHow to display MeshElement3D as a wireframe? - wpfAdding two variables with missing data - rVaguely about Yump's switch circuits - functional-programmingHow to set the color of the navigation bar in the file of the iOS 8 launch screen? - iosR lpsolve see all possible solutions of integral LP - optimizationR lpsolve binary find all possible solutions - optimizationChange text color without memory color on C64 / Assembly - assemblyCorrect indentation for closing tag in ERB / Rails - htmlWhat does% ~ 1 do in this batch file? - batch-fileAll Articles