jeudi 20 octobre 2016

C++ Unordered Map: error in bitset as key

I have made an unordered maps in C++ as shown below and I magically get 2 as output of this below code instead on 0. How should this be corrected?

unordered_map< bitset<3> , int > bitset_to_int;
bitset_to_int[000]=(int)0;
bitset<3> b;
b[0]=0;
b[1]=0;
b[2]=0;
cout<<bitset_to_int[b];

Aucun commentaire:

Enregistrer un commentaire